# HG changeset patch
# User Brendan Cully <brendan@xxxxxxxxx>
# Date 1168891287 28800
# Node ID 204aa85417bd0c618cfe6dd69088a9a443191196
# Parent fa960afcb0ac1f4938f173b9a2cd97d1f6d5775e
Add XS_RESUME command; export it to xend.
This clears the shutdown flag for a domain in xenstore, allowing
subsequent shutdowns of the same domain to fire the appropriate
watches.
Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>
diff -r fa960afcb0ac -r 204aa85417bd tools/python/xen/lowlevel/xs/xs.c
--- a/tools/python/xen/lowlevel/xs/xs.c Mon Jan 15 12:00:35 2007 -0800
+++ b/tools/python/xen/lowlevel/xs/xs.c Mon Jan 15 12:01:27 2007 -0800
@@ -618,6 +618,33 @@ static PyObject *xspy_introduce_domain(X
return none(result);
}
+#define xspy_resume_domain_doc "\n" \
+ "Tell xenstore to clear its shutdown flag for a domain.\n" \
+ "This ensures that a subsequent shutdown will fire the\n" \
+ "appropriate watches.\n" \
+ " dom [int]: domain id\n" \
+ "\n" \
+ "Returns None on success.\n" \
+ "Raises xen.lowlevel.xs.Error on error.\n"
+
+static PyObject *xspy_resume_domain(XsHandle *self, PyObject *args)
+{
+ uint32_t dom;
+
+ struct xs_handle *xh = xshandle(self);
+ bool result = 0;
+
+ if (!xh)
+ return NULL;
+ if (!PyArg_ParseTuple(args, "i", &dom))
+ return NULL;
+
+ Py_BEGIN_ALLOW_THREADS
+ result = xs_resume_domain(xh, dom);
+ Py_END_ALLOW_THREADS
+
+ return none(result);
+}
#define xspy_release_domain_doc "\n" \
"Tell xenstore to release its channel to a domain.\n" \
@@ -789,6 +816,7 @@ static PyMethodDef xshandle_methods[] =
XSPY_METH(transaction_start, METH_NOARGS),
XSPY_METH(transaction_end, METH_VARARGS | METH_KEYWORDS),
XSPY_METH(introduce_domain, METH_VARARGS),
+ XSPY_METH(resume_domain, METH_VARARGS),
XSPY_METH(release_domain, METH_VARARGS),
XSPY_METH(close, METH_NOARGS),
XSPY_METH(get_domain_path, METH_VARARGS),
diff -r fa960afcb0ac -r 204aa85417bd tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Mon Jan 15 12:00:35 2007 -0800
+++ b/tools/python/xen/xend/XendDomainInfo.py Mon Jan 15 12:01:27 2007 -0800
@@ -45,7 +45,7 @@ from xen.xend.XendError import XendError
from xen.xend.XendError import XendError, VmError
from xen.xend.XendDevices import XendDevices
from xen.xend.xenstore.xstransact import xstransact, complete
-from xen.xend.xenstore.xsutil import GetDomainPath, IntroduceDomain
+from xen.xend.xenstore.xsutil import GetDomainPath, IntroduceDomain,
ResumeDomain
from xen.xend.xenstore.xswatch import xswatch
from xen.xend.XendConstants import *
from xen.xend.XendAPIConstants import *
@@ -1539,6 +1539,7 @@ class XendDomainInfo:
try:
if self.domid is not None:
xc.domain_resume(self.domid)
+ ResumeDomain(self.domid)
except:
log.exception("XendDomainInfo.resume: xc.domain_resume failed on
domain %s." % (str(self.domid)))
diff -r fa960afcb0ac -r 204aa85417bd tools/python/xen/xend/xenstore/xsutil.py
--- a/tools/python/xen/xend/xenstore/xsutil.py Mon Jan 15 12:00:35 2007 -0800
+++ b/tools/python/xen/xend/xenstore/xsutil.py Mon Jan 15 12:01:27 2007 -0800
@@ -24,3 +24,6 @@ def IntroduceDomain(domid, page, port):
def GetDomainPath(domid):
return xshandle().get_domain_path(domid)
+
+def ResumeDomain(domid):
+ return xshandle().resume_domain(domid)
diff -r fa960afcb0ac -r 204aa85417bd tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c Mon Jan 15 12:00:35 2007 -0800
+++ b/tools/xenstore/xenstored_core.c Mon Jan 15 12:01:27 2007 -0800
@@ -164,6 +164,7 @@ static char *sockmsg_string(enum xsd_soc
case XS_WATCH_EVENT: return "WATCH_EVENT";
case XS_ERROR: return "ERROR";
case XS_IS_DOMAIN_INTRODUCED: return "XS_IS_DOMAIN_INTRODUCED";
+ case XS_RESUME: return "RESUME";
default:
return "**UNKNOWN**";
}
@@ -1265,6 +1266,10 @@ static void process_message(struct conne
case XS_GET_DOMAIN_PATH:
do_get_domain_path(conn, onearg(in));
+ break;
+
+ case XS_RESUME:
+ do_resume(conn, onearg(in));
break;
default:
diff -r fa960afcb0ac -r 204aa85417bd tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Mon Jan 15 12:00:35 2007 -0800
+++ b/tools/xenstore/xenstored_domain.c Mon Jan 15 12:01:27 2007 -0800
@@ -395,6 +395,43 @@ void do_release(struct connection *conn,
send_ack(conn, XS_RELEASE);
}
+void do_resume(struct connection *conn, const char *domid_str)
+{
+ struct domain *domain;
+ unsigned int domid;
+
+ if (!domid_str) {
+ send_error(conn, EINVAL);
+ return;
+ }
+
+ domid = atoi(domid_str);
+ if (!domid) {
+ send_error(conn, EINVAL);
+ return;
+ }
+
+ if (conn->id != 0) {
+ send_error(conn, EACCES);
+ return;
+ }
+
+ domain = find_domain_by_domid(domid);
+ if (!domain) {
+ send_error(conn, ENOENT);
+ return;
+ }
+
+ if (!domain->conn) {
+ send_error(conn, EINVAL);
+ return;
+ }
+
+ domain->shutdown = 0;
+
+ send_ack(conn, XS_RESUME);
+}
+
void do_get_domain_path(struct connection *conn, const char *domid_str)
{
char *path;
diff -r fa960afcb0ac -r 204aa85417bd tools/xenstore/xenstored_domain.h
--- a/tools/xenstore/xenstored_domain.h Mon Jan 15 12:00:35 2007 -0800
+++ b/tools/xenstore/xenstored_domain.h Mon Jan 15 12:01:27 2007 -0800
@@ -32,6 +32,9 @@ void do_release(struct connection *conn,
void do_release(struct connection *conn, const char *domid_str);
/* domid */
+void do_resume(struct connection *conn, const char *domid_str);
+
+/* domid */
void do_get_domain_path(struct connection *conn, const char *domid_str);
/* Returns the event channel handle */
diff -r fa960afcb0ac -r 204aa85417bd tools/xenstore/xs.c
--- a/tools/xenstore/xs.c Mon Jan 15 12:00:35 2007 -0800
+++ b/tools/xenstore/xs.c Mon Jan 15 12:01:27 2007 -0800
@@ -719,6 +719,12 @@ bool xs_release_domain(struct xs_handle
return xs_bool(single_with_domid(h, XS_RELEASE, domid));
}
+/* clear the shutdown bit for the given domain */
+bool xs_resume_domain(struct xs_handle *h, unsigned int domid)
+{
+ return xs_bool(single_with_domid(h, XS_RESUME, domid));
+}
+
char *xs_get_domain_path(struct xs_handle *h, unsigned int domid)
{
char domid_str[MAX_STRLEN(domid)];
diff -r fa960afcb0ac -r 204aa85417bd tools/xenstore/xs.h
--- a/tools/xenstore/xs.h Mon Jan 15 12:00:35 2007 -0800
+++ b/tools/xenstore/xs.h Mon Jan 15 12:01:27 2007 -0800
@@ -133,6 +133,11 @@ bool xs_introduce_domain(struct xs_handl
unsigned int domid,
unsigned long mfn,
unsigned int eventchn);
+/* Resume a domain.
+ * Clear the shutdown flag for this domain in the store.
+ */
+bool xs_resume_domain(struct xs_handle *h, unsigned int domid);
+
/* Release a domain.
* Tells the store domain to release the memory page to the domain.
*/
diff -r fa960afcb0ac -r 204aa85417bd xen/include/public/io/xs_wire.h
--- a/xen/include/public/io/xs_wire.h Mon Jan 15 12:00:35 2007 -0800
+++ b/xen/include/public/io/xs_wire.h Mon Jan 15 12:01:27 2007 -0800
@@ -45,7 +45,8 @@ enum xsd_sockmsg_type
XS_SET_PERMS,
XS_WATCH_EVENT,
XS_ERROR,
- XS_IS_DOMAIN_INTRODUCED
+ XS_IS_DOMAIN_INTRODUCED,
+ XS_RESUME
};
#define XS_WRITE_NONE "NONE"
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|