From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: ospk-vm@lab.ntt.co.jp, Ian Pratt <ian.pratt@citrix.com>,
ian.jackson@eu.citrix.com,
Keir Fraser <keir.fraser@eu.citrix.com>
Subject: [RFC][PATCH 08/13] Kemari: add dev state "Attached" to python
Date: Fri, 06 Mar 2009 15:46:54 +0900 [thread overview]
Message-ID: <49B0C6DE.9050205@lab.ntt.co.jp> (raw)
In-Reply-To: <49B0B8DC.5000606@lab.ntt.co.jp>
This patch implements python code that sends information necessary to attach
devices. It also restores the information to the XenStore.
Signed-off-by: Yoshi Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Yoshisato Yanagisawa <yanagisawa.yoshisato@lab.ntt.co.jp>
---
tools/python/xen/xend/XendDomainInfo.py | 8 +++
tools/python/xen/xend/server/DevController.py | 61 ++++++++++++++++++++++++++
tools/python/xen/xend/server/vfbif.py | 4 +
3 files changed, 73 insertions(+)
diff -r 19201eebab16 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py Wed Mar 04 17:04:24 2009 +0900
@@ -868,6 +868,14 @@
"""
for devclass in XendDevices.valid_devices():
self.getDeviceController(devclass).waitForDevices()
+
+ def waitForAttachedDevices(self, devinfo):
+ """Wait for this domain's configured devices to connect.
+
+ @raise VmError: if any device fails to initialise.
+ """
+ for devclass in XendDevices.valid_devices():
+ self.getDeviceController(devclass).waitForAttachedDevices(devinfo)
def hvm_destroyPCIDevice(self, vslot):
log.debug("hvm_destroyPCIDevice called %s", vslot)
diff -r 19201eebab16 tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/python/xen/xend/server/DevController.py Wed Mar 04 17:04:24 2009 +0900
@@ -53,6 +53,7 @@
'Closed' : 6,
'Reconfiguring': 7,
'Reconfigured' : 8,
+ 'Attached' : 9,
}
xoptions = XendOptions.instance()
@@ -192,6 +193,59 @@
(devid, self.deviceClass, err))
+ def waitForAttachedDevices(self, devinfo):
+ log.debug("Waiting for attached devices %s.", self.deviceClass)
+ seq = self.deviceIDs()
+ return [self.waitForAttachedDevice(item, devinfo) for item in seq]
+
+
+ def waitForAttachedDevice(self, devid, devinfo):
+ log.debug("Waiting for attached %s.", devid)
+
+ if not self.hotplug:
+ return
+
+ (status, err) = self.waitForBackend(devid)
+
+ if status == Timeout:
+ self.destroyDevice(devid, False)
+ raise VmError("Device %s (%s) could not be connected. "
+ "Hotplug scripts not working." %
+ (devid, self.deviceClass))
+
+ elif status == Error:
+ self.destroyDevice(devid, False)
+ raise VmError("Device %s (%s) could not be connected. "
+ "Backend device not found." %
+ (devid, self.deviceClass))
+
+ elif status == Missing:
+ # Don't try to destroy the device; it's already gone away.
+ raise VmError("Device %s (%s) could not be connected. "
+ "Device not found." % (devid, self.deviceClass))
+
+ elif status == Busy:
+ err = None
+ frontpath = self.frontendPath(devid)
+ backpath = xstransact.Read(frontpath, "backend")
+ if backpath:
+ err = xstransact.Read(backpath, HOTPLUG_ERROR_NODE)
+ if not err:
+ err = "Busy."
+
+ self.destroyDevice(devid, False)
+ raise VmError("Device %s (%s) could not be connected.\n%s" %
+ (devid, self.deviceClass, err))
+
+ for x in devinfo:
+ if x[0] == str(devid): # x[0] was changed to string for transfer.
+ for y in x[1]:
+ if y[0] and y[1]:
+ self.writeFrontend(devid, y[0], str(y[1]))
+ log.debug("%s %s set for %s.", y[0], y[1], devid)
+ self.writeFrontend(devid, 'state', str(xenbusState['Attached']))
+
+
def waitForDevice_destroy(self, devid, backpath):
log.debug("Waiting for %s - destroyDevice.", devid)
@@ -483,6 +537,13 @@
else:
raise VmError("Device %s not connected" % devid)
+ def writeFrontend(self, devid, *args):
+ frontpath = self.frontendPath(devid)
+
+ if frontpath:
+ xstransact.Write(frontpath, *args)
+ else:
+ raise VmError("Device %s not connected" % devid)
## private:
diff -r 19201eebab16 tools/python/xen/xend/server/vfbif.py
--- a/tools/python/xen/xend/server/vfbif.py Thu Sep 25 13:33:50 2008 +0100
+++ b/tools/python/xen/xend/server/vfbif.py Wed Mar 04 17:04:24 2009 +0900
@@ -39,6 +39,10 @@
if devinfo[i] is not None])
def waitForDevice(self, devid):
+ # is a qemu-dm managed device, don't wait for hotplug for these.
+ return
+
+ def waitForAttachedDevice(self, devid, devinfo):
# is a qemu-dm managed device, don't wait for hotplug for these.
return
next prev parent reply other threads:[~2009-03-06 6:46 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 5:47 [RFC][PATCH 00/13] Kemari: VM synchronization mechanism for fault tolerance Yoshiaki Tamura
2009-03-06 5:50 ` [RFC][PATCH 01/13] Kemari: add ECS_TAP state to event channel Yoshiaki Tamura
2009-03-06 5:53 ` [RFC][PATCH 02/13] Kemari: core kemari code Yoshiaki Tamura
2009-03-06 5:54 ` [RFC][PATCH 03/13] Kemari: change parameter type of xc_{set, get}_hvm_param Yoshiaki Tamura
2009-03-06 5:56 ` [RFC][PATCH 04/13] Kemari: Kemari controller interface in libxc Yoshiaki Tamura
2009-03-06 6:26 ` [RFC][PATCH 05/13] Kemari: Kemari sender Yoshiaki Tamura
2009-03-06 6:46 ` [RFC][PATCH 06/13] Kemari: Kemari receiver Yoshiaki Tamura
2009-03-06 6:46 ` [RFC][PATCH 07/13] Kemari: add Kemari support to python Yoshiaki Tamura
2009-03-06 6:46 ` Yoshiaki Tamura [this message]
2009-03-06 6:47 ` [RFC][PATCH 09/13] Kemari: add XenbusStateAttached to xenbus Yoshiaki Tamura
2009-03-06 6:47 ` [RFC][PATCH 10/13] Kemari: XenbusStateAttached handler for blkback Yoshiaki Tamura
2009-03-06 6:47 ` [RFC][PATCH 11/13] Kemari: XenbusStateAttached handler for netback Yoshiaki Tamura
2009-03-06 6:47 ` [RFC][PATCH 12/13] Kemari: use signal to save qemu state for Kemari Yoshiaki Tamura
2009-03-06 11:39 ` Stefano Stabellini
2009-03-06 16:20 ` Yoshiaki Tamura
2009-03-17 17:55 ` Stefano Stabellini
2009-03-17 18:21 ` Ian Jackson
2009-03-17 18:35 ` Stefano Stabellini
2009-03-18 9:11 ` Yoshiaki Tamura
2009-03-18 9:34 ` Keir Fraser
2009-03-18 12:45 ` Yoshiaki Tamura
2009-03-18 12:46 ` Stefano Stabellini
2009-03-18 13:06 ` Keir Fraser
2009-03-19 5:54 ` Yoshiaki Tamura
2009-03-18 17:37 ` Christopher Head
2009-03-19 6:07 ` Yoshiaki Tamura
2009-03-16 18:05 ` Ian Jackson
2009-03-06 6:47 ` [RFC][PATCH 13/13] Kemari: use shared region with to flip logdirty_bitmap Yoshiaki Tamura
-- strict thread matches above, loose matches on Subject: below --
2009-03-12 1:14 [RFC][PATCH 00/13] Kemari: updated to the 3.4 unstable tree Yoshiaki Tamura
2009-03-12 1:19 ` [RFC][PATCH 08/13] Kemari: add dev state "Attached" to python Yoshiaki Tamura
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=49B0C6DE.9050205@lab.ntt.co.jp \
--to=tamura.yoshiaki@lab.ntt.co.jp \
--cc=ian.jackson@eu.citrix.com \
--cc=ian.pratt@citrix.com \
--cc=keir.fraser@eu.citrix.com \
--cc=ospk-vm@lab.ntt.co.jp \
--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 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.