[PATCH v3 02/10] qemu: Drop virQEMUDriverIsPrivileged()

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

 



Introduced in v1.2.17-rc1~121, the assumption was that the
driver->privileged is immutable at the time but it might change
in the future. Well, it did not ever since. It is still immutable
variable. Drop the needless accessor then.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_cgroup.c    |  4 ++--
 src/qemu/qemu_command.c   |  4 ++--
 src/qemu/qemu_conf.c      |  6 ------
 src/qemu/qemu_conf.h      |  1 -
 src/qemu/qemu_domain.c    | 12 ++++++------
 src/qemu/qemu_driver.c    | 22 +++++++++++-----------
 src/qemu/qemu_interface.c |  6 +++---
 7 files changed, 24 insertions(+), 31 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index c0e30f6152..f1564141b6 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -926,7 +926,7 @@ qemuInitCgroup(virDomainObjPtr vm,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(priv->driver);
 
-    if (!virQEMUDriverIsPrivileged(priv->driver))
+    if (!priv->driver->privileged)
         goto done;
 
     if (!virCgroupAvailable())
@@ -1061,7 +1061,7 @@ qemuConnectCgroup(virDomainObjPtr vm)
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(priv->driver);
     int ret = -1;
 
-    if (!virQEMUDriverIsPrivileged(priv->driver))
+    if (!priv->driver->privileged)
         goto done;
 
     if (!virCgroupAvailable())
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d1b689dfd3..9a0a96bdea 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8102,7 +8102,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
         /* network and bridge use a tap device, and direct uses a
          * macvtap device
          */
-        if (virQEMUDriverIsPrivileged(driver) && nicindexes && nnicindexes &&
+        if (driver->privileged && nicindexes && nnicindexes &&
             net->ifname) {
             if (virNetDevGetIndex(net->ifname, &nicindex) < 0 ||
                 VIR_APPEND_ELEMENT(*nicindexes, *nnicindexes, nicindex) < 0)
@@ -9642,7 +9642,7 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
     int spice = 0;
     int egl_headless = 0;
 
-    if (!virQEMUDriverIsPrivileged(driver)) {
+    if (!driver->privileged) {
         /* If we have no cgroups then we can have no tunings that
          * require them */
 
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 15837cece4..5ac316ec77 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1224,12 +1224,6 @@ virQEMUDriverConfigPtr virQEMUDriverGetConfig(virQEMUDriverPtr driver)
     return conf;
 }
 
-bool
-virQEMUDriverIsPrivileged(virQEMUDriverPtr driver)
-{
-    return driver->privileged;
-}
-
 virDomainXMLOptionPtr
 virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver,
                            const char *defsecmodel)
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 14f9b9e81e..10bc7e4a52 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -333,7 +333,6 @@ int
 virQEMUDriverConfigSetDefaults(virQEMUDriverConfigPtr cfg);
 
 virQEMUDriverConfigPtr virQEMUDriverGetConfig(virQEMUDriverPtr driver);
-bool virQEMUDriverIsPrivileged(virQEMUDriverPtr driver);
 
 virCapsHostNUMAPtr virQEMUDriverGetHostNUMACaps(virQEMUDriverPtr driver);
 virCPUDefPtr virQEMUDriverGetHostCPU(virQEMUDriverPtr driver);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index dd48b6fff3..e54eeae58f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8600,7 +8600,7 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs,
         return -1;
 
     case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS:
-        if (!virQEMUDriverIsPrivileged(driver)) {
+        if (!driver->privileged) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("virtiofs is not yet supported in session mode"));
             return -1;
@@ -10718,7 +10718,7 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
     qemuDomainObjPrivatePtr priv = obj->privateData;
     bool custom_hypervisor_feat = false;
 
-    if (virQEMUDriverIsPrivileged(driver) &&
+    if (driver->privileged &&
         (cfg->user == 0 ||
          cfg->group == 0))
         qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HIGH_PRIVILEGES, logCtxt);
@@ -10817,7 +10817,7 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
     ctxt->path = g_strdup_printf("%s/%s.log", cfg->logDir, vm->def->name);
 
     if (cfg->stdioLogD) {
-        ctxt->manager = virLogManagerNew(virQEMUDriverIsPrivileged(driver));
+        ctxt->manager = virLogManagerNew(driver->privileged);
         if (!ctxt->manager)
             goto error;
 
@@ -10847,7 +10847,7 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver,
          * we can't rely on logrotate. We don't use O_TRUNC since
          * it is better for SELinux policy if we truncate afterwards */
         if (mode == QEMU_DOMAIN_LOG_CONTEXT_MODE_START &&
-            !virQEMUDriverIsPrivileged(driver) &&
+            !driver->privileged &&
             ftruncate(ctxt->writefd, 0) < 0) {
             virReportSystemError(errno, _("failed to truncate %s"),
                                  ctxt->path);
@@ -10991,7 +10991,7 @@ qemuDomainLogAppendMessage(virQEMUDriverPtr driver,
     path = g_strdup_printf("%s/%s.log", cfg->logDir, vm->def->name);
 
     if (cfg->stdioLogD) {
-        if (!(manager = virLogManagerNew(virQEMUDriverIsPrivileged(driver))))
+        if (!(manager = virLogManagerNew(driver->privileged)))
             goto cleanup;
 
         if (virLogManagerDomainAppendMessage(manager, "qemu", vm->def->uuid,
@@ -16546,7 +16546,7 @@ qemuDomainGetMachineName(virDomainObjPtr vm)
     if (!ret)
         ret = virDomainGenerateMachineName("qemu", cfg->root,
                                            vm->def->id, vm->def->name,
-                                           virQEMUDriverIsPrivileged(driver));
+                                           driver->privileged);
 
     return ret;
 }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 78024614cf..49dcd0e82d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -307,7 +307,7 @@ qemuSecurityInit(virQEMUDriverPtr driver)
         flags |= VIR_SECURITY_MANAGER_DEFAULT_CONFINED;
     if (cfg->securityRequireConfined)
         flags |= VIR_SECURITY_MANAGER_REQUIRE_CONFINED;
-    if (virQEMUDriverIsPrivileged(driver))
+    if (driver->privileged)
         flags |= VIR_SECURITY_MANAGER_PRIVILEGED;
 
     if (cfg->securityDriverNames &&
@@ -338,7 +338,7 @@ qemuSecurityInit(virQEMUDriverPtr driver)
         mgr = NULL;
     }
 
-    if (virQEMUDriverIsPrivileged(driver)) {
+    if (driver->privileged) {
         if (cfg->dynamicOwnership)
             flags |= VIR_SECURITY_MANAGER_DYNAMIC_OWNERSHIP;
         if (virBitmapIsBitSet(cfg->namespaces, QEMU_DOMAIN_NS_MOUNT))
@@ -1204,7 +1204,7 @@ static virDrvOpenStatus qemuConnectOpen(virConnectPtr conn,
     } else {
         if (!virConnectValidateURIPath(conn->uri->path,
                                        "qemu",
-                                       virQEMUDriverIsPrivileged(qemu_driver)))
+                                       qemu_driver->privileged))
             return VIR_DRV_OPEN_ERROR;
     }
 
@@ -9279,7 +9279,7 @@ static char *qemuDomainGetSchedulerType(virDomainPtr dom,
     if (virDomainGetSchedulerTypeEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
-    if (!virQEMUDriverIsPrivileged(driver)) {
+    if (!driver->privileged) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("CPU tuning is not available in session mode"));
         goto cleanup;
@@ -9355,7 +9355,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
     if (virDomainSetBlkioParametersEnsureACL(dom->conn, vm->def, flags) < 0)
         goto cleanup;
 
-    if (!virQEMUDriverIsPrivileged(driver)) {
+    if (!driver->privileged) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Block I/O tuning is not available in session mode"));
         goto cleanup;
@@ -9435,7 +9435,7 @@ qemuDomainGetBlkioParameters(virDomainPtr dom,
     if (virDomainGetBlkioParametersEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
-    if (!virQEMUDriverIsPrivileged(driver)) {
+    if (!driver->privileged) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Block I/O tuning is not available in session mode"));
         goto cleanup;
@@ -9531,7 +9531,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
     if (virDomainSetMemoryParametersEnsureACL(dom->conn, vm->def, flags) < 0)
         goto cleanup;
 
-    if (!virQEMUDriverIsPrivileged(driver)) {
+    if (!driver->privileged) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("Memory tuning is not available in session mode"));
         goto cleanup;
@@ -9607,7 +9607,7 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,
     if (virDomainGetMemoryParametersEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
-    if (!virQEMUDriverIsPrivileged(driver)) {
+    if (!driver->privileged) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                        _("Memory tuning is not available in session mode"));
         goto cleanup;
@@ -9794,7 +9794,7 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
         goto endjob;
 
     if (def) {
-        if (!virQEMUDriverIsPrivileged(driver)) {
+        if (!driver->privileged) {
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("NUMA tuning is not available in session mode"));
             goto endjob;
@@ -10268,7 +10268,7 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
     if (virDomainSetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
         goto cleanup;
 
-    if (!virQEMUDriverIsPrivileged(driver)) {
+    if (!driver->privileged) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("CPU tuning is not available in session mode"));
         goto cleanup;
@@ -10675,7 +10675,7 @@ qemuDomainGetSchedulerParametersFlags(virDomainPtr dom,
     if (virDomainGetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
-    if (!virQEMUDriverIsPrivileged(driver)) {
+    if (!driver->privileged) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("CPU tuning is not available in session mode"));
         goto cleanup;
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index 2b24c73d65..ffec992596 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -410,7 +410,7 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
 
     if (net->backend.tap) {
         tunpath = net->backend.tap;
-        if (!virQEMUDriverIsPrivileged(driver)) {
+        if (!driver->privileged) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("cannot use custom tap device in session mode"));
             goto cleanup;
@@ -538,7 +538,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
 
     if (net->backend.tap) {
         tunpath = net->backend.tap;
-        if (!(virQEMUDriverIsPrivileged(driver))) {
+        if (!driver->privileged) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("cannot use custom tap device in session mode"));
             goto cleanup;
@@ -562,7 +562,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
     if (virDomainNetIsVirtioModel(net))
         tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
 
-    if (virQEMUDriverIsPrivileged(driver)) {
+    if (driver->privileged) {
         if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
                                            def->uuid, tunpath, tapfd, *tapfdSize,
                                            virDomainNetGetActualVirtPortProfile(net),
-- 
2.24.1





[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