goto cleanup;
}
- if (qemuSecurityDomainSetPathLabel(driver->securityManager,
- vm->def, path, false) < 0)
+ if (qemuSecurityDomainSetPathLabel(driver, vm, path, false) < 0)
goto cleanup;
ret = 0;
virCgroupAddMachineTask(priv->cgroup, cpid) < 0)
goto cleanup;
- if (qemuSecurityDomainSetPathLabel(driver->securityManager,
- vm->def, socketPath, true) < 0)
+ if (qemuSecurityDomainSetPathLabel(driver, vm, socketPath, true) < 0)
goto cleanup;
priv->prDaemonRunning = true;
static int
qemuProcessBuildDestroyMemoryPathsImpl(virQEMUDriverPtr driver,
- virDomainDefPtr def,
+ virDomainObjPtr vm,
const char *path,
bool build)
{
return -1;
}
- if (qemuSecurityDomainSetPathLabel(driver->securityManager,
- def, path, true) < 0)
+ if (qemuSecurityDomainSetPathLabel(driver, vm, path, true) < 0)
return -1;
} else {
if (virFileDeleteTree(path) < 0)
if (!path)
goto cleanup;
- if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm->def,
+ if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm,
path, build) < 0)
goto cleanup;
if (qemuGetMemoryBackingDomainPath(vm->def, cfg, &path) < 0)
goto cleanup;
- if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm->def,
+ if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm,
path, build) < 0)
goto cleanup;
goto cleanup;
}
- if (qemuSecurityDomainSetPathLabel(driver->securityManager,
- vm->def, path, true) < 0)
+ if (qemuSecurityDomainSetPathLabel(driver, vm, path, true) < 0)
goto cleanup;
ret = 0;
{
virSecurityManagerRestoreTPMLabels(driver->securityManager, def);
}
+
+
+int
+qemuSecurityDomainSetPathLabel(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ const char *path,
+ bool allowSubtree)
+{
+ int ret = -1;
+
+ if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT) &&
+ virSecurityManagerTransactionStart(driver->securityManager) < 0)
+ goto cleanup;
+
+ if (virSecurityManagerDomainSetPathLabel(driver->securityManager,
+ vm->def,
+ path,
+ allowSubtree) < 0)
+ goto cleanup;
+
+ if (qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT) &&
+ virSecurityManagerTransactionCommit(driver->securityManager,
+ vm->pid) < 0)
+ goto cleanup;
+
+ ret = 0;
+ cleanup:
+ virSecurityManagerTransactionAbort(driver->securityManager);
+ return ret;
+}
void qemuSecurityCleanupTPMEmulator(virQEMUDriverPtr driver,
virDomainDefPtr def);
+int qemuSecurityDomainSetPathLabel(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ const char *path,
+ bool allowSubtree);
+
/* Please note that for these APIs there is no wrapper yet. Do NOT blindly add
* new APIs here. If an API can touch a /dev file add a proper wrapper instead.
*/
# define qemuSecurityCheckAllLabel virSecurityManagerCheckAllLabel
# define qemuSecurityClearSocketLabel virSecurityManagerClearSocketLabel
-# define qemuSecurityDomainSetPathLabel virSecurityManagerDomainSetPathLabel
# define qemuSecurityGenLabel virSecurityManagerGenLabel
# define qemuSecurityGetBaseLabel virSecurityManagerGetBaseLabel
# define qemuSecurityGetDOI virSecurityManagerGetDOI