Ask Your Question
0

How to take snapshot of VM which is booted from volume??

asked 2018-10-08 07:31:02 -0500

vathanlal gravatar image

updated 2018-10-09 03:36:17 -0500

Hello All,

In my OpenStack cluster(Newton) I have VM's which are booted from volume(Ceph based). I have one more Openstack cluster(Queens) which is completely separated from the Newton based one. I want to take the snapshot of VM's running in Newton based cluster and upload the snapshots in my Queens based cluster and create VM's out of them. But when I took snapshot of VM's which are booted from volume the snapshot size is showing 0bytes. How can I take snapshot of VM booted from volume so that I can upload it in other cluster??

openstack image show e6b67bd5-aa38-4951-89ec-1fc964f892af

+------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                          |
+------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | d41d8cd98f00b204e9800998ecf8427e                                                                                                               |
| container_format | bare                                                                                                                                           |
| created_at       | 2018-10-08T08:23:18Z                                                                                                                           |
| disk_format      | qcow2                                                                                                                                          |
| file             | /v2/images/e6b67bd5-aa38-4951-89ec-1fc964f892af/file                                                                                           |
| id               | e6b67bd5-aa38-4951-89ec-1fc964f892af                                                                                                           |
| min_disk         | 0                                                                                                                                              |
| min_ram          | 0                                                                                                                                              |
| name             | TEST_Image_Master-2018-10-08-10-23                                                                                                         |
| owner            | d160f4259e2e464ea3f9fb0c7ea39571                                                                                                               |
| properties       | base_image_ref='', bdm_v2='True', block_device_mapping='[{"guest_format": null, "boot_index": 0, "delete_on_termination": false, "no_device":  |
|                  | null, "snapshot_id": "39cfe636-18b8-48aa-be3d-f0e48e135fb8", "device_name": "/dev/vda", "disk_bus": "virtio", "image_id": null, "source_type": |
|                  | "snapshot", "tag": null, "device_type": "disk", "volume_id": null, "destination_type": "volume", "volume_size": 40}]',                         |
|                  | root_device_name='/dev/vda'                                                                                                                    |
| protected        | False                                                                                                                                          |
| schema           | /v2/schemas/image                                                                                                                              |
| size             | 0                                                                                                                                              |
| status           | active                                                                                                                                         |
| tags             |                                                                                                                                                |
| updated_at       | 2018-10-08T08:23:19Z                                                                                                                           |
| virtual_size     | None                                                                                                                                           |
| visibility       | private                                                                                                                                        |
+------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
edit retag flag offensive close merge delete

Comments

Can you share the output of openstack image show SNAPSHOT? As admin user, just in case.

Bernd Bausch gravatar imageBernd Bausch ( 2018-10-08 10:58:41 -0500 )edit

openstack image show SNAPSHOT is updated in the question

vathanlal gravatar imagevathanlal ( 2018-10-09 03:37:16 -0500 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2018-10-09 01:49:54 -0500

updated 2018-10-09 23:39:35 -0500

If your taking snapshot of the instance, which is booted from volume, two snapshots will be created, one is instance snap in images section(which is mentioned as 0 bytes), and another one is volume snapshot which is created in volume snapshots section. You can use the volume snapshot for launching the instance.

convert this snapshot into the volume by clicking create volume(refer below pic)

image description.

image description

after creating the volume upload that volume into the glance in QCOW2 format. (refer below pic)

image description

image description

then Download glance image using glance image-download command..after you can move the image to any cloud environment

Try this it will work for you

edit flag offensive delete link more

Comments

Thanks. I can see that. Is there any option to download it so that it can be uploaded in other environment like normal image snapshot?? or do you know any method which I can use to move this VM snapshot(booted from volume) to a new cloud environment??

vathanlal gravatar imagevathanlal ( 2018-10-09 03:39:23 -0500 )edit

convert this snapshot into the volume by clicking create volume(refer above pic), after creating the volume upload that volume into the glance in QCOW2 format.

then Download glance image using glance image-download command

after you can move the image to any cloud environment

Eranachandran gravatar imageEranachandran ( 2018-10-09 04:08:59 -0500 )edit

Why not use rbd layer directly?

rbd export $pool/$volume-id /$your-dir/$filename

then upload it to another environment:

openstack image create --file /$your-dir/$filename --disk-format $disk-format $image-name
eblock gravatar imageeblock ( 2018-10-09 06:54:41 -0500 )edit
0

answered 2018-10-09 07:14:59 -0500

eblock gravatar image

First I have to ask, are you aware of the recommendation to use raw images for Ceph? I wrote a small blog post to show the difference between raw and qcow2 images.

To answer your question about the size of 0 Bytes. If you create the instance snapshot via Horizon you'll probably end up with a qcow2 disk-format for the new image, at least that was set in my case. If you create the snapshot from the command line you can choose the disk-format. You can't change the disk-format after the snapshot has been uploaded.

For comparison I created two glance images from of a running VM (based on a volume):

control:~ #  imagelist.sh snap
+--------------------------------------+--------------------+-------------+------------------+---------+--------+
| ID                                   | Name               | Disk Format | Container Format | Size    | Status |
+--------------------------------------+--------------------+-------------+------------------+---------+--------+
| 391f5061-378b-4ebb-a1f5-8a347ee540b0 | test-vol-snap      | qcow2       | bare             | 0B      | active |
| 49b9755f-92aa-4c91-98a4-ebd67b3958cb | test-vol-snap2     | raw         | bare             | 1GB     | active |
+--------------------------------------+--------------------+-------------+------------------+---------+--------+

(The script "imagelist.sh" is a custom script I created to give some more information about the images)

As you can see, these two images also differ in size. test-vol-snap was created from Horizon resulting in a qcow image, snap2 was created via command line resulting in a raw image. You can create the image like this (CLI):

control:~ #  openstack image create --volume d7b75639-47ae-46d3-a72e-0795ac88a1c2 --disk-format raw test-vol-snap2
+---------------------+--------------------------------------+
| Property            | Value                                |
+---------------------+--------------------------------------+
| container_format    | bare                                 |
| disk_format         | raw                                  |
| display_description |                                      |
| id                  | d7b75639-47ae-46d3-a72e-0795ac88a1c2 |
| image_id            | 49b9755f-92aa-4c91-98a4-ebd67b3958cb |
| image_name          | test-vol-snap2                       |
| protected           | False                                |
| size                | 1                                    |
| status              | uploading                            |
| updated_at          | 2018-10-09T11:42:24.000000           |
| visibility          | shared                               |
| volume_type         | None                                 |
+---------------------+--------------------------------------+
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

2 followers

Stats

Asked: 2018-10-08 07:31:02 -0500

Seen: 62 times

Last updated: Oct 09