Instance Live Migration in OpenStack using CLI

Dear friend, in this tutorial we will see Instance Live Migration in OpenStack using CLI. Instance Migration will be needed when we need to migrate our running instance from one host to another host without any network break.

For more details you can see OpenStack site. Click here

Suppose if our one compute node is failing to provide compute services due to memory issue, CPU issue or any hardware issue then we can move our instance to another host and we can repaired our compute node.

We will follow these steps to perform instance live migration

  • Find the Instance ID.
  • Determine the host where instance is running.
  • Select the compute node where you want to migrate the instance.
  • Before migration check the compute node has enough resources.
  • Instance live migration to another host.
  • Verify instance live migration.

Find the Instance ID

We can find the instance, which we want to move to another host. “openstack server list” command can be use to display instance list with Instance ID, where installer is our instance name and ID is our instance ID.

Determine the host where instance is running.

Determine the host where is our instance is running. “openstack server show installer” command can be use to display host were instance is running.

Select the compute node where you want to migrate the instance.

Select the compute node where you want to migrate the instance. In this example, we will migrate the instance to overcloud-sriovperformancecompute-0.localdomain.

[stack@undercloud (cbamrc.v2) ~]$ openstack compute service list

Before migration check the compute node has enough resources.

We need to be checked our compute node has enough resources are available or not? We can check resource status with this command “openstack host show overcloud-sriovperformancecompute-0.localdomain”.

[stack@undercloud (cbamrc.v2) ~]$ openstack host show overcloud-sriovperformancecompute-0.localdomain
+-------------------------------------------------+------------+-----+-----------+---------+
| Host | Project | CPU | Memory MB | Disk GB |
+-------------------------------------------------+------------+-----+-----------+---------+
| overcloud-sriovperformancecompute-0.localdomain | (total) | 56 | 195222 | 210028 |
| overcloud-sriovperformancecompute-0.localdomain | (used_now) | 0 | 2048 | 0 |
| overcloud-sriovperformancecompute-0.localdomain | (used_max) | 0 | 0 | 0 |
+-------------------------------------------------+------------+-----+-----------+---------+
[stack@undercloud (cbamrc.v2) ~]$

Instance live migration to another host.

Now we can use this command “nova live-migration installer overcloud-sriovperformancecompute-0.localdomain” to migrate instance on compute node 0.

[stack@undercloud (cbamrc.v2) ~]$ nova live-migration installer overcloud-sriovperformancecompute-0.localdomain

Verify instance after live migration.

After successfully performed instance migration command, we can check our instance is migrated successfully or not?

[stack@urclouds (cbamrc.v2) ~]$ openstack server show installer
+--------------------------------------+------------------------------------------------------------+
| Field | Value |
+--------------------------------------+------------------------------------------------------------+
| OS-DCF:diskConfig | AUTO |
| OS-EXT-AZ:availability_zone | zone1 |
| OS-EXT-SRV-ATTR:host | overcloud-sriovperformancecompute-1.localdomain |
| OS-EXT-SRV-ATTR:hypervisor_hostname | overcloud-sriovperformancecompute-1.localdomain |
| OS-EXT-SRV-ATTR:instance_name | instance-0000007a |
| OS-EXT-STS:power_state | Running |
| OS-EXT-STS:task_state | None |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2019-02-28T07:27:45.000000 |
| OS-SRV-USG:terminated_at | None |
| accessIPv4 | |
| accessIPv6 | |
| addresses | CBAM-External-net=10.11.182.45 |
| config_drive | |
| created | 2019-02-28T07:27:12Z |
| flavor | CBAM-installer-Node (c16a7c06-7c40-450a-9725-a144cf214377) |
| hostId | 0259399f106b5eae5d0b1bda44fbe327ee4cb5710d987ad2bd91cb01 |
| id | 02e5778c-e081-4125-a1f9-040cacb81ca5 |
| image | installer (a79011d4-f04d-4dad-a91c-c46c54073446) |
| key_name | keypair-installer |
| name | installer |
| os-extended-volumes:volumes_attached | [] |
| progress | 0 |
| project_id | 67eff8b0b01f4d0abeb129df3debcd39 |
| properties | |
| security_groups | [{u'name': u'cbam-installer-sec-group'}] |
| status | ACTIVE |
| updated | 2019-02-28T07:27:45Z |
| user_id | 185ad06f82b445419dcf4cd137144ab3 |
+--------------------------------------+------------------------------------------------------------+
[stack@undercloud (cbamrc.v2) ~]$

You can see in above output, our instance has been successfully migrated on compute node 1.

You can also check this link: –

Openstack instance management using CLI

Leave a Reply