Destination Host of VM during migration now notify Source host of exact socket path

This commit is contained in:
ahmadbilalkhalid 2019-12-29 23:48:04 +05:00
commit 29e938dc74
4 changed files with 17 additions and 8 deletions

View file

@ -76,7 +76,8 @@ def main(hostname):
elif request_event.type == RequestType.TransferVM:
host = host_pool.get(request_event.destination_host_key)
if host:
vm.migrate(destination=host.hostname)
vm.migrate(destination_host=host.hostname,
destination_sock_path=request_event.destination_sock_path)
else:
logger.error('Host %s not found!', request_event.destination_host_key)
else:

View file

@ -78,6 +78,7 @@ class VM:
type=RequestType.TransferVM, # Transfer VM
hostname=self.host_key, # Which VM should get this request. It is source host
uuid=self.uuid, # uuid of VM
destination_sock_path=join_path(self.vmm.socket_dir, self.uuid),
destination_host_key=destination_host_key, # Where source host transfer VM
request_prefix=settings['etcd']['request_prefix']
)
@ -94,8 +95,9 @@ class VM:
declare_stopped(self.vm)
self.sync()
def migrate(self, destination):
self.vmm.transfer(src_uuid=self.uuid, dest_uuid=self.uuid, host=destination)
def migrate(self, destination_host, destination_sock_path):
self.vmm.transfer(src_uuid=self.uuid, destination_sock_path=destination_sock_path,
host=destination_host)
def create_network_dev(self):
command = ''