Re: [PATCH 14/18] qemuBuildHostdevSCSICommandLine: Use new infrastructure

2020-07-15 Thread Ján Tomko

On a Friday in 2020, Peter Krempa wrote:

In preparation for instantiating (i)SCSI hostdevs via -blockdev,
refactor qemuBuildHostdevSCSICommandLine to use the new infrastructure
which will do it automatically.

Signed-off-by: Peter Krempa 
---
src/qemu/qemu_command.c | 44 -
1 file changed, 4 insertions(+), 40 deletions(-)



Reviewed-by: Ján Tomko 

Jano


signature.asc
Description: PGP signature


[PATCH 14/18] qemuBuildHostdevSCSICommandLine: Use new infrastructure

2020-07-10 Thread Peter Krempa
In preparation for instantiating (i)SCSI hostdevs via -blockdev,
refactor qemuBuildHostdevSCSICommandLine to use the new infrastructure
which will do it automatically.

Signed-off-by: Peter Krempa 
---
 src/qemu/qemu_command.c | 44 -
 1 file changed, 4 insertions(+), 40 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6b3b1b39ca..7f624a031e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -695,27 +695,6 @@ qemuBuildObjectSecretCommandLine(virCommandPtr cmd,
 }


-/* qemuBuildDiskSecinfoCommandLine:
- * @cmd: Pointer to the command string
- * @secinfo: Pointer to a possible secinfo
- *
- * Add the secret object for the disks that will be using it to perform
- * their authentication.
- *
- * Returns 0 on success, -1 w/ error on some sort of failure.
- */
-static int
-qemuBuildDiskSecinfoCommandLine(virCommandPtr cmd,
-qemuDomainSecretInfoPtr secinfo)
-{
-/* Not necessary for non AES secrets */
-if (!secinfo || secinfo->type != VIR_DOMAIN_SECRET_INFO_TYPE_AES)
-return 0;
-
-return qemuBuildObjectSecretCommandLine(cmd, secinfo);
-}
-
-
 /* qemuBuildGeneralSecinfoURI:
  * @uri: Pointer to the URI structure to add to
  * @secinfo: Pointer to the secret info data (if present)
@@ -5151,29 +5130,14 @@ qemuBuildHostdevSCSICommandLine(virCommandPtr cmd,
 virDomainHostdevDefPtr hostdev,
 virQEMUCapsPtr qemuCaps)
 {
-virDomainHostdevSubsysSCSIPtr scsisrc = >source.subsys.u.scsi;
+g_autoptr(qemuBlockStorageSourceAttachData) data = NULL;
 g_autofree char *devstr = NULL;
-g_autofree char *drvstr = NULL;
-g_autofree char *backendAlias = NULL;
+const char *backendAlias = NULL;

-if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
-virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =
->u.iscsi;
-qemuDomainStorageSourcePrivatePtr srcPriv =
-QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(iscsisrc->src);
-
-if (qemuBuildDiskSecinfoCommandLine(cmd, srcPriv ?
-srcPriv->secinfo :
-NULL) < 0)
-return -1;
-}
-
-virCommandAddArg(cmd, "-drive");
-if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, qemuCaps)))
+if (!(data = qemuBuildHostdevSCSIAttachPrepare(hostdev, , 
qemuCaps)))
 return -1;
-virCommandAddArg(cmd, drvstr);

-if (!(backendAlias = qemuAliasFromHostdev(hostdev)))
+if (qemuBuildBlockStorageSourceAttachDataCommandline(cmd, data) < 0)
 return -1;

 virCommandAddArg(cmd, "-device");
-- 
2.26.2