qemu_domain: Track if domain remembers original owner

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>
This commit is contained in:
Michal Privoznik 2018-11-13 12:50:41 +01:00
parent 592ed505e1
commit 7a44ffa6bd
4 changed files with 14 additions and 0 deletions

View File

@ -92,6 +92,7 @@ struct _virQEMUDriverConfig {
bool dynamicOwnership;
virBitmapPtr namespaces;
bool rememberOwner;
int cgroupControllers;
char **cgroupDeviceACL;

View 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;

View 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) \

View 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