[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: helper function to send commands to traditional qemu
# HG changeset patch # User Shriram Rajagopalan <rshriram@xxxxxxxxx> # Date 1328810868 0 # Node ID 0f9e4b424d7c55e5ebfbfe933ceeb647f2cd6176 # Parent af96b99b607da7d2923cf522acf149f41d8b230c libxl: helper function to send commands to traditional qemu Introduce a helper function to send commands to traditional qemu. qemu_pci_add_xenstore, qemu_pci_remove_xenstore, libxl__domain_save_device_model and libxl_domain_unpause have been refactored to use this function. Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Feb 09 18:06:24 2012 +0000 +++ b/tools/libxl/libxl.c Thu Feb 09 18:07:48 2012 +0000 @@ -586,7 +586,7 @@ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid); state = libxl__xs_read(gc, XBT_NULL, path); if (state != NULL && !strcmp(state, "paused")) { - libxl__xs_write(gc, XBT_NULL, libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid), "continue"); + libxl__qemu_traditional_cmd(gc, domid, "continue"); libxl__wait_for_device_model(gc, domid, "running", NULL, NULL, NULL); } diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_dom.c --- a/tools/libxl/libxl_dom.c Thu Feb 09 18:06:24 2012 +0000 +++ b/tools/libxl/libxl_dom.c Thu Feb 09 18:07:48 2012 +0000 @@ -355,6 +355,15 @@ return rc; } +int libxl__qemu_traditional_cmd(libxl__gc *gc, uint32_t domid, + const char *cmd) +{ + char *path = NULL; + path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", + domid); + return libxl__xs_write(gc, XBT_NULL, path, "%s", cmd); +} + int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid, libxl_domain_build_info *info, libxl__domain_build_state *state, @@ -637,12 +646,9 @@ switch (libxl__device_model_version_running(gc, domid)) { case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: { - char *path = NULL; LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Saving device model state to %s", filename); - path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", - domid); - libxl__xs_write(gc, XBT_NULL, path, "save"); + libxl__qemu_traditional_cmd(gc, domid, "save"); libxl__wait_for_device_model(gc, domid, "paused", NULL, NULL, NULL); break; } diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Thu Feb 09 18:06:24 2012 +0000 +++ b/tools/libxl/libxl_internal.h Thu Feb 09 18:07:48 2012 +0000 @@ -617,6 +617,8 @@ libxl_domain_build_info *info, libxl__domain_build_state *state); +_hidden int libxl__qemu_traditional_cmd(libxl__gc *gc, uint32_t domid, + const char *cmd); _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid, const char *old_name, const char *new_name, xs_transaction_t trans); diff -r af96b99b607d -r 0f9e4b424d7c tools/libxl/libxl_pci.c --- a/tools/libxl/libxl_pci.c Thu Feb 09 18:06:24 2012 +0000 +++ b/tools/libxl/libxl_pci.c Thu Feb 09 18:07:48 2012 +0000 @@ -602,9 +602,8 @@ libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func); } - path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", - domid); - xs_write(ctx->xsh, XBT_NULL, path, "pci-ins", strlen("pci-ins")); + + libxl__qemu_traditional_cmd(gc, domid, "pci-ins"); rc = libxl__wait_for_device_model(gc, domid, NULL, NULL, pci_ins_check, state); path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", @@ -857,12 +856,11 @@ path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid); libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain, pcidev->bus, pcidev->dev, pcidev->func); - path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid); /* Remove all functions at once atomically by only signalling * device-model for function 0 */ if ( !force && (pcidev->vdevfn & 0x7) == 0 ) { - xs_write(ctx->xsh, XBT_NULL, path, "pci-rem", strlen("pci-rem")); + libxl__qemu_traditional_cmd(gc, domid, "pci-rem"); if (libxl__wait_for_device_model(gc, domid, "pci-removed", NULL, NULL, NULL) < 0) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model didn't respond in time"); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |