Skip to content

Commit 98063a7

Browse files
author
zstackio
committed
Merge branch 'fix-stop-mirr-err' into '5.1.0'
<fix>[imagestore]: skip block operation for vhost See merge request zstackio/zstack-utility!4680
2 parents a04828a + 30f4575 commit 98063a7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

kvmagent/kvmagent/plugins/imagestore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def stop_mirror(self, vm, complete, node, force=False):
100100
with linux.ShowLibvirtErrorOnException(vm):
101101
cmdstr = '%s stopmirr -force=%s -domain %s -delbitmap=%s -drive "%s"' % \
102102
(self.ZSTORE_CLI_PATH, force, vm, complete, node)
103-
shell.check_run(cmdstr)
103+
shell.call(cmdstr)
104104

105105
def query_mirror_volumes(self, vm):
106106
with linux.ShowLibvirtErrorOnException(vm):

kvmagent/kvmagent/plugins/vm_plugin.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6312,6 +6312,9 @@ def _stop_world():
63126312
def block_volume_over_incorrect_driver(volume):
63136313
return volume.deviceType == "file" and volume.installPath.startswith("/dev/")
63146314

6315+
def volume_support_block_node(volume):
6316+
return volume.deviceType != "vhost"
6317+
63156318
def file_volume_check(volume):
63166319
# `file` support has been removed with block/char devices since qemu-6.0.0
63176320
# https://github.com/qemu/qemu/commit/8d17adf34f501ded65a106572740760f0a75577c
@@ -7590,9 +7593,10 @@ def detach_data_volume(self, req):
75907593
return jsonobject.dumps(rsp)
75917594
raise kvmagent.KvmError('unable to find data volume[%s] on vm[uuid:%s]' % (volume.installPath, vm.uuid))
75927595

7593-
node_name = self.get_disk_device_name(target_disk)
7594-
isc = ImageStoreClient()
7595-
isc.stop_mirror(cmd.vmInstanceUuid, True, node_name)
7596+
if volume_support_block_node(volume):
7597+
node_name = self.get_disk_device_name(target_disk)
7598+
isc = ImageStoreClient()
7599+
isc.stop_mirror(cmd.vmInstanceUuid, True, node_name)
75967600

75977601
vm.detach_data_volume(volume)
75987602
except kvmagent.KvmError as e:

0 commit comments

Comments
 (0)