[PATCH 35/55] qemu: driver: Prepare qemuDomainBlockResize for blockdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the nodename to resize the device rather than the drive alias.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f994eb1538..7541beb718 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10959,6 +10959,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);
@@ -11001,11 +11002,22 @@ qemuDomainBlockResize(virDomainPtr dom,
         disk->src->format == VIR_STORAGE_FILE_QED)
         size = VIR_ROUND_UP(size, 512);

-    if (!(device = qemuAliasDiskDriveFromDisk(disk)))
-        goto endjob;
+    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;
     }
-- 
2.16.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux