Skip to main content
Version: 2.0

Export Instance

How to export a Instance from CubeOS

Connect to root shell with SSH

$ ssh root@IPADDRESS
Warning: Permanently added '192.168.X.X' (ECDSA) to the list of known hosts.
Password:
Welcome to the Cube Appliance
#

Change Dirctory to /var/support

# cd /var/support/

Load CubeOS Credentials

# source /etc/admin-openrc.sh

List Instances

CLI : nova list

# nova list
+--------------------------------------+--------+---------+------------+-------------+----------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------+---------+------------+-------------+----------------------------+
| fda8ff28-e42e-4457-bbc8-d7b7d016d9a5 | ubuntu | ACTIVE | - | Running | pub_10_32_0_0=10.32.10.104 |
+--------------------------------------+--------+---------+------------+-------------+----------------------------+

Stop the Instance

CLI : nova stop <instance or UUID>

# nova stop fda8ff28-e42e-4457-bbc8-d7b7d016d9a5n
+--------------------------------------+--------+---------+------------+-------------+----------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------+---------+------------+-------------+----------------------------+
| fda8ff28-e42e-4457-bbc8-d7b7d016d9a5 | ubuntu | SHUTOFF | - | Shutdown | pub_10_32_0_0=10.32.10.104 |
+--------------------------------------+--------+---------+------------+-------------+----------------------------+

Create Snapshot

CLI : nova image-create --poll <instance or UUID> <snapshot-name>

# nova image-create --poll fda8ff28-e42e-4457-bbc8-d7b7d016d9a5 ubuntu_snap

Server snapshotting... 100% complete
Finished

List Snapshot

CLI: cinder snapshot-list

# cinder snapshot-list
+--------------------------------------+--------------------------------------+-----------+------------------------------+------+
| ID | Volume ID | Status | Name | Size |
+--------------------------------------+--------------------------------------+-----------+------------------------------+------+
| 4456e05a-f0d3-4726-bb15-878046384d7a | bb860f10-d6c4-444b-9a2b-c2fe9321fd2a | available | snapshot for ubuntu_snap | 20 |
+--------------------------------------+--------------------------------------+-----------+------------------------------+------+

Create a volume from snapshot

CLI: cinder create --snapshot-id <snapshot-uuid> <snapshot-size-in-gb>

# cinder create --snapshot-id 4456e05a-f0d3-4726-bb15-878046384d7a 20
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2020-07-17T06:43:51.000000 |
| description | None |
| encrypted | False |
| id | fd9920be-2d4c-491f-8b01-d0d36ea2024c |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | None |
| os-vol-host-attr:host | cube@ceph#ceph |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | faa0d0a46f404fc89933dd05802df8fb |
| replication_status | None |
| size | 20 |
| snapshot_id | 4456e05a-f0d3-4726-bb15-878046384d7a |
| source_volid | None |
| status | creating |
| updated_at | 2020-07-17T06:43:51.000000 |
| user_id | 065e58ff6e824316a2b42f3f8df3dea3 |
| volume_type | None |
+--------------------------------+--------------------------------------+

Check Volume

CLI: cinder list

# cinder list
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| fd9920be-2d4c-491f-8b01-d0d36ea2024c | available | - | 20 | CubeStorage | true | |
| ebcf1ec7-8a34-4e15-bbfa-1671cf81694f | in-use | | 20 | CubeStorage | true | 46d9dcdc-3233-43f9-bc1b-1f91a9ba1de3 |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+

Convert Volume to image

CLI: cinder upload-to-image <volume id> <image name>

  • please wait for the convert progress complete before you proceed to next steps
    # cinder upload-to-image fd9920be-2d4c-491f-8b01-d0d36ea2024c ubuntu_export
+---------------------+--------------------------------------+
| Property | Value |
+---------------------+--------------------------------------+
| container_format | bare |
| disk_format | raw |
| display_description | None |
| id | fd9920be-2d4c-491f-8b01-d0d36ea2024c |
| image_id | 0db015e4-857d-45f7-8b16-6703162d292d |
| image_name | ubuntu_export |
| protected | False |
| size | 20 |
| status | uploading |
| updated_at | 2020-07-17T06:43:51.000000 |
| visibility | shared |
| volume_type | None |
+---------------------+--------------------------------------+

List Images

CLI: glance image-list

# glance image-list
+--------------------------------------+-----------------------+
| ID | Name |
+--------------------------------------+-----------------------+
| 0db015e4-857d-45f7-8b16-6703162d292d | ubuntu_export |
+--------------------------------------+-----------------------+

Export to file

CLI: glance image-download --file <filename>.raw <image id>

# glance image-download --file ubuntu_export.raw 0db015e4-857d-45f7-8b16-6703162d292d

Check result

# ll -ah
total 21G
drwxrwsrwx 2 root www-data 4.0K Feb 26 10:55 ./
drwxr-xr-x 29 root root 4.0K Feb 22 15:17 ../
-rw-rw-r-- 1 root www-data 5.5K Feb 22 15:18 CUBE_2.0.0_20210222-071801.391310_unconfigured.snapshot
-rw-r--r-- 1 root www-data 331M Feb 19 01:11 bionic-server-cloudimg-amd64.vmdk
-rw-r--r-- 1 root www-data 1.5K Feb 23 15:06 dell-uefi.license
-r--r--r-- 1 root www-data 12K Feb 25 16:08 map_hex_cli.3875489
-r--r--r-- 1 root www-data 12K Feb 22 15:18 map_hex_firsttime.3305
-rw-r--r-- 1 root www-data 20G Feb 26 10:54 ubuntu_export.raw

[optional] Convert to VHD

# qemu-img convert -f raw -o subformat=fixed,force_size -O vpc ubuntu_export.raw ubuntu_export.vhd