Essentially revert commit 3a6204c which added these to allow the test
suite to pass without depending on the host system state.
Since commit 4b527c1 we already mock virSCSIDeviceGetSgName, so these
callbacks are useless.
---
src/qemu/qemu_command.c | 35 +++++++++++------------------------
src/qemu/qemu_command.h | 18 ++----------------
src/qemu/qemu_hotplug.c | 3 +--
src/qemu/qemu_process.c | 3 +--
tests/testutilsqemu.c | 19 -------------------
tests/testutilsqemu.h | 1 -
6 files changed, 15 insertions(+), 64 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index bd82682..06b96f9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4417,20 +4417,16 @@ qemuBuildUSBHostdevUSBDevStr(virDomainHostdevDefPtr dev)
}
static char *
-qemuBuildSCSIHostHostdevDrvStr(virDomainHostdevDefPtr dev,
- virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
- qemuBuildCommandLineCallbacksPtr callbacks)
+qemuBuildSCSIHostHostdevDrvStr(virDomainHostdevDefPtr dev)
{
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
- char *sg = NULL;
-
- sg = (callbacks->qemuGetSCSIDeviceSgName)(NULL,
- scsihostsrc->adapter,
- scsihostsrc->bus,
- scsihostsrc->target,
- scsihostsrc->unit);
- return sg;
+
+ return virSCSIDeviceGetSgName(NULL,
+ scsihostsrc->adapter,
+ scsihostsrc->bus,
+ scsihostsrc->target,
+ scsihostsrc->unit);
}
static char *
@@ -4475,8 +4471,7 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virConnectPtr conn,
char *
qemuBuildSCSIHostdevDrvStr(virConnectPtr conn,
virDomainHostdevDefPtr dev,
- virQEMUCapsPtr qemuCaps,
- qemuBuildCommandLineCallbacksPtr callbacks)
+ virQEMUCapsPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *source = NULL;
@@ -4487,8 +4482,7 @@ qemuBuildSCSIHostdevDrvStr(virConnectPtr conn,
goto error;
virBufferAsprintf(&buf, "file=%s,if=none,format=raw", source);
} else {
- if (!(source = qemuBuildSCSIHostHostdevDrvStr(dev, qemuCaps,
- callbacks)))
+ if (!(source = qemuBuildSCSIHostHostdevDrvStr(dev)))
goto error;
virBufferAsprintf(&buf, "file=/dev/%s,if=none", source);
}
@@ -4785,7 +4779,6 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
virConnectPtr conn,
const virDomainDef *def,
virQEMUCapsPtr qemuCaps,
- qemuBuildCommandLineCallbacksPtr callbacks,
unsigned int *bootHostdevNet)
{
size_t i;
@@ -4933,7 +4926,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
virCommandAddArg(cmd, "-drive");
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(conn, hostdev,
- qemuCaps, callbacks)))
+ qemuCaps)))
return -1;
virCommandAddArg(cmd, drvstr);
VIR_FREE(drvstr);
@@ -9163,10 +9156,6 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
}
-qemuBuildCommandLineCallbacks buildCommandLineCallbacks = {
- .qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName,
-};
-
/*
* Constructs a argv suitable for launching qemu with config defined
* for a given virtual machine.
@@ -9185,7 +9174,6 @@ qemuBuildCommandLine(virConnectPtr conn,
const char *migrateURI,
virDomainSnapshotObjPtr snapshot,
virNetDevVPortProfileOp vmop,
- qemuBuildCommandLineCallbacksPtr callbacks,
bool standalone,
bool enableFips,
virBitmapPtr nodeset,
@@ -9371,8 +9359,7 @@ qemuBuildCommandLine(virConnectPtr conn,
if (qemuBuildRedirdevCommandLine(logManager, cmd, def, qemuCaps) < 0)
goto error;
- if (qemuBuildHostdevCommandLine(cmd, conn, def, qemuCaps, callbacks,
- &bootHostdevNet) < 0)
+ if (qemuBuildHostdevCommandLine(cmd, conn, def, qemuCaps, &bootHostdevNet) <
0)
goto error;
if (migrateURI)
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index a3e6a00..4a8ee4b 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -42,18 +42,6 @@
VIR_ENUM_DECL(qemuVideo)
-typedef struct _qemuBuildCommandLineCallbacks qemuBuildCommandLineCallbacks;
-typedef qemuBuildCommandLineCallbacks *qemuBuildCommandLineCallbacksPtr;
-struct _qemuBuildCommandLineCallbacks {
- char *(*qemuGetSCSIDeviceSgName) (const char *sysfs_prefix,
- const char *adapter,
- unsigned int bus,
- unsigned int target,
- unsigned long long unit);
-};
-
-extern qemuBuildCommandLineCallbacks buildCommandLineCallbacks;
-
char *qemuBuildObjectCommandlineFromJSON(const char *type,
const char *alias,
virJSONValuePtr props);
@@ -68,7 +56,6 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
const char *migrateURI,
virDomainSnapshotObjPtr snapshot,
virNetDevVPortProfileOp vmop,
- qemuBuildCommandLineCallbacksPtr callbacks,
bool standalone,
bool enableFips,
virBitmapPtr nodeset,
@@ -182,9 +169,8 @@ char *qemuBuildUSBHostdevDevStr(const virDomainDef *def,
char *qemuBuildSCSIHostdevDrvStr(virConnectPtr conn,
virDomainHostdevDefPtr dev,
- virQEMUCapsPtr qemuCaps,
- qemuBuildCommandLineCallbacksPtr callbacks)
- ATTRIBUTE_NONNULL(4);
+ virQEMUCapsPtr qemuCaps);
+
char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index bd1a128..f332b34 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1968,8 +1968,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1)
< 0)
goto cleanup;
- if (!(drvstr = qemuBuildSCSIHostdevDrvStr(conn, hostdev, priv->qemuCaps,
- &buildCommandLineCallbacks)))
+ if (!(drvstr = qemuBuildSCSIHostdevDrvStr(conn, hostdev, priv->qemuCaps)))
goto cleanup;
if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 6c870f5..2171665 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5236,7 +5236,7 @@ qemuProcessLaunch(virConnectPtr conn,
priv->monJSON, priv->qemuCaps,
incoming ? incoming->launchURI : NULL,
snapshot, vmop,
- &buildCommandLineCallbacks, false,
+ false,
qemuCheckFips(),
priv->autoNodeset,
&nnicindexes, &nicindexes,
@@ -5656,7 +5656,6 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
migrateURI,
NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
- &buildCommandLineCallbacks,
standalone,
forceFips ? true : qemuCheckFips(),
priv->autoNodeset,
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index eb4c6c8..114cd24 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -448,25 +448,6 @@ virCapsPtr testQemuCapsInit(void)
}
-static char *
-testSCSIDeviceGetSgName(const char *sysfs_prefix ATTRIBUTE_UNUSED,
- const char *adapter ATTRIBUTE_UNUSED,
- unsigned int bus ATTRIBUTE_UNUSED,
- unsigned int target ATTRIBUTE_UNUSED,
- unsigned long long unit ATTRIBUTE_UNUSED)
-{
- char *sg = NULL;
-
- if (VIR_STRDUP(sg, "sg0") < 0)
- return NULL;
-
- return sg;
-}
-
-qemuBuildCommandLineCallbacks testCallbacks = {
- .qemuGetSCSIDeviceSgName = testSCSIDeviceGetSgName,
-};
-
virQEMUCapsPtr
qemuTestParseCapabilities(const char *capsFile)
{
diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h
index 1d5dfc5..196dc23 100644
--- a/tests/testutilsqemu.h
+++ b/tests/testutilsqemu.h
@@ -7,7 +7,6 @@
virCapsPtr testQemuCapsInit(void);
virDomainXMLOptionPtr testQemuXMLConfInit(void);
-extern qemuBuildCommandLineCallbacks testCallbacks;
virQEMUCapsPtr qemuTestParseCapabilities(const char *capsFile);
--
2.7.3