我正在尝试使用python-novaclient从openstack中的可启动卷创建实例。
我正在采取的步骤如下:
步骤1:创建一个具有100GB映像的“ Centos”卷。步骤2:使用在步骤1中创建的卷创建实例。
但是,我必须做错了某些事情,或者丢失了一些无法完成任务的信息。
这是我在python shell中的命令。
import time, getpass
from cinderclient import client
from novaclient.client import Client
project_name = 'project'
region_name = 'region'
keystone_link = 'https://keystone.net:5000/v2.0'
network_zone = "Public"
key_name = 'key_pair'
user = 'user'
pswd = getpass.getpass('Password: ')
# create a connection
cinder = client.Client('1', user, pswd, project_name, keystone_link, region_name = region_name)
# get the volume id that we will attach
print(cinder.volumes.list())
[<Volume: 1d36203e-b90d-458f-99db-8690148b9600>, <Volume: d734f5fc-87f2-41dd-887e-c586bf76d116>]
vol1 = cinder.volumes.list()[1]
vol1.id
block_device_mapping = {'device_name': vol1.id, 'mapping': '/dev/vda'}
### +++++++++++++++++++++++++++++++++++++++++++++++++++++ …Run Code Online (Sandbox Code Playgroud)