From 04ad8b1897f3bce0f5bcebd84182d047e71ce0c8 Mon Sep 17 00:00:00 2001 From: "adm.inst" Date: Tue, 20 Apr 2021 13:41:07 +0200 Subject: [PATCH 1/3] Update vms.py --- model/vms.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/model/vms.py b/model/vms.py index 33f7aca0e..b23b2f6bb 100644 --- a/model/vms.py +++ b/model/vms.py @@ -1997,13 +1997,6 @@ def _check_remote_libvirt_conn(self, remote_host, user='root', transport='ssh'): cmd, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid ) timeout = 0 - while proc.poll() is None: - time.sleep(1) - timeout += 1 - if timeout == 5: - os.killpg(os.getpgid(proc.pid), signal.SIGTERM) - raise OperationFailed( - 'KCHVM0090E', {'host': remote_host, 'user': user}) def _get_remote_libvirt_conn(self, remote_host, user='root', transport='ssh'): dest_uri = f'qemu+{transport}://{user}@{remote_host}/system' @@ -2097,8 +2090,8 @@ def _create_vm_remote_paths(self, vm_name, remote_host, user): self._create_remote_disk(dev_info, remote_host, user) def migrate(self, name, remote_host, user=None, password=None, enable_rdma=None): - name = name.decode('utf-8') - remote_host = remote_host.decode('utf-8') + #name = name.decode('utf-8') + #remote_host = remote_host.decode('utf-8') if user is None: user = 'root' @@ -2127,7 +2120,7 @@ def migrate(self, name, remote_host, user=None, password=None, enable_rdma=None) return self.task.lookup(task_id) def _migrate_task(self, cb, params): - name = params['name'].decode('utf-8') + name = params['name'] dest_conn = params['dest_conn'] non_shared = params['non_shared'] remote_host = params['remote_host'] @@ -2149,7 +2142,7 @@ def _migrate_task(self, cb, params): else: dest_conn.close() raise OperationFailed('KCHVM0057E', {'name': name, 'state': state}) - if non_shared: + if True: flags |= libvirt.VIR_MIGRATE_NON_SHARED_DISK self._create_vm_remote_paths(name, remote_host, user) From 6ec7ae908851d6d048bfc42f9bedcd5d4e9c25c6 Mon Sep 17 00:00:00 2001 From: "adm.inst" Date: Tue, 20 Apr 2021 13:41:45 +0200 Subject: [PATCH 2/3] Update vms.py --- model/vms.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/model/vms.py b/model/vms.py index b23b2f6bb..c8cad8801 100644 --- a/model/vms.py +++ b/model/vms.py @@ -2090,9 +2090,6 @@ def _create_vm_remote_paths(self, vm_name, remote_host, user): self._create_remote_disk(dev_info, remote_host, user) def migrate(self, name, remote_host, user=None, password=None, enable_rdma=None): - #name = name.decode('utf-8') - #remote_host = remote_host.decode('utf-8') - if user is None: user = 'root' @@ -2142,7 +2139,7 @@ def _migrate_task(self, cb, params): else: dest_conn.close() raise OperationFailed('KCHVM0057E', {'name': name, 'state': state}) - if True: + if non_shared: flags |= libvirt.VIR_MIGRATE_NON_SHARED_DISK self._create_vm_remote_paths(name, remote_host, user) From 76c606cd579c9334e86c839057a1aef1ec03f736 Mon Sep 17 00:00:00 2001 From: "adm.inst" Date: Tue, 20 Apr 2021 13:42:29 +0200 Subject: [PATCH 3/3] Update vms.py --- model/vms.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/model/vms.py b/model/vms.py index c8cad8801..6b8747521 100644 --- a/model/vms.py +++ b/model/vms.py @@ -1997,6 +1997,13 @@ def _check_remote_libvirt_conn(self, remote_host, user='root', transport='ssh'): cmd, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid ) timeout = 0 + while proc.poll() is None: + time.sleep(1) + timeout += 1 + if timeout == 5: + os.killpg(os.getpgid(proc.pid), signal.SIGTERM) + raise OperationFailed( + 'KCHVM0090E', {'host': remote_host, 'user': user}) def _get_remote_libvirt_conn(self, remote_host, user='root', transport='ssh'): dest_uri = f'qemu+{transport}://{user}@{remote_host}/system'