提交 0da965c5 编写于 作者: J Ján Tomko

drop qemuBuildCommandLineCallbacks

Essentially revert commit 3a6204cb which added these to allow the test
suite to pass without depending on the host system state.

Since commit 4b527c1a we already mock virSCSIDeviceGetSgName, so these
callbacks are useless.
上级 ea4fc802
......@@ -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);
......@@ -9167,10 +9160,6 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver,
}
qemuBuildCommandLineCallbacks buildCommandLineCallbacks = {
.qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName,
};
/*
* Constructs a argv suitable for launching qemu with config defined
* for a given virtual machine.
......@@ -9189,7 +9178,6 @@ qemuBuildCommandLine(virConnectPtr conn,
const char *migrateURI,
virDomainSnapshotObjPtr snapshot,
virNetDevVPortProfileOp vmop,
qemuBuildCommandLineCallbacksPtr callbacks,
bool standalone,
bool enableFips,
virBitmapPtr nodeset,
......@@ -9375,8 +9363,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)
......
......@@ -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);
......
......@@ -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)))
......
......@@ -5235,7 +5235,7 @@ qemuProcessLaunch(virConnectPtr conn,
priv->monJSON, priv->qemuCaps,
incoming ? incoming->launchURI : NULL,
snapshot, vmop,
&buildCommandLineCallbacks, false,
false,
qemuCheckFips(),
priv->autoNodeset,
&nnicindexes, &nicindexes,
......@@ -5655,7 +5655,6 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
migrateURI,
NULL,
VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
&buildCommandLineCallbacks,
standalone,
forceFips ? true : qemuCheckFips(),
priv->autoNodeset,
......
......@@ -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)
{
......
......@@ -7,7 +7,6 @@
virCapsPtr testQemuCapsInit(void);
virDomainXMLOptionPtr testQemuXMLConfInit(void);
extern qemuBuildCommandLineCallbacks testCallbacks;
virQEMUCapsPtr qemuTestParseCapabilities(const char *capsFile);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册