mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
nodedev: add mdev support to virNodeDeviceDestroy()
Add the ability to destroy mdev node devices via the mdevctl utility. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
9badcbbb1d
commit
88043da227
@ -786,6 +786,32 @@ nodeDeviceCreateXML(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virCommandPtr
|
||||||
|
nodeDeviceGetMdevctlStopCommand(const char *uuid)
|
||||||
|
{
|
||||||
|
return virCommandNewArgList(MDEVCTL,
|
||||||
|
"stop",
|
||||||
|
"-u",
|
||||||
|
uuid,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
virMdevctlStop(virNodeDeviceDefPtr def)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
|
|
||||||
|
cmd = nodeDeviceGetMdevctlStopCommand(def->caps->data.mdev.uuid);
|
||||||
|
|
||||||
|
if (virCommandRun(cmd, &status) < 0 || status != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
nodeDeviceDestroy(virNodeDevicePtr device)
|
nodeDeviceDestroy(virNodeDevicePtr device)
|
||||||
{
|
{
|
||||||
@ -832,6 +858,13 @@ nodeDeviceDestroy(virNodeDevicePtr device)
|
|||||||
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_DELETE) < 0)
|
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_DELETE) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
} else if (nodeDeviceHasCapability(def, VIR_NODE_DEV_CAP_MDEV)) {
|
||||||
|
if (virMdevctlStop(def) < 0) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("Unable to stop mediated device"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
@ -121,3 +121,5 @@ nodeConnectNodeDeviceEventDeregisterAny(virConnectPtr conn,
|
|||||||
virCommandPtr
|
virCommandPtr
|
||||||
nodeDeviceGetMdevctlStartCommand(virNodeDeviceDefPtr def,
|
nodeDeviceGetMdevctlStartCommand(virNodeDeviceDefPtr def,
|
||||||
char **uuid_out);
|
char **uuid_out);
|
||||||
|
virCommandPtr
|
||||||
|
nodeDeviceGetMdevctlStopCommand(const char *uuid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user