提交 a062d1a1 编写于 作者: J John Ferlan

Add virConnectPtr for qemuBuildSCSIHostdevDrvStr

Add a conn for future patches to be able to grab the secret when
authenticating an iSCSI host device
上级 42957661
......@@ -5125,7 +5125,8 @@ qemuBuildUSBHostdevUSBDevStr(virDomainHostdevDefPtr dev)
}
char *
qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
qemuBuildSCSIHostdevDrvStr(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
qemuBuildCommandLineCallbacksPtr callbacks)
{
......@@ -8999,7 +9000,7 @@ qemuBuildCommandLine(virConnectPtr conn,
char *drvstr;
virCommandAddArg(cmd, "-drive");
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, qemuCaps, callbacks)))
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(conn, hostdev, qemuCaps, callbacks)))
goto error;
virCommandAddArg(cmd, drvstr);
VIR_FREE(drvstr);
......
......@@ -170,10 +170,11 @@ char * qemuBuildUSBHostdevDevStr(virDomainDefPtr def,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
char * qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
char * qemuBuildSCSIHostdevDrvStr(virConnectPtr conn,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps,
qemuBuildCommandLineCallbacksPtr callbacks)
ATTRIBUTE_NONNULL(3);
ATTRIBUTE_NONNULL(4);
char * qemuBuildSCSIHostdevDevStr(virDomainDefPtr def,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
......
......@@ -6519,7 +6519,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
break;
case VIR_DOMAIN_DEVICE_HOSTDEV:
ret = qemuDomainAttachHostDevice(driver, vm,
ret = qemuDomainAttachHostDevice(dom->conn, driver, vm,
dev->data.hostdev);
if (!ret)
dev->data.hostdev = NULL;
......@@ -6591,10 +6591,10 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
ret = qemuDomainDetachLease(driver, vm, dev->data.lease);
break;
case VIR_DOMAIN_DEVICE_NET:
ret = qemuDomainDetachNetDevice(driver, vm, dev);
ret = qemuDomainDetachNetDevice(dom->conn, driver, vm, dev);
break;
case VIR_DOMAIN_DEVICE_HOSTDEV:
ret = qemuDomainDetachHostDevice(driver, vm, dev);
ret = qemuDomainDetachHostDevice(dom->conn, driver, vm, dev);
break;
case VIR_DOMAIN_DEVICE_CHR:
ret = qemuDomainDetachChrDevice(driver, vm, dev->data.chr);
......
......@@ -860,7 +860,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
* netdev-specific code as appropriate), then also added to
* the nets list (see cleanup:) if successful.
*/
ret = qemuDomainAttachHostDevice(driver, vm,
ret = qemuDomainAttachHostDevice(conn, driver, vm,
virDomainNetGetActualHostdev(net));
goto cleanup;
}
......@@ -1547,7 +1547,8 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
}
static int
qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver,
qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
{
......@@ -1594,7 +1595,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver,
if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
goto cleanup;
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, priv->qemuCaps,
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(conn, hostdev, priv->qemuCaps,
&buildCommandLineCallbacks)))
goto cleanup;
......@@ -1642,7 +1643,8 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver,
return ret;
}
int qemuDomainAttachHostDevice(virQEMUDriverPtr driver,
int qemuDomainAttachHostDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
{
......@@ -1667,7 +1669,7 @@ int qemuDomainAttachHostDevice(virQEMUDriverPtr driver,
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
if (qemuDomainAttachHostSCSIDevice(driver, vm,
if (qemuDomainAttachHostSCSIDevice(conn, driver, vm,
hostdev) < 0)
goto error;
break;
......@@ -3265,7 +3267,8 @@ qemuDomainDetachHostUSBDevice(virQEMUDriverPtr driver,
}
static int
qemuDomainDetachHostSCSIDevice(virQEMUDriverPtr driver,
qemuDomainDetachHostSCSIDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr detach)
{
......@@ -3286,7 +3289,7 @@ qemuDomainDetachHostSCSIDevice(virQEMUDriverPtr driver,
return -1;
}
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(detach, priv->qemuCaps,
if (!(drvstr = qemuBuildSCSIHostdevDrvStr(conn, detach, priv->qemuCaps,
&buildCommandLineCallbacks)))
goto cleanup;
if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, detach, priv->qemuCaps)))
......@@ -3317,7 +3320,8 @@ qemuDomainDetachHostSCSIDevice(virQEMUDriverPtr driver,
}
static int
qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver,
qemuDomainDetachThisHostDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr detach)
{
......@@ -3331,7 +3335,7 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver,
ret = qemuDomainDetachHostUSBDevice(driver, vm, detach);
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
ret = qemuDomainDetachHostSCSIDevice(driver, vm, detach);
ret = qemuDomainDetachHostSCSIDevice(conn, driver, vm, detach);
break;
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
......@@ -3354,7 +3358,8 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver,
}
/* search for a hostdev matching dev and detach it */
int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
int qemuDomainDetachHostDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
......@@ -3414,13 +3419,14 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
* function so that mac address / virtualport are reset
*/
if (detach->parent.type == VIR_DOMAIN_DEVICE_NET)
return qemuDomainDetachNetDevice(driver, vm, &detach->parent);
return qemuDomainDetachNetDevice(conn, driver, vm, &detach->parent);
else
return qemuDomainDetachThisHostDevice(driver, vm, detach);
return qemuDomainDetachThisHostDevice(conn, driver, vm, detach);
}
int
qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
qemuDomainDetachNetDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev)
{
......@@ -3436,7 +3442,7 @@ qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
if (virDomainNetGetActualType(detach) == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
/* coverity[negative_returns] */
ret = qemuDomainDetachThisHostDevice(driver, vm,
ret = qemuDomainDetachThisHostDevice(conn, driver, vm,
virDomainNetGetActualHostdev(detach));
goto cleanup;
}
......
......@@ -50,7 +50,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
int qemuDomainAttachRedirdevDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainRedirdevDefPtr hostdev);
int qemuDomainAttachHostDevice(virQEMUDriverPtr driver,
int qemuDomainAttachHostDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev);
int qemuDomainChangeGraphics(virQEMUDriverPtr driver,
......@@ -75,10 +76,12 @@ int qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver,
int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev);
int qemuDomainDetachNetDevice(virQEMUDriverPtr driver,
int qemuDomainDetachNetDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev);
int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
int qemuDomainDetachHostDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev);
int qemuDomainAttachLease(virQEMUDriverPtr driver,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册