From: rshriram@cs.ubc.ca
To: xen-devel@lists.xensource.com
Cc: brendan@cs.ubc.ca, ian.jackson@eu.citrix.com,
ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com
Subject: [PATCH 1 of 6 V3] libxl: helper function to send commands to traditional qemu
Date: Thu, 02 Feb 2012 22:49:57 -0800 [thread overview]
Message-ID: <340dd6a3f0dab2fcba83.1328251797@athos.nss.cs.ubc.ca> (raw)
In-Reply-To: <patchbomb.1328251796@athos.nss.cs.ubc.ca>
# HG changeset patch
# User Shriram Rajagopalan <rshriram@cs.ubc.ca>
# Date 1328251592 28800
# Node ID 340dd6a3f0dab2fcba83a68dea072e9d9af20182
# Parent 4612cca7fb7c06e83a205510f6c2e43d5f246582
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@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
diff -r 4612cca7fb7c -r 340dd6a3f0da tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Thu Feb 02 22:46:17 2012 -0800
+++ b/tools/libxl/libxl.c Thu Feb 02 22:46:32 2012 -0800
@@ -517,7 +517,7 @@ int libxl_domain_unpause(libxl_ctx *ctx,
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 4612cca7fb7c -r 340dd6a3f0da tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c Thu Feb 02 22:46:17 2012 -0800
+++ b/tools/libxl/libxl_dom.c Thu Feb 02 22:46:32 2012 -0800
@@ -409,6 +409,15 @@ static int libxl__toolstack_restore(uint
return 0;
}
+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,
@@ -761,12 +770,9 @@ int libxl__domain_save_device_model(libx
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 4612cca7fb7c -r 340dd6a3f0da tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Thu Feb 02 22:46:17 2012 -0800
+++ b/tools/libxl/libxl_internal.h Thu Feb 02 22:46:32 2012 -0800
@@ -263,6 +263,8 @@ _hidden int libxl__build_hvm(libxl__gc *
libxl_device_model_info *dm_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 4612cca7fb7c -r 340dd6a3f0da tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c Thu Feb 02 22:46:17 2012 -0800
+++ b/tools/libxl/libxl_pci.c Thu Feb 02 22:46:32 2012 -0800
@@ -602,9 +602,8 @@ static int qemu_pci_add_xenstore(libxl__
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 @@ static int qemu_pci_remove_xenstore(libx
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");
next prev parent reply other threads:[~2012-02-03 6:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-03 6:49 [PATCH 0 of 6 V3] libxl: refactor suspend/resume code rshriram
2012-02-03 6:49 ` rshriram [this message]
2012-02-03 6:49 ` [PATCH 2 of 6 V3] libxl: bugfix: create_domain() return to caller if !daemonize rshriram
2012-02-03 6:49 ` [PATCH 3 of 6 V3] libxl: QMP stop/resume & refactor QEMU suspend/resume/save rshriram
2012-02-09 9:13 ` Ian Campbell
2012-02-03 6:50 ` [PATCH 4 of 6 V3] libxl: support suspend_cancel in domain_resume rshriram
2012-02-09 9:16 ` Ian Campbell
2012-02-09 9:20 ` Ian Campbell
2012-02-09 18:21 ` Shriram Rajagopalan
2012-02-09 19:56 ` Ian Campbell
2012-02-10 1:31 ` [PATCH 4 of 6 V4] " rshriram
2012-02-10 9:00 ` Ian Campbell
2012-02-20 19:00 ` Ian Jackson
2012-02-20 20:02 ` Shriram Rajagopalan
2012-02-20 22:26 ` Shriram Rajagopalan
2012-02-21 10:13 ` Stefano Stabellini
2012-02-21 10:12 ` Stefano Stabellini
2012-02-21 12:21 ` Ian Jackson
2012-02-03 6:50 ` [PATCH 5 of 6 V3] libxl: refactor migrate_domain and generalize migrate_receive rshriram
2012-02-09 9:17 ` Ian Campbell
2012-02-03 6:50 ` [PATCH 6 of 6 V3] libxl: resume instead of unpause on xl save -c rshriram
2012-02-09 9:18 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=340dd6a3f0dab2fcba83.1328251797@athos.nss.cs.ubc.ca \
--to=rshriram@cs.ubc.ca \
--cc=brendan@cs.ubc.ca \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).