xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v13 01/11] libxl: fix removal of secondary consoles
Date: Thu, 26 Jul 2012 15:55:12 +0100	[thread overview]
Message-ID: <1343314522-32298-2-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1343314522-32298-1-git-send-email-roger.pau@citrix.com>

Secondary consoles are processed by libxl with the rest of the
devices by calling libxl__initiate_device_remove that waits for the
device to reach state 6 before procceeding with the removal.

When libxl is destroying the console devices, Qemu is already dead or
dying, and xenconsoled completely ignores the state backend entry for
console devices, since it performs the cleanup based on the result of
reads/writes to the tty.

Since we don't want to execute hotplug scripts for consoles, leave the
behaviour as it was previously, and just nuke the backend/frontend
xenstore entries by calling libxl__device_destroy.

Report: http://markmail.org/message/yqgppcsdip6tnmh6

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Reported-by: Ian Campbell <ian.campbell@eu.citrix.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
---
 tools/libxl/libxl_device.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index a1b60d7..2429836 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -81,6 +81,8 @@ static int libxl__num_devices(libxl__gc *gc, uint32_t domid)
     for (i = 0; i < num_kinds; i++) {
         if (libxl__device_kind_from_string(kinds[i], &kind))
             continue;
+        if (kind == LIBXL__DEVICE_KIND_CONSOLE)
+            continue;
 
         path = GCSPRINTF("/local/domain/%d/device/%s", domid, kinds[i]);
         devs = libxl__xs_directory(gc, XBT_NULL, path, &num_devs);
@@ -522,10 +524,18 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs)
             path = libxl__xs_read(gc, XBT_NULL, path);
             GCNEW(dev);
             if (path && libxl__parse_backend_path(gc, path, dev) == 0) {
-                aodev = &aodevs->array[numdev];
                 dev->domid = domid;
                 dev->kind = kind;
                 dev->devid = atoi(devs[j]);
+                if (dev->backend_kind == LIBXL__DEVICE_KIND_CONSOLE) {
+                    /* Currently console devices can be destroyed
+                     * synchronously by just removing xenstore entries,
+                     * this is what libxl__device_destroy does.
+                     */
+                    libxl__device_destroy(gc, dev);
+                    continue;
+                }
+                aodev = &aodevs->array[numdev];
                 aodev->action = DEVICE_DISCONNECT;
                 aodev->dev = dev;
                 aodev->callback = libxl__ao_devices_callback;
-- 
1.7.7.5 (Apple Git-26)

  reply	other threads:[~2012-07-26 14:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 14:55 [PATCH v13 00/11] execute hotplug scripts from libxl Roger Pau Monne
2012-07-26 14:55 ` Roger Pau Monne [this message]
2012-07-26 15:16   ` [PATCH v13 01/11] libxl: fix removal of secondary consoles Ian Jackson
2012-07-26 14:55 ` [PATCH v13 02/11] libxl: refactor disk addition to take a helper Roger Pau Monne
2012-07-26 15:15   ` Ian Jackson
2012-07-26 14:55 ` [PATCH v13 03/11] libxl: convert libxl__device_disk_local_attach to an async op Roger Pau Monne
2012-07-26 14:55 ` [PATCH v13 04/11] libxl: convert libxl_device_disk_add " Roger Pau Monne
2012-07-26 15:33   ` Ian Campbell
2012-07-26 14:55 ` [PATCH v13 05/11] libxl: convert libxl_device_nic_add to an async operation Roger Pau Monne
2012-07-26 14:55 ` [PATCH v13 06/11] libxl: add option to choose who executes hotplug scripts Roger Pau Monne
2012-07-26 14:55 ` [PATCH v13 07/11] libxl: set correct nic type depending on the guest Roger Pau Monne
2012-07-26 15:16   ` Ian Jackson
2012-07-26 14:55 ` [PATCH v13 08/11] libxl: call hotplug scripts for disk devices from libxl Roger Pau Monne
2012-07-26 14:55 ` [PATCH v13 09/11] libxl: call hotplug scripts for nic " Roger Pau Monne
2012-07-26 14:55 ` [PATCH v13 10/11] libxl: convert libxl_device_vkb_add to an async operation Roger Pau Monne
2012-07-26 14:55 ` [PATCH v13 11/11] libxl: convert libxl_device_vfb_add " Roger Pau Monne
2012-07-26 15:05   ` Ian Campbell
2012-07-26 15:10     ` Roger Pau Monne
2012-07-26 15:48 ` [PATCH v13 00/11] execute hotplug scripts from libxl 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=1343314522-32298-2-git-send-email-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).