[PATCH 08/11] qemu: domain: Inline qemuDomainStorageSourceHasAuth

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

 



The iSCSI hostdev code doesn't require the check for the empty drive
and the check for the protocol because those are already guaranteed at
that point.

In qemuDomainSecretStorageSourcePrepare we don't need to check the
network disk type either as it's now guaranteed by the definition
validator.

Thus both callers can simply check whether src->auth is present and the
helper can be removed.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 19 +++----------------
 src/qemu/qemu_domain.h |  3 ---
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1eb15c8989..7974cdb00b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1231,18 +1231,6 @@ qemuDomainSecretDiskDestroy(virDomainDiskDef *disk)
 }


-bool
-qemuDomainStorageSourceHasAuth(virStorageSource *src)
-{
-    if (!virStorageSourceIsEmpty(src) &&
-        virStorageSourceGetActualType(src) == VIR_STORAGE_TYPE_NETWORK &&
-        src->auth)
-        return true;
-
-    return false;
-}
-
-
 static qemuDomainSecretInfo *
 qemuDomainSecretStorageSourcePrepareCookies(qemuDomainObjPrivate *priv,
                                             virStorageSource *src,
@@ -1277,13 +1265,12 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivate *priv,
                                      const char *aliasformat)
 {
     qemuDomainStorageSourcePrivate *srcPriv;
-    bool hasAuth = qemuDomainStorageSourceHasAuth(src);
     bool hasEnc = src->encryption && src->encryption->nsecrets > 0;

     if (virStorageSourceIsEmpty(src))
         return 0;

-    if (!hasAuth && !hasEnc && src->ncookies == 0)
+    if (!src->auth && !hasEnc && src->ncookies == 0)
         return 0;

     if (!(src->privateData = qemuDomainStorageSourcePrivateNew()))
@@ -1291,7 +1278,7 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivate *priv,

     srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);

-    if (hasAuth) {
+    if (src->auth) {
         virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;

         if (src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)
@@ -5663,7 +5650,7 @@ qemuDomainDeviceHostdevDefPostParseRestoreSecAlias(virDomainHostdevDef *hostdev,
     if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
         hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI ||
         scsisrc->protocol != VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI ||
-        !qemuDomainStorageSourceHasAuth(iscsisrc->src))
+        !iscsisrc->src->auth)
         return 0;

     if (!(priv = qemuDomainStorageSourcePrivateFetch(iscsisrc->src)))
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 0415a34908..c7125722e0 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -870,9 +870,6 @@ void qemuDomainSecretInfoDestroy(qemuDomainSecretInfo *secinfo);
 void qemuDomainSecretDiskDestroy(virDomainDiskDef *disk)
     ATTRIBUTE_NONNULL(1);

-bool qemuDomainStorageSourceHasAuth(virStorageSource *src)
-    ATTRIBUTE_NONNULL(1);
-
 qemuDomainSecretInfo *
 qemuDomainSecretInfoTLSNew(qemuDomainObjPrivate *priv,
                            const char *srcAlias,
-- 
2.35.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