当前位置: 移动技术网 > IT编程>脚本编程>Python > openstack Ocata版本 python

openstack Ocata版本 python

2019年04月14日  | 移动技术网IT编程  | 我要评论

思想汇报2011年9月,北京注册会计师报名,金莲花

from keystoneauth1.identity import v3                                                                                                                    

from keystoneauth1 import session

from novaclient import client

from neutronclient.v2_0 import client as neutron_client

from cinderclient.v1 import client as cinder_client

 

def get_cloud2_creds():

    d = dict(

        auth_url= 'http://172.28.14.254:35357/v3',

        username= "admin",

        password= "password",

        project_name= "admin",

        user_domain_id= "default",

        project_domain_id= "default"

    )   

    return d

    

auth = v3.password(**get_cloud2_creds())

sess = session.session(auth=auth)

nova = client.client("2", session=sess)

print nova.servers.list()

neutron = neutron_client.client(session=sess)

#print neutron.list_networks() 

#print neutron.list_subnets()

#print neutron.list_ports(**{'network_id':'73688ff6-e0fc-42a4-ab1d-8e5faaa2cf2f'})

cinder = cinder_client.client(session=sess)

print cinder.volumes.list()

print cinder.volumes.get("eea1e3c5-93f8-4939-978e-a459e6da5d0f")

  

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网