In managing or testing an OpenStack private cloud environment, it may be periodically necessary to offload nova compute workloads to perform planned server maintenance. Live migration is often preferred and is generally the best option, as it requires zero instance downtime. Motivations for choosing to do an offline migration over a live migration can certainly vary, depending on any number of variables such as shared storage configuration, hardware condition, hypervisor flavor, or perhaps the nova compute, qemu or KVM versions that are in play. Whatever the reason, here is a simple example of an offline migration.
This environment is OpenStack Icehouse 2014.1, Juju-deployed onto MAAS-managed Ubuntu Server 14.04 LTS Trusty Tahr nodes. Storage back-end is ceph RBD, but other shared storage options should do as well. It’s all open source, and it’s all free as in … freedom to learn, or freedom to buy support if or as needed. By the way, I just love that about open source. Ok back on track, here goes:
The short version:
# For offline migration, the instance should be # in a STOPPED / shutoff state! Use nova stop for # non-graceful shutdown of the vm, if you must. # Get the instance ID nova list --all-tenants | grep my-instance # Confirm the current state and hypervisor node nova show ab90cc7a-7022-4157-b32a-11c49b7701cc # Migrate the instance, nova scheduler decides where nova migrate ab90cc7a-7022-4157-b32a-11c49b7701cc # Watch & wait watch nova migration-list # Seal the deal nova resize-confirm ab90cc7a-7022-4157-b32a-11c49b7701cc # Confirm the goods nova show ab90cc7a-7022-4157-b32a-11c49b7701cc # Fire it up nova start ab90cc7a-7022-4157-b32a-11c49b7701cc