Ask Your Question

murtaza's profile - activity

2015-06-10 02:02:30 -0500 received badge  Notable Question (source)
2015-06-10 02:02:30 -0500 received badge  Famous Question (source)
2014-12-16 18:39:16 -0500 commented answer Ability to download volume snapshot in openstack havana

Vinode or mpetason,

I am also looking to do the same. I have created a snapshot of a Volume, and I wish to download the snapshot and upload it to another region. Have you guys found a way to do that or is there another way to transfer 'snapshots of a volume' between regions.

Thanks, Murtaza

2014-12-16 18:35:30 -0500 received badge  Supporter (source)
2014-12-01 03:01:00 -0500 received badge  Self-Learner (source)
2014-12-01 03:01:00 -0500 received badge  Teacher (source)
2014-12-01 03:00:32 -0500 received badge  Popular Question (source)
2014-11-25 21:34:44 -0500 answered a question Create an instance from volume in openstach with python-novaclient

I was able to get it to work by using this dictionary:

block_dev_mapping = {'vda':'uuid of the volume you want to use'}

Thanks.

2014-11-22 20:48:42 -0500 asked a question Create an instance from volume in openstach with python-novaclient

Hello,

I am trying to create an instance from a bootable volume in openstack using python-novaclient.

The steps I am taking are following:

Step1: create a volume with an Image "Centos" with 100GB. Step2: create an instance with the volume that I created in step1.

However, I must be doing something wrong or missing some information that it is not able to complete the task.

Here are my commands in 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'}



### +++++++++++++++++++++++++++++++++++++++++++++++++++++ ###
# now create a connection with nova and create then instance object
nova = Client(2, user, pswd, project_name, keystone_link, region_name = region_name)

# find the image 
image = nova.images.find(name="NETO CentOS 6.4 x86_64 v2.2")

# get the flavor
flavor = nova.flavors.find(name="m1.large")

#get the network and attach
network = nova.networks.find(label=network_zone)
nics = [{'net-id': network.id}]

# get the keyname and attach
key_pair = nova.keypairs.get(key_name)

s1 = 'nova-vol-test'

server = nova.servers.create(name = s1, image = image.id, block_device_mapping = block_device_mapping, flavor = flavor.id, nics = nics, key_name = key_pair.name)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/servers.py", line 902, in create
    **boot_kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/servers.py", line 554, in _boot
    return_raw=return_raw, **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/base.py", line 100, in _create
    _resp, body = self.api.client.post(url, body=body)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 490, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 465, in _cs_request
    resp, body = self._time_request(url, method, **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 439, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 433, in request
    raise exceptions.from_response(resp, body, url, method)
novaclient.exceptions.BadRequest: Block Device Mapping is Invalid: failed to get volume /dev/vda. (HTTP 400) (Request-ID: req-2b9db4e1-f24f-48c6-8660-822741ca52ad)
>>>

I tried to find any documentation so that I can solve this on my own, however, I was not able to.

If anyone has tried this before, I would appreciate their help on this. Also, if there is another way of doing this, please let me know.

Thanks, Murtaza