Add an internal service function to check for a running device model.
This can be used later when adding devices to a domain requiring a
device model for either printing an error message or starting the
device model in case it is not already running.
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
libxl_ctx *ctx = CTX;
uint32_t domid = dis->domid;
char *dom_path;
- char *pid;
int rc, dm_present;
libxl__ev_child_init(&dis->destroyer);
}
/* fall through */
case LIBXL_DOMAIN_TYPE_PV:
- pid = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("/local/domain/%d/image/device-model-pid", domid));
- dm_present = (pid != NULL);
+ dm_present = libxl__dm_active(gc, domid);
break;
case LIBXL_DOMAIN_TYPE_INVALID:
rc = ERROR_FAIL;
return ret;
}
+int libxl__dm_active(libxl__gc *gc, uint32_t domid)
+{
+ char *pid, *path;
+
+ path = GCSPRINTF("/local/domain/%d/image/device-model-pid", domid);
+ pid = libxl__xs_read(gc, XBT_NULL, path);
+
+ return pid != NULL;
+}
+
/*
* Local variables:
* mode: C
uint32_t backend_id,
const char *type,
bool def);
+_hidden int libxl__dm_active(libxl__gc *gc, uint32_t domid);
/*
* This function will fix reserved device memory conflict