[libvirt] [PATCH v4 04/15] qemu_domain: Track if domain remembers original owner

Michal Privoznik mprivozn at redhat.com
Wed Nov 14 12:44:32 UTC 2018


For metadata locking we might need an extra fork() which given
latest attempts to do fewer fork()-s is suboptimal. Therefore,
there will be a qemu.conf knob to enable or this feature. But
since the feature is actually not metadata locking itself rather
than remembering of the original owner of the file this is named
as 'rememberOwner'. But patches for that feature are not even
posted yet so there is actually no qemu.conf entry in this patch
nor a way to enable this feature.

Even though this is effectively a dead code for now it is still
desired.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_conf.h    | 1 +
 src/qemu/qemu_domain.c  | 7 +++++++
 src/qemu/qemu_domain.h  | 3 +++
 src/qemu/qemu_process.c | 3 +++
 4 files changed, 14 insertions(+)

diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index f876f9117c..0b5b5a314f 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -92,6 +92,7 @@ struct _virQEMUDriverConfig {
     bool dynamicOwnership;
 
     virBitmapPtr namespaces;
+    bool rememberOwner;
 
     int cgroupControllers;
     char **cgroupDeviceACL;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 37926850b2..558c97ad36 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1963,6 +1963,8 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv)
     virBitmapFree(priv->namespaces);
     priv->namespaces = NULL;
 
+    priv->rememberOwner = false;
+
     priv->reconnectBlockjobs = VIR_TRISTATE_BOOL_ABSENT;
     priv->allowReboot = VIR_TRISTATE_BOOL_ABSENT;
 
@@ -2480,6 +2482,9 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf,
     if (priv->chardevStdioLogd)
         virBufferAddLit(buf, "<chardevStdioLogd/>\n");
 
+    if (priv->rememberOwner)
+        virBufferAddLit(buf, "<rememberOwner/>\n");
+
     qemuDomainObjPrivateXMLFormatAllowReboot(buf, priv->allowReboot);
 
     qemuDomainObjPrivateXMLFormatPR(buf, priv);
@@ -2891,6 +2896,8 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
         priv->namespaces = NULL;
     }
 
+    priv->rememberOwner = virXPathBoolean("count(./rememberOwner) > 0", ctxt);
+
     if ((n = virXPathNodeSet("./vcpus/vcpu", ctxt, &nodes)) < 0)
         goto error;
 
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 87de433b22..53b5ea1678 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -369,6 +369,9 @@ struct _qemuDomainObjPrivate {
     /* qemuProcessStartCPUs stores the reason for starting vCPUs here for the
      * RESUME event handler to use it */
     virDomainRunningReason runningReason;
+
+    /* true if libvirt remembers the original owner for files */
+    bool rememberOwner;
 };
 
 # define QEMU_DOMAIN_PRIVATE(vm) \
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2c9e605047..44bf55bfb2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5916,6 +5916,9 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
         priv->chardevStdioLogd = true;
     }
 
+    /* Track if this domain remembers original owner */
+    priv->rememberOwner = cfg->rememberOwner;
+
     qemuProcessPrepareAllowReboot(vm);
 
     /* clear the 'blockdev' capability for VMs which have disks that need
-- 
2.18.1




More information about the libvir-list mailing list