Loading ccnode/libvirtwrapper.py +17 −5 Original line number Diff line number Diff line Loading @@ -567,29 +567,41 @@ class LibvirtVm(VM): raise VMError('deletion of VM `%s` failed' % self.get_name()) self._hv_handle._cache_vm_rebuild() def migrate(self, host, port): def migrate(self, libvirt_addr, hv_addr): ''' ''' # special case for xen if self.hypervisor().get_hv_type() == 'xen': flags = (libvirt.VIR_MIGRATE_LIVE ^ libvirt.VIR_MIGRATE_PERSIST_DEST ^ libvirt.VIR_MIGRATE_UNDEFINE_SOURCE) uri = 'xenmigr://%s:%d' % (host, port) lv_uri = 'xen+tcp://%s:%d' % libvirt_addr mig_uri = 'xenmigr://%s:%d' % hv_addr # kvm and others else: flags = (libvirt.VIR_MIGRATE_LIVE ^ libvirt.VIR_MIGRATE_PERSIST_DEST ^ libvirt.VIR_MIGRATE_UNDEFINE_SOURCE ^ libvirt.VIR_MIGRATE_PEER2PEER ^ libvirt.VIR_MIGRATE_TUNNELLED) uri = 'qemu+tcp://%s:%d/system' % (host, port) lv_uri = 'qemu+tcp://%s:%d/system' % libvirt_addr mig_uri = 'qemu+tcp://%s:%d/system' % hv_addr # establish the connection with remote libvirt rconn = libvirt.open(lv_uri) # migrate ! try: self._domain.migrate(self._hv_handle._lvcon_handle, flags, None, uri, 0) self._domain.migrate(rconn, flags, None, mig_uri, 0) except libvirt.libvirtError as err: # FIXME ignore bogus exception properly # maybe no more needed since real remote connection is provided if not ('no domain with matching name' in err.message or 'Domain not found' in err.message): raise err finally: # close the libvirt connection rconn.close() def power_on(self): ''' Loading Loading
ccnode/libvirtwrapper.py +17 −5 Original line number Diff line number Diff line Loading @@ -567,29 +567,41 @@ class LibvirtVm(VM): raise VMError('deletion of VM `%s` failed' % self.get_name()) self._hv_handle._cache_vm_rebuild() def migrate(self, host, port): def migrate(self, libvirt_addr, hv_addr): ''' ''' # special case for xen if self.hypervisor().get_hv_type() == 'xen': flags = (libvirt.VIR_MIGRATE_LIVE ^ libvirt.VIR_MIGRATE_PERSIST_DEST ^ libvirt.VIR_MIGRATE_UNDEFINE_SOURCE) uri = 'xenmigr://%s:%d' % (host, port) lv_uri = 'xen+tcp://%s:%d' % libvirt_addr mig_uri = 'xenmigr://%s:%d' % hv_addr # kvm and others else: flags = (libvirt.VIR_MIGRATE_LIVE ^ libvirt.VIR_MIGRATE_PERSIST_DEST ^ libvirt.VIR_MIGRATE_UNDEFINE_SOURCE ^ libvirt.VIR_MIGRATE_PEER2PEER ^ libvirt.VIR_MIGRATE_TUNNELLED) uri = 'qemu+tcp://%s:%d/system' % (host, port) lv_uri = 'qemu+tcp://%s:%d/system' % libvirt_addr mig_uri = 'qemu+tcp://%s:%d/system' % hv_addr # establish the connection with remote libvirt rconn = libvirt.open(lv_uri) # migrate ! try: self._domain.migrate(self._hv_handle._lvcon_handle, flags, None, uri, 0) self._domain.migrate(rconn, flags, None, mig_uri, 0) except libvirt.libvirtError as err: # FIXME ignore bogus exception properly # maybe no more needed since real remote connection is provided if not ('no domain with matching name' in err.message or 'Domain not found' in err.message): raise err finally: # close the libvirt connection rconn.close() def power_on(self): ''' Loading