Skip to content

Commit 30f4575

Browse files
committed
<fix>[imagestore]: skip block operation for vhost
vhost volume do not support block node, block operation will fail. Resolves: ZSTAC-65130 Change-Id: I78736c6a64687775756a64787163686a75726d66
1 parent 8c8f619 commit 30f4575

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
@@ -6309,6 +6309,9 @@ def _stop_world():
63096309
def block_volume_over_incorrect_driver(volume):
63106310
return volume.deviceType == "file" and volume.installPath.startswith("/dev/")
63116311

6312+
def volume_support_block_node(volume):
6313+
return volume.deviceType != "vhost"
6314+
63126315
def file_volume_check(volume):
63136316
# `file` support has been removed with block/char devices since qemu-6.0.0
63146317
# https://github.com/qemu/qemu/commit/8d17adf34f501ded65a106572740760f0a75577c
@@ -7587,9 +7590,10 @@ def detach_data_volume(self, req):
75877590
return jsonobject.dumps(rsp)
75887591
raise kvmagent.KvmError('unable to find data volume[%s] on vm[uuid:%s]' % (volume.installPath, vm.uuid))
75897592

7590-
node_name = self.get_disk_device_name(target_disk)
7591-
isc = ImageStoreClient()
7592-
isc.stop_mirror(cmd.vmInstanceUuid, True, node_name)
7593+
if volume_support_block_node(volume):
7594+
node_name = self.get_disk_device_name(target_disk)
7595+
isc = ImageStoreClient()
7596+
isc.stop_mirror(cmd.vmInstanceUuid, True, node_name)
75937597

75947598
vm.detach_data_volume(volume)
75957599
except kvmagent.KvmError as e:

0 commit comments

Comments
 (0)