提交 b655c4fc 编写于 作者: P Peter Krempa

qemu: driver: Prepare qemuDomainBlockResize for blockdev

Use the nodename to resize the device rather than the drive alias.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 96beae7b
......@@ -10943,6 +10943,7 @@ qemuDomainBlockResize(virDomainPtr dom,
qemuDomainObjPrivatePtr priv;
int ret = -1;
char *device = NULL;
const char *nodename = NULL;
virDomainDiskDefPtr disk = NULL;
virCheckFlags(VIR_DOMAIN_BLOCK_RESIZE_BYTES, -1);
......@@ -10985,11 +10986,22 @@ qemuDomainBlockResize(virDomainPtr dom,
disk->src->format == VIR_STORAGE_FILE_QED)
size = VIR_ROUND_UP(size, 512);
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) {
if (virStorageSourceIsEmpty(disk->src) || disk->src->readonly) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("can't resize empty or readonly disk '%s'"),
disk->dst);
goto endjob;
}
nodename = disk->src->nodeformat;
} else {
if (!(device = qemuAliasDiskDriveFromDisk(disk)))
goto endjob;
}
qemuDomainObjEnterMonitor(driver, vm);
if (qemuMonitorBlockResize(priv->mon, device, NULL, size) < 0) {
if (qemuMonitorBlockResize(priv->mon, device, nodename, size) < 0) {
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto endjob;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册