* [PATCH 5/7] libxenlight resend: Destroy device model only for domains that have it
@ 2009-12-02 18:02 Andres Lagar-Cavilla
2009-12-03 12:37 ` Stefano Stabellini
2009-12-03 17:06 ` [PATCH 5/7] libxenlight meta-resend: " Andres Lagar-Cavilla
0 siblings, 2 replies; 3+ messages in thread
From: Andres Lagar-Cavilla @ 2009-12-02 18:02 UTC (permalink / raw)
To: Stefano Stabellini, Vincent Hanquez, xen-devel
[-- Attachment #1: Type: text/plain, Size: 116 bytes --]
Destroy device model only for domains that have it.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
[-- Attachment #2: 05_destroy_dm.patch --]
[-- Type: text/plain, Size: 2233 bytes --]
# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.com>
# Date 1259767696 18000
# Node ID 1041697e46cef5c88bed7e7d463b04b306693a5a
# Parent 27143b3c8648d947249c06c09aada5010562aa56
Destroy device model only for domains that have it.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
diff -r 27143b3c8648 -r 1041697e46ce libxl.c
--- a/libxl.c
+++ b/libxl.c
@@ -489,7 +489,16 @@ int libxl_domain_destroy(struct libxl_ct
char *dom_path, *uuid_str;
char vm_path[UUID_LEN_STR + 5], vss_path[UUID_LEN_STR + 6], xapi_path[20];
xen_uuid_t *uuid;
- int rc;
+ int rc, dm_present;
+
+ if (is_hvm(ctx, domid)) {
+ dm_present = 1;
+ } else {
+ char *pid;
+ pid = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/image/device-model-pid", domid));
+ dm_present = (pid != NULL);
+ libxl_free(ctx, pid);
+ }
dom_path = libxl_xs_get_dompath(ctx, domid);
if (!dom_path)
@@ -501,16 +510,20 @@ int libxl_domain_destroy(struct libxl_ct
}
if (libxl_device_pci_shutdown(ctx, domid) < 0)
XL_LOG(ctx, XL_LOG_ERROR, "pci shutdown failed for domid %d", domid);
- xs_write(ctx->xsh, XBT_NULL,
- libxl_sprintf(ctx, "/local/domain/0/device-model/%d/command", domid),
- "shutdown", strlen("shutdown"));
+ if (dm_present) {
+ xs_write(ctx->xsh, XBT_NULL,
+ libxl_sprintf(ctx, "/local/domain/0/device-model/%d/command", domid),
+ "shutdown", strlen("shutdown"));
+ }
rc = xc_domain_pause(ctx->xch, domid);
if (rc < 0) {
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);
return -1;
}
- if (libxl_destroy_device_model(ctx, domid) < 0)
- XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
+ if (dm_present) {
+ if (libxl_destroy_device_model(ctx, domid) < 0)
+ XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
+ }
if (libxl_devices_destroy(ctx, domid, force) < 0)
XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
if (!xs_rm(ctx->xsh, XBT_NULL, dom_path))
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5/7] libxenlight resend: Destroy device model only for domains that have it
2009-12-02 18:02 [PATCH 5/7] libxenlight resend: Destroy device model only for domains that have it Andres Lagar-Cavilla
@ 2009-12-03 12:37 ` Stefano Stabellini
2009-12-03 17:06 ` [PATCH 5/7] libxenlight meta-resend: " Andres Lagar-Cavilla
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2009-12-03 12:37 UTC (permalink / raw)
To: Andres Lagar-Cavilla
Cc: xen-devel@lists.xensource.com, Vincent Hanquez,
Stefano Stabellini
On Wed, 2 Dec 2009, Andres Lagar-Cavilla wrote:
> Destroy device model only for domains that have it.
>
> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
>
>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 5/7] libxenlight meta-resend: Destroy device model only for domains that have it
2009-12-02 18:02 [PATCH 5/7] libxenlight resend: Destroy device model only for domains that have it Andres Lagar-Cavilla
2009-12-03 12:37 ` Stefano Stabellini
@ 2009-12-03 17:06 ` Andres Lagar-Cavilla
1 sibling, 0 replies; 3+ messages in thread
From: Andres Lagar-Cavilla @ 2009-12-03 17:06 UTC (permalink / raw)
To: Stefano Stabellini, Vincent Hanquez, xen-devel
[-- Attachment #1: Type: text/plain, Size: 117 bytes --]
Destroy device model only for domains that have it.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
[-- Attachment #2: 05_destroy_dm.patch --]
[-- Type: text/x-patch, Size: 2233 bytes --]
# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.com>
# Date 1259767696 18000
# Node ID 1041697e46cef5c88bed7e7d463b04b306693a5a
# Parent 27143b3c8648d947249c06c09aada5010562aa56
Destroy device model only for domains that have it.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>
diff -r 27143b3c8648 -r 1041697e46ce libxl.c
--- a/libxl.c
+++ b/libxl.c
@@ -489,7 +489,16 @@ int libxl_domain_destroy(struct libxl_ct
char *dom_path, *uuid_str;
char vm_path[UUID_LEN_STR + 5], vss_path[UUID_LEN_STR + 6], xapi_path[20];
xen_uuid_t *uuid;
- int rc;
+ int rc, dm_present;
+
+ if (is_hvm(ctx, domid)) {
+ dm_present = 1;
+ } else {
+ char *pid;
+ pid = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/image/device-model-pid", domid));
+ dm_present = (pid != NULL);
+ libxl_free(ctx, pid);
+ }
dom_path = libxl_xs_get_dompath(ctx, domid);
if (!dom_path)
@@ -501,16 +510,20 @@ int libxl_domain_destroy(struct libxl_ct
}
if (libxl_device_pci_shutdown(ctx, domid) < 0)
XL_LOG(ctx, XL_LOG_ERROR, "pci shutdown failed for domid %d", domid);
- xs_write(ctx->xsh, XBT_NULL,
- libxl_sprintf(ctx, "/local/domain/0/device-model/%d/command", domid),
- "shutdown", strlen("shutdown"));
+ if (dm_present) {
+ xs_write(ctx->xsh, XBT_NULL,
+ libxl_sprintf(ctx, "/local/domain/0/device-model/%d/command", domid),
+ "shutdown", strlen("shutdown"));
+ }
rc = xc_domain_pause(ctx->xch, domid);
if (rc < 0) {
XL_LOG_ERRNOVAL(ctx, XL_LOG_ERROR, rc, "xc_domain_pause failed for %d", domid);
return -1;
}
- if (libxl_destroy_device_model(ctx, domid) < 0)
- XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
+ if (dm_present) {
+ if (libxl_destroy_device_model(ctx, domid) < 0)
+ XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_device_model failed for %d", domid);
+ }
if (libxl_devices_destroy(ctx, domid, force) < 0)
XL_LOG(ctx, XL_LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
if (!xs_rm(ctx->xsh, XBT_NULL, dom_path))
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-03 17:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02 18:02 [PATCH 5/7] libxenlight resend: Destroy device model only for domains that have it Andres Lagar-Cavilla
2009-12-03 12:37 ` Stefano Stabellini
2009-12-03 17:06 ` [PATCH 5/7] libxenlight meta-resend: " Andres Lagar-Cavilla
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.