{"id":53,"date":"2017-06-02T15:03:56","date_gmt":"2017-06-02T23:03:56","guid":{"rendered":"http:\/\/iaastalk.com\/?p=53"},"modified":"2017-06-02T15:03:56","modified_gmt":"2017-06-02T23:03:56","slug":"enable-live-migration-using-local-disk-with-nova","status":"publish","type":"post","link":"http:\/\/iaastalk.com\/?p=53","title":{"rendered":"Enable live migration using local disk with Nova"},"content":{"rendered":"<p>Instructions:<\/p>\n<ul>\n<li>Enable key based authentication on destination HV, allowing root login from source into destination using key.<\/li>\n<li>Modify nova configuration to pass extra arguments to libvirt.<\/li>\n<li>restart only nova-compute<\/li>\n<li>launching live migration from nova CLI.<\/li>\n<\/ul>\n<p>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 &#8216;instance-xxxx&#8217;, in case primary key changed in nova database. Please make sure instance_name_template is using uuid in default section:<\/p>\n<p>Force using uuid as instance name<\/p>\n<p>#\/etc\/nova\/nova.conf<br \/>\n&#8230;<br \/>\ninstance_name_template=%(uuid)s<br \/>\n&#8230;<\/p>\n<p># requires restarting nova-conductor on main controllers or Cell controllers, depending where change is made.<\/p>\n<p>Verify both short name and fqdn of destination are resolvable, otherwise add to local hosts file \/etc\/hosts<br \/>\nin case hostname can not be properly resolved<br \/>\n#\/etc\/hosts<\/p>\n<p>192.168.1.100\u00a0 test1 test1.localdomain.com<br \/>\nGenerate key pairs for user root on source HV.<br \/>\ngenerate key pair for user root<br \/>\n# enable key based root access on destination<br \/>\n# this is done on source<br \/>\n# generate keys<br \/>\nssh-keygen -t rsa<\/p>\n<p>Copy public keys to remote destination<br \/>\nTransfer public key to destination<br \/>\n# copy keys to destination<br \/>\nssh-copy-id root@test1<\/p>\n<p>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.<br \/>\nVerify key based authentication and accept host key on destination<br \/>\nssh root@test1<\/p>\n<p>Modify \/etc\/nova\/nova.conf to enable live migration over ssh tunneling and local drive based live migration.<br \/>\n# \/etc\/nova\/nova.conf<br \/>\n[DEFAULT]<br \/>\n&#8230;<br \/>\nlive_migration_uri=qemu+ssh:\/\/%s\/system<br \/>\nlive_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC<br \/>\nblock_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_NON_SHARED_INC<br \/>\n&#8230;<\/p>\n<p>Restart nova-compute<\/p>\n<p>Restart nova-compute service<br \/>\nservice nova-compute restart<\/p>\n<p>Now, migration through Nova CLI should work.<\/p>\n<p>Nova Cli<br \/>\nnova live-migration &#8211;block-migrate a0a4f38d-ee65-4126-a90f-f4dcbb12d7e6 hv2<br \/>\nVM state will be changed to migrating, and back to active again when process completes.<br \/>\nConcern:<\/p>\n<p>Test migration across cell is not supported.<\/p>\n<p>Havana nova-compute has bug dealing mount with nbd. This requires code change:<br \/>\nCode fix in Havana version of Nova-compute<br \/>\nnova\/virt\/disk\/mount\/nbd.py<br \/>\n# added self.partition = 1 at line 72<br \/>\n&#8230;<br \/>\nif not os.path.exists(&#8216;\/sys\/block\/nbd0&#8217;):<br \/>\nLOG.error(_(&#8216;nbd module not loaded&#8217;))<br \/>\nself.error = _(&#8216;nbd unavailable: module not loaded&#8217;)<br \/>\nreturn None<br \/>\ndevices = self._detect_nbd_devices()<br \/>\nrandom.shuffle(devices)<br \/>\ndevice = self._find_unused(devices)<br \/>\nif not device:<br \/>\n# really want to log this info, not raise<br \/>\nself.error = _(&#8216;No free nbd devices&#8217;)<br \/>\nreturn None<br \/>\nself.partition = 1<br \/>\nreturn os.path.join(&#8216;\/dev&#8217;, device)<br \/>\n&#8230;.<\/p>\n<p># then restart nova-compute<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/iaastalk.com\/index.php?rest_route=\/wp\/v2\/posts\/53"}],"collection":[{"href":"http:\/\/iaastalk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/iaastalk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/iaastalk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/iaastalk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=53"}],"version-history":[{"count":1,"href":"http:\/\/iaastalk.com\/index.php?rest_route=\/wp\/v2\/posts\/53\/revisions"}],"predecessor-version":[{"id":54,"href":"http:\/\/iaastalk.com\/index.php?rest_route=\/wp\/v2\/posts\/53\/revisions\/54"}],"wp:attachment":[{"href":"http:\/\/iaastalk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/iaastalk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/iaastalk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}