From 084df16c9b9d36571081bb07b336fb902ebc4dad Mon Sep 17 00:00:00 2001 From: Ricardo Carrillo Cruz Date: Thu, 19 Feb 2015 18:40:39 +0100 Subject: [PATCH] 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 --- README.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 822e16955..4f8766073 100644 --- a/README.rst +++ b/README.rst @@ -26,18 +26,22 @@ Sometimes an example is nice. from shade import * import time + # Initialize cloud + # Cloud configs are read with os-client-config cloud = openstack_cloud('mordred') - nova = cloud.nova_client - print nova.servers.list() - s = nova.servers.list()[0] + # OpenStackCloud object has an interface exposing OpenStack services methods + print cloud.list_servers() + s = cloud.list_servers()[0] + # But you can also access the underlying python-*client objects cinder = cloud.cinder_client volumes = cinder.volumes.list() - print volumes 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 = [] + print volume_id while not attachments: print "Waiting for attach to finish" time.sleep(1)