[PATCH 2/5] qemuBlockStorageSourceCreateFormat: Force write access when formatting images

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

 



We need qemu to be able to write the newly created images so that it can
format them to the specified storage format.

Force write access by relabelling the images when formatting.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_block.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index d32277d7fd..6f9c7071c9 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -2671,6 +2671,12 @@ qemuBlockStorageSourceCreate(virDomainObjPtr vm,
         return -1;
     }

+    /* grant write access to read-only images during formatting */
+    if (src->readonly &&
+        qemuDomainStorageSourceAccessAllow(priv->driver, vm, src, false,
+                                           false, true) < 0)
+        return -1;
+
     if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
         goto cleanup;

@@ -2697,6 +2703,12 @@ qemuBlockStorageSourceCreate(virDomainObjPtr vm,
                                            asyncJob) < 0)
         goto cleanup;

+    /* revoke write access to read-only images during formatting */
+    if (src->readonly &&
+        qemuDomainStorageSourceAccessAllow(priv->driver, vm, src, true,
+                                           false, true) < 0)
+        goto cleanup;
+
     if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
         goto cleanup;

-- 
2.26.2




[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