return virHostdevPCINodeDeviceDetach(hostdevMgr, pci);
}
+
+/**
+ * virDomainDriverAddIOThreadCheck:
+ * @def: domain definition
+ * @iothread_id: iothread id
+ *
+ * Returns -1 if an IOThread is already using the given iothread id
+ */
+int
+virDomainDriverAddIOThreadCheck(virDomainDef *def,
+ unsigned int iothread_id)
+{
+ if (virDomainIOThreadIDFind(def, iothread_id)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("an IOThread is already using iothread_id '%u'"),
+ iothread_id);
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * virDomainDriverDelIOThreadCheck:
+ * @def: domain definition
+ * @iothread_id: iothread id
+ *
+ * Returns -1 if there is no IOThread using the given iothread id
+ */
+int
+virDomainDriverDelIOThreadCheck(virDomainDef *def,
+ unsigned int iothread_id)
+{
+ size_t i;
+
+ if (!virDomainIOThreadIDFind(def, iothread_id)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("cannot find IOThread '%u' in iothreadids list"),
+ iothread_id);
+ return -1;
+ }
+
+ for (i = 0; i < def->ndisks; i++) {
+ if (def->disks[i]->iothread == iothread_id) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("cannot remove IOThread %u since it "
+ "is being used by disk '%s'"),
+ iothread_id, def->disks[i]->dst);
+ return -1;
+ }
+ }
+
+ for (i = 0; i < def->ncontrollers; i++) {
+ if (def->controllers[i]->iothread == iothread_id) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("cannot remove IOThread '%u' since it "
+ "is being used by controller"),
+ iothread_id);
+ return -1;
+ }
+ }
+
+ return 0;
+}
}
-static int
-qemuDomainAddIOThreadCheck(virDomainDef *def,
- unsigned int iothread_id)
-{
- if (virDomainIOThreadIDFind(def, iothread_id)) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("an IOThread is already using iothread_id '%u'"),
- iothread_id);
- return -1;
- }
-
- return 0;
-}
-
-
-static int
-qemuDomainDelIOThreadCheck(virDomainDef *def,
- unsigned int iothread_id)
-{
- size_t i;
-
- if (!virDomainIOThreadIDFind(def, iothread_id)) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("cannot find IOThread '%u' in iothreadids list"),
- iothread_id);
- return -1;
- }
-
- for (i = 0; i < def->ndisks; i++) {
- if (def->disks[i]->iothread == iothread_id) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("cannot remove IOThread %u since it "
- "is being used by disk '%s'"),
- iothread_id, def->disks[i]->dst);
- return -1;
- }
- }
-
- for (i = 0; i < def->ncontrollers; i++) {
- if (def->controllers[i]->iothread == iothread_id) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("cannot remove IOThread '%u' since it "
- "is being used by controller"),
- iothread_id);
- return -1;
- }
- }
-
- return 0;
-}
-
-
/**
* @params: Pointer to params list
* @nparams: Number of params to be parsed
switch (action) {
case VIR_DOMAIN_IOTHREAD_ACTION_ADD:
- if (qemuDomainAddIOThreadCheck(def, iothread.iothread_id) < 0)
+ if (virDomainDriverAddIOThreadCheck(def, iothread.iothread_id) < 0)
goto endjob;
if (qemuDomainHotplugAddIOThread(driver, vm, iothread.iothread_id) < 0)
break;
case VIR_DOMAIN_IOTHREAD_ACTION_DEL:
- if (qemuDomainDelIOThreadCheck(def, iothread.iothread_id) < 0)
+ if (virDomainDriverDelIOThreadCheck(def, iothread.iothread_id) < 0)
goto endjob;
if (qemuDomainHotplugDelIOThread(driver, vm, iothread.iothread_id) < 0)
if (persistentDef) {
switch (action) {
case VIR_DOMAIN_IOTHREAD_ACTION_ADD:
- if (qemuDomainAddIOThreadCheck(persistentDef, iothread.iothread_id) < 0)
+ if (virDomainDriverAddIOThreadCheck(persistentDef, iothread.iothread_id) < 0)
goto endjob;
if (!virDomainIOThreadIDAdd(persistentDef, iothread.iothread_id))
break;
case VIR_DOMAIN_IOTHREAD_ACTION_DEL:
- if (qemuDomainDelIOThreadCheck(persistentDef, iothread.iothread_id) < 0)
+ if (virDomainDriverDelIOThreadCheck(persistentDef, iothread.iothread_id) < 0)
goto endjob;
virDomainIOThreadIDDel(persistentDef, iothread.iothread_id);