Instructions:
- Enable key based authentication on destination HV, allowing root login from source into destination using key.
- Modify nova configuration to pass extra arguments to libvirt.
- restart only nova-compute
- launching live migration from nova CLI.
Verify /etc/nova/nova.conf on main controller if no cell, or /etc/nova/nova.conf on cell controllers to make sure using uuid as VM name, otherwise nova will run into issue complaining no VM with name ‘instance-xxxx’, in case primary key changed in nova database. Please make sure instance_name_template is using uuid in default section:
Force using uuid as instance name
#/etc/nova/nova.conf
…
instance_name_template=%(uuid)s
…
# requires restarting nova-conductor on main controllers or Cell controllers, depending where change is made.
Verify both short name and fqdn of destination are resolvable, otherwise add to local hosts file /etc/hosts
in case hostname can not be properly resolved
#/etc/hosts
192.168.1.100 test1 test1.localdomain.com
Generate key pairs for user root on source HV.
generate key pair for user root
# enable key based root access on destination
# this is done on source
# generate keys
ssh-keygen -t rsa
Copy public keys to remote destination
Transfer public key to destination
# copy keys to destination
ssh-copy-id root@test1
Verify if we can ssh to destination with short name as root to make sure key based authentication working, and same time accepting and persist destination host id on source.
Verify key based authentication and accept host key on destination
ssh root@test1
Modify /etc/nova/nova.conf to enable live migration over ssh tunneling and local drive based live migration.
# /etc/nova/nova.conf
[DEFAULT]
…
live_migration_uri=qemu+ssh://%s/system
live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC
block_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC
…
Restart nova-compute
Restart nova-compute service
service nova-compute restart
Now, migration through Nova CLI should work.
Nova Cli
nova live-migration –block-migrate a0a4f38d-ee65-4126-a90f-f4dcbb12d7e6 hv2
VM state will be changed to migrating, and back to active again when process completes.
Concern:
Test migration across cell is not supported.
Havana nova-compute has bug dealing mount with nbd. This requires code change:
Code fix in Havana version of Nova-compute
nova/virt/disk/mount/nbd.py
# added self.partition = 1 at line 72
…
if not os.path.exists(‘/sys/block/nbd0’):
LOG.error(_(‘nbd module not loaded’))
self.error = _(‘nbd unavailable: module not loaded’)
return None
devices = self._detect_nbd_devices()
random.shuffle(devices)
device = self._find_unused(devices)
if not device:
# really want to log this info, not raise
self.error = _(‘No free nbd devices’)
return None
self.partition = 1
return os.path.join(‘/dev’, device)
….
# then restart nova-compute