cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
7854
Views
1
Helpful
0
Comments
Vikram Hosakote
Cisco Employee
Cisco Employee

This is a blog about how to:

  1. Snapshot an OpenStack nova instance as a glance image
  2. Boot an instance from the snapshot (glance image)
  3. Download the snapshot (glance image) as a file onto disk
  4. Validate the downloaded snapshot file (image) using qemu-img
  5. Upload this file (image) on disk into OpenStack glance

1.  Snapshot an OpenStack nova instance as a glance image:

1.png

Make sure that this snapshot is seen as an glance image.

1.1.png

2.  Boot an instance from the snapshot (glance image):

2.png

Make sure that the flavor of the instance booted is at least equal to or bigger than the flavor of the instance that was snapshotted in step 1.

2.1.png

Make sure to allow ICMP and SSH (TCP port 22) in nova security groups.  Once the above instance is up, make sure you can ping and SSH into the instance.

3.  Download the snapshot (glance image) as a file onto disk:

# glance image-list

+--------------------------------------+--------------------------------+

| ID                                   | Name                           |

+--------------------------------------+--------------------------------+

| 56c4028c-57ab-4d12-8cf4-d96d874e90c3 | test-vm-snapshot               |

+--------------------------------------+--------------------------------+

# glance image-download 56c4028c-57ab-4d12-8cf4-d96d874e90c3 --file test-vm-snapshot

#

# ls -l test-vm-snapshot

-rw-r--r--. 1 root root 960692224 Jul 18 20:26 test-vm-snapshot

This downloaded image can now be backed up or transferred over the network.

4.  Validate the downloaded snapshot file (image) using qemu-img

The downloaded snapshot file (image) can be validated using:

qemu-image check test-vm-snapshot

qemu-image info test-vm-snapshot

Sorry, unfortunately I do not have the output of the qemu-image commands above.

qemu-img(1): QEMU disk image utility - Linux man page

5.  Upload this file (image) on disk into OpenStack glance

# glance image-create --name 'image-from-downloaded-snapshot' --disk-format qcow2 --container-format bare --file test-vm-snapshot --visibility public --progress

[=============================>] 100%

+------------------+--------------------------------------+

| Property         | Value                                |

+------------------+--------------------------------------+

| checksum         | 6c323b8eb0406d7f6097bfb821e9d68a     |

| container_format | bare                                 |

| created_at       | 2016-07-18T20:28:25Z                 |

| disk_format      | qcow2                                |

| id               | 44734abf-60c1-42ee-ac2a-c3018f43f003 |

| min_disk         | 0                                    |

| min_ram          | 0                                    |

| name             | image-from-downloaded-snapshot       |

| owner            | 3f61ded7cb7b46d594cbff5899e54ead     |

| protected        | False                                |

| size             | 960692224                            |

| status           | active                               |

| tags             | []                                   |

| updated_at       | 2016-07-18T20:28:37Z                 |

| virtual_size     | None                                 |

| visibility       | public                               |

+------------------+--------------------------------------+

# glance image-list

+--------------------------------------+--------------------------------+

| ID                                   | Name                           |

+--------------------------------------+--------------------------------+

| 44734abf-60c1-42ee-ac2a-c3018f43f003 | image-from-downloaded-snapshot |

+--------------------------------------+--------------------------------+

This uploaded image will be seen in Horizon as well under "Images".  This image can now be used to boot a nova instance!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:


Cisco Cloud Native resources: