}
return 0;
}
+
+
+int
+nodeDeviceIsPersistent(virNodeDevice *device)
+{
+ virNodeDeviceObj *obj = NULL;
+ virNodeDeviceDef *def = NULL;
+ int ret = -1;
+
+ if (nodeDeviceInitWait() < 0)
+ return -1;
+
+ if (!(obj = nodeDeviceObjFindByName(device->name)))
+ return -1;
+ def = virNodeDeviceObjGetDef(obj);
+
+ if (virNodeDeviceIsPersistentEnsureACL(device->conn, def) < 0)
+ goto cleanup;
+
+ ret = virNodeDeviceObjIsPersistent(obj);
+
+ cleanup:
+ virNodeDeviceObjEndAPI(&obj);
+ return ret;
+}
+
+
+int
+nodeDeviceIsActive(virNodeDevice *device)
+{
+ virNodeDeviceObj *obj = NULL;
+ virNodeDeviceDef *def = NULL;
+ int ret = -1;
+
+ if (nodeDeviceInitWait() < 0)
+ return -1;
+
+ if (!(obj = nodeDeviceObjFindByName(device->name)))
+ return -1;
+ def = virNodeDeviceObjGetDef(obj);
+
+ if (virNodeDeviceIsActiveEnsureACL(device->conn, def) < 0)
+ goto cleanup;
+
+ ret = virNodeDeviceObjIsActive(obj);
+
+ cleanup:
+ virNodeDeviceObjEndAPI(&obj);
+ return ret;
+}
virObjectEvent *event = NULL;
bool new_device = true;
int ret = -1;
- bool was_persistent = false;
+ bool persistent = false;
bool autostart = false;
bool is_mdev;
if (is_mdev)
nodeDeviceDefCopyFromMdevctl(def, objdef);
- was_persistent = virNodeDeviceObjIsPersistent(obj);
+
+ persistent = virNodeDeviceObjIsPersistent(obj);
autostart = virNodeDeviceObjIsAutostart(obj);
/* If the device was defined by mdevctl and was never instantiated, it
* and the current definition will take its place. */
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
goto cleanup;
- virNodeDeviceObjSetPersistent(obj, was_persistent);
+ virNodeDeviceObjSetPersistent(obj, persistent);
virNodeDeviceObjSetAutostart(obj, autostart);
objdef = virNodeDeviceObjGetDef(obj);
virNodeDeviceObjSetActive(obj, true);
virNodeDeviceObjSetAutostart(obj, true);
+ virNodeDeviceObjSetPersistent(obj, true);
virNodeDeviceObjEndAPI(&obj);
.nodeDeviceCreate = nodeDeviceCreate, /* 7.3.0 */
.nodeDeviceSetAutostart = nodeDeviceSetAutostart, /* 7.8.0 */
.nodeDeviceGetAutostart = nodeDeviceGetAutostart, /* 7.8.0 */
+ .nodeDeviceIsPersistent = nodeDeviceIsPersistent, /* 7.8.0 */
+ .nodeDeviceIsActive = nodeDeviceIsActive, /* 7.8.0 */
};