Revamp README file
The README used only python-*client objects, thus defeating the purpose of shade, which is about putting a facade for all those interfaces to simplify things. README now shows you can use shade simplified interface and also access the underlying python-*client API objects. Change-Id: I0c638beab615177fc6ce3704c5443a3394a87ed0
This commit is contained in:
parent
ad041f4252
commit
084df16c9b
14
README.rst
14
README.rst
@ -26,18 +26,22 @@ Sometimes an example is nice.
|
|||||||
from shade import *
|
from shade import *
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
# Initialize cloud
|
||||||
|
# Cloud configs are read with os-client-config
|
||||||
cloud = openstack_cloud('mordred')
|
cloud = openstack_cloud('mordred')
|
||||||
|
|
||||||
nova = cloud.nova_client
|
# OpenStackCloud object has an interface exposing OpenStack services methods
|
||||||
print nova.servers.list()
|
print cloud.list_servers()
|
||||||
s = nova.servers.list()[0]
|
s = cloud.list_servers()[0]
|
||||||
|
|
||||||
|
# But you can also access the underlying python-*client objects
|
||||||
cinder = cloud.cinder_client
|
cinder = cloud.cinder_client
|
||||||
volumes = cinder.volumes.list()
|
volumes = cinder.volumes.list()
|
||||||
print volumes
|
|
||||||
volume_id = [v for v in volumes if v.status == 'available'][0].id
|
volume_id = [v for v in volumes if v.status == 'available'][0].id
|
||||||
nova.volumes.create_server_volume(s.id, volume_id, None)
|
nova = cloud.nova_client
|
||||||
|
print nova.volumes.create_server_volume(s.id, volume_id, None)
|
||||||
attachments = []
|
attachments = []
|
||||||
|
print volume_id
|
||||||
while not attachments:
|
while not attachments:
|
||||||
print "Waiting for attach to finish"
|
print "Waiting for attach to finish"
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user