Update README to not reference client passthrough
It's there and we support it, but we don't have to _talk_ about it. Change-Id: Ia3419a72fa13d42a17ddc0243d7800e462a827b2
This commit is contained in:
parent
91e01482c6
commit
edc5fc2d98
31
README.rst
31
README.rst
@ -24,29 +24,22 @@ Sometimes an example is nice.
|
|||||||
::
|
::
|
||||||
|
|
||||||
import shade
|
import shade
|
||||||
import time
|
|
||||||
|
# Initialize and turn on debug loggin
|
||||||
|
shade.simple_logging(debug=True)
|
||||||
|
|
||||||
# Initialize cloud
|
# Initialize cloud
|
||||||
# Cloud configs are read with os-client-config
|
# Cloud configs are read with os-client-config
|
||||||
cloud = shade.openstack_cloud(cloud='mordred')
|
cloud = shade.openstack_cloud(cloud='mordred')
|
||||||
|
|
||||||
# OpenStackCloud object has an interface exposing OpenStack services methods
|
# Upload an image to the cloud
|
||||||
print cloud.list_servers()
|
image = cloud.create_image(
|
||||||
s = cloud.list_servers()[0]
|
'ubuntu-trusty', filename='ubuntu-trusty.qcow2', wait=True)
|
||||||
|
|
||||||
# But you can also access the underlying python-*client objects
|
# Find a flavor with at least 512M of RAM
|
||||||
# This will go away at some point in time and should be considered only
|
flavor = cloud.get_flavor_by_ram(512)
|
||||||
# usable for temporary poking
|
|
||||||
cinder = cloud.cinder_client
|
|
||||||
volumes = cinder.volumes.list()
|
|
||||||
volume_id = [v for v in volumes if v['status'] == 'available'][0]['id']
|
|
||||||
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)
|
|
||||||
attachments = cinder.volumes.get(volume_id).attachments
|
|
||||||
print attachments
|
|
||||||
|
|
||||||
|
# Boot a server, wait for it to boot, and then do whatever is needed
|
||||||
|
# to get a public ip for it.
|
||||||
|
cloud.create_server(
|
||||||
|
'my-server', image=image, flavor=flavor, wait=True, auto_ip=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user