]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_domain: Track if domain remembers original owner
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 13 Nov 2018 11:50:41 +0000 (12:50 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 16 Nov 2018 12:42:38 +0000 (13:42 +0100)
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 {en|dis}able 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@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_conf.h
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_process.c

index f876f9117c3022feddb7b379f89dc61285a4c241..0b5b5a314f24d776592e7588e85821ca7d9186e4 100644 (file)
@@ -92,6 +92,7 @@ struct _virQEMUDriverConfig {
     bool dynamicOwnership;
 
     virBitmapPtr namespaces;
+    bool rememberOwner;
 
     int cgroupControllers;
     char **cgroupDeviceACL;
index 1beb5969c191bcb7db62a625c005223624e91c86..2f65bbe34e2e11de4bfc571a0c72266b36bd0c92 100644 (file)
@@ -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;
 
index 87de433b223dc0b5101e31b1b395c09c525eace8..53b5ea167895022de3e904cfd1df55c5a9198a2c 100644 (file)
@@ -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) \
index 36164a318374cc5bc33c953f3fbdcd35691c8d31..031383b987d62625a3fa1726b64e72620b741829 100644 (file)
@@ -5898,6 +5898,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