aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraxel <kraxel>2007-08-30 13:14:59 +0000
committerkraxel <kraxel>2007-08-30 13:14:59 +0000
commit1b413f5db557ea8ca85dbfe5d867f37542b51473 (patch)
treec6d973a37ee3b8b99c0de6c53c4d5d9221dcb531
parent906cb4b5765f2aa24043da4f31c7bed9ced12329 (diff)
downloadxenwatch-1b413f5db557ea8ca85dbfe5d867f37542b51473.tar.gz
fix libvirt polling
-rw-r--r--xenscreen.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/xenscreen.c b/xenscreen.c
index 1e783f9..d77c96d 100644
--- a/xenscreen.c
+++ b/xenscreen.c
@@ -33,6 +33,7 @@ struct dom {
char tty[BUFSIZE];
int connected;
int destroyed;
+ int watched;
struct list_head next;
};
static LIST_HEAD(doms);
@@ -287,7 +288,13 @@ static void libvirt_scan(virConnectPtr conn, int boot)
if (dom) {
/* have it */
dom->destroyed = 0;
- continue;
+ if (dom->connected)
+ continue;
+ /* try again a few times in case we have no tty,
+ * it may show up a little later ... */
+ if (dom->watched > 8)
+ continue;
+ dom->watched++;
}
/* new one */
vdom = virDomainLookupByID(conn, ids[i]);
@@ -295,11 +302,13 @@ static void libvirt_scan(virConnectPtr conn, int boot)
xml = virDomainGetXMLDesc(vdom, 0);
if (!name || !xml)
continue;
+ // fprintf(stderr, "\n-- xmldesc --\n%s\n--\n", xml);
dom = get_dom(ids[i]);
snprintf(dom->name, sizeof(dom->name), "%s", name);
libvirt_xml_xpath_str(xml, "string(/domain/devices/console/@tty)",
dom->tty, sizeof(dom->tty));
- fprintf(stderr, "libvirt debug: %s: tty=\"%s\"\n", dom->name, dom->tty);
+ fprintf(stderr, "[ libvirt poll debug: %s (%d): tty=\"%s\" ]\n",
+ dom->name, dom->watched, dom->tty);
try_attach_domain(dom, boot);
}
free(ids);