aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/examples/xc_dom_control.py22
-rwxr-xr-xtools/examples/xc_dom_create.py2
-rwxr-xr-xtools/examples/xm_dom_control.py12
-rwxr-xr-xtools/examples/xm_dom_create.py2
-rw-r--r--tools/xc/lib/xc.h14
-rw-r--r--tools/xc/lib/xc_domain.c34
-rw-r--r--tools/xc/lib/xc_linux_build.c2
-rw-r--r--tools/xc/lib/xc_linux_restore.c9
-rw-r--r--tools/xc/lib/xc_linux_save.c12
-rw-r--r--tools/xc/lib/xc_netbsd_build.c2
-rw-r--r--tools/xc/lib/xc_private.c15
-rw-r--r--tools/xc/lib/xc_private.h5
-rw-r--r--tools/xc/py/Xc.c63
-rw-r--r--tools/xend/lib/domain_controller.h30
-rw-r--r--tools/xenmgr/lib/EventTypes.py4
-rw-r--r--tools/xenmgr/lib/XendClient.py8
-rw-r--r--tools/xenmgr/lib/XendDomain.py20
-rw-r--r--tools/xenmgr/lib/XendDomainInfo.py6
-rw-r--r--tools/xenmgr/lib/server/SrvDomain.py8
-rw-r--r--tools/xenmgr/lib/xm/create.py2
-rw-r--r--tools/xenmgr/lib/xm/main.py6
21 files changed, 122 insertions, 156 deletions
diff --git a/tools/examples/xc_dom_control.py b/tools/examples/xc_dom_control.py
index 5f74077b12..583d629c74 100755
--- a/tools/examples/xc_dom_control.py
+++ b/tools/examples/xc_dom_control.py
@@ -9,8 +9,8 @@ def usage ():
print >>sys.stderr, """
Usage: %s [command] <params>
- stop [dom] -- pause a domain
- start [dom] -- un-pause a domain
+ pause [dom] -- pause a domain
+ unpause [dom] -- un-pause a domain
shutdown [dom] [[-w]] -- request a domain to shutdown (can specify 'all')
(optionally wait for complete shutdown)
destroy [dom] -- immediately terminate a domain
@@ -45,21 +45,21 @@ dom = None
if len( sys.argv ) > 2 and re.match('\d+$', sys.argv[2]):
dom = int(sys.argv[2])
-if cmd == 'stop':
- rc = xc.domain_stop( dom=dom )
+if cmd == 'pause':
+ rc = xc.domain_pause( dom=dom )
-elif cmd == 'start':
- rc = xc.domain_start( dom=dom )
+elif cmd == 'unpause':
+ rc = xc.domain_unpause( dom=dom )
elif cmd == 'shutdown':
list = []
if dom != None:
- rc = xc.domain_destroy( dom=dom, force=0 )
+ rc = xc.domain_destroy( dom=dom ) # should be CMSG_SHUTDOWN
list.append(dom)
elif sys.argv[2] == 'all':
for i in xc.domain_getinfo():
if i['dom'] != 0: # don't shutdown dom0!
- ret = xc.domain_destroy( dom=i['dom'], force=0 )
+ ret = xc.domain_destroy( dom=i['dom'] ) # should be CMSG_SHUTDOWN
if ret !=0: rc = ret
else: list.append(i['dom'])
@@ -72,7 +72,7 @@ elif cmd == 'shutdown':
time.sleep(1)
elif cmd == 'destroy':
- rc = xc.domain_destroy( dom=dom, force=1 )
+ rc = xc.domain_destroy( dom=dom )
elif cmd == 'pincpu':
@@ -90,8 +90,8 @@ elif cmd == 'list':
run = (domain['running'] and 'r') or '-'
block = (domain['blocked'] and 'b') or '-'
- stop = (domain['stopped'] and 's') or '-'
- susp = (domain['suspended'] and 'S') or '-'
+ stop = (domain['paused'] and 'p') or '-'
+ susp = (domain['shutdown'] and 's') or '-'
crash = (domain['crashed'] and 'c') or '-'
domain['state'] = run + block + stop + susp + crash
diff --git a/tools/examples/xc_dom_create.py b/tools/examples/xc_dom_create.py
index 0b4ede8583..bb3f441894 100755
--- a/tools/examples/xc_dom_create.py
+++ b/tools/examples/xc_dom_create.py
@@ -364,7 +364,7 @@ def make_domain():
if not nlb: print >>open('/proc/sys/net/ipv4/ip_nonlocal_bind','w'), '0'
if not dontstart:
- if xc.domain_start( dom=id ) < 0:
+ if xc.domain_unpause( dom=id ) < 0:
print "Error starting domain"
xc.domain_destroy ( dom=id )
sys.exit()
diff --git a/tools/examples/xm_dom_control.py b/tools/examples/xm_dom_control.py
index d098ee4a24..0cb9b100af 100755
--- a/tools/examples/xm_dom_control.py
+++ b/tools/examples/xm_dom_control.py
@@ -25,8 +25,8 @@ def usage (rc=0):
Usage: %s [command] <params>
help -- print usage
- stop [dom] -- pause a domain
- start [dom] -- un-pause a domain
+ pause [dom] -- pause a domain
+ unpause [dom] -- un-pause a domain
shutdown [dom] [[-w]] -- request a domain to shutdown (can specify 'all')
(optionally wait for complete shutdown)
destroy [dom] -- immediately terminate a domain
@@ -89,11 +89,11 @@ if len( sys.argv ) > 2 and re.match('\d+$', sys.argv[2]):
if cmd == "help":
usage()
-elif cmd == 'stop':
- rc = server.xend_domain_stop(dom)
+elif cmd == 'pause':
+ rc = server.xend_domain_pause(dom)
-elif cmd == 'start':
- rc = server.xend_domain_start(dom)
+elif cmd == 'unpause':
+ rc = server.xend_domain_unpause(dom)
elif cmd == 'shutdown':
doms = []
diff --git a/tools/examples/xm_dom_create.py b/tools/examples/xm_dom_create.py
index 6c2f9674a7..d84efb1c92 100755
--- a/tools/examples/xm_dom_create.py
+++ b/tools/examples/xm_dom_create.py
@@ -305,7 +305,7 @@ def make_domain(config):
else:
console_port = None
- if server.xend_domain_start(dom) < 0:
+ if server.xend_domain_unpause(dom) < 0:
print "Error starting domain"
server.xend_domain_halt(dom)
sys.exit()
diff --git a/tools/xc/lib/xc.h b/tools/xc/lib/xc.h
index 1ca7ead8d0..274f2fdded 100644
--- a/tools/xc/lib/xc.h
+++ b/tools/xc/lib/xc.h
@@ -25,8 +25,9 @@ int xc_interface_close(int xc_handle);
typedef struct {
u32 domid;
unsigned int cpu;
- unsigned int dying:1, crashed:1, suspended:1,
- stopped:1, blocked:1, running:1;
+ unsigned int dying:1, crashed:1, shutdown:1,
+ paused:1, blocked:1, running:1;
+ unsigned int shutdown_reason; /* only meaningful if shutdown==1 */
unsigned long nr_pages;
unsigned long shared_info_frame;
u64 cpu_time;
@@ -40,13 +41,12 @@ int xc_domain_create(int xc_handle,
const char *name,
int cpu,
u32 *pdomid);
-int xc_domain_start(int xc_handle,
+int xc_domain_pause(int xc_handle,
u32 domid);
-int xc_domain_stop(int xc_handle,
- u32 domid);
+int xc_domain_unpause(int xc_handle,
+ u32 domid);
int xc_domain_destroy(int xc_handle,
- u32 domid,
- int force);
+ u32 domid);
int xc_domain_pincpu(int xc_handle,
u32 domid,
int cpu);
diff --git a/tools/xc/lib/xc_domain.c b/tools/xc/lib/xc_domain.c
index a0e222718d..ae4dff003d 100644
--- a/tools/xc/lib/xc_domain.c
+++ b/tools/xc/lib/xc_domain.c
@@ -30,34 +30,32 @@ int xc_domain_create(int xc_handle,
}
-int xc_domain_start(int xc_handle,
+int xc_domain_pause(int xc_handle,
u32 domid)
{
dom0_op_t op;
- op.cmd = DOM0_STARTDOMAIN;
- op.u.startdomain.domain = (domid_t)domid;
+ op.cmd = DOM0_PAUSEDOMAIN;
+ op.u.pausedomain.domain = (domid_t)domid;
return do_dom0_op(xc_handle, &op);
}
-int xc_domain_stop(int xc_handle,
- u32 domid)
+int xc_domain_unpause(int xc_handle,
+ u32 domid)
{
dom0_op_t op;
- op.cmd = DOM0_STOPDOMAIN;
- op.u.stopdomain.domain = (domid_t)domid;
+ op.cmd = DOM0_UNPAUSEDOMAIN;
+ op.u.unpausedomain.domain = (domid_t)domid;
return do_dom0_op(xc_handle, &op);
}
int xc_domain_destroy(int xc_handle,
- u32 domid,
- int force)
+ u32 domid)
{
dom0_op_t op;
op.cmd = DOM0_DESTROYDOMAIN;
op.u.destroydomain.domain = (domid_t)domid;
- op.u.destroydomain.force = !!force;
return do_dom0_op(xc_handle, &op);
}
@@ -94,12 +92,16 @@ int xc_domain_getinfo(int xc_handle,
info->cpu =
(op.u.getdomaininfo.flags>>DOMFLAGS_CPUSHIFT) & DOMFLAGS_CPUMASK;
- info->dying = (op.u.getdomaininfo.flags & DOMFLAGS_DYING);
- info->crashed = (op.u.getdomaininfo.flags & DOMFLAGS_CRASHED);
- info->suspended = (op.u.getdomaininfo.flags & DOMFLAGS_SUSPENDED);
- info->stopped = (op.u.getdomaininfo.flags & DOMFLAGS_STOPPED);
- info->blocked = (op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
- info->running = (op.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
+ info->dying = (op.u.getdomaininfo.flags & DOMFLAGS_DYING);
+ info->crashed = (op.u.getdomaininfo.flags & DOMFLAGS_CRASHED);
+ info->shutdown = (op.u.getdomaininfo.flags & DOMFLAGS_SHUTDOWN);
+ info->paused = (op.u.getdomaininfo.flags & DOMFLAGS_PAUSED);
+ info->blocked = (op.u.getdomaininfo.flags & DOMFLAGS_BLOCKED);
+ info->running = (op.u.getdomaininfo.flags & DOMFLAGS_RUNNING);
+
+ info->shutdown_reason =
+ (op.u.getdomaininfo.flags>>DOMFLAGS_SHUTDOWNSHIFT) &
+ DOMFLAGS_SHUTDOWNMASK;
info->nr_pages = op.u.getdomaininfo.tot_pages;
info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT-10);
diff --git a/tools/xc/lib/xc_linux_build.c b/tools/xc/lib/xc_linux_build.c
index 16d0dbb9d1..ceace01b00 100644
--- a/tools/xc/lib/xc_linux_build.c
+++ b/tools/xc/lib/xc_linux_build.c
@@ -436,7 +436,7 @@ int xc_linux_build(int xc_handle,
PERROR("Could not get info on domain");
goto error_out;
}
- if ( !(op.u.getdomaininfo.flags & DOMFLAGS_STOPPED) ||
+ if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
(ctxt->pt_base != 0) )
{
ERROR("Domain is already constructed");
diff --git a/tools/xc/lib/xc_linux_restore.c b/tools/xc/lib/xc_linux_restore.c
index 5900919e32..7387cddcf0 100644
--- a/tools/xc/lib/xc_linux_restore.c
+++ b/tools/xc/lib/xc_linux_restore.c
@@ -606,13 +606,8 @@ int xc_linux_restore(int xc_handle,
out:
- if ( rc != 0 )
- {
- if ( dom != 0 )
- {
- xc_domain_destroy( xc_handle, dom, 1 );
- }
- }
+ if ( (rc != 0) && (dom != 0) )
+ xc_domain_destroy(xc_handle, dom);
if ( mmu != NULL )
free(mmu);
diff --git a/tools/xc/lib/xc_linux_save.c b/tools/xc/lib/xc_linux_save.c
index 35fe92f32d..2d035ff7ea 100644
--- a/tools/xc/lib/xc_linux_save.c
+++ b/tools/xc/lib/xc_linux_save.c
@@ -273,10 +273,9 @@ int xc_linux_save(int xc_handle,
}
/* Ensure that the domain exists, and that it is stopped. */
-
- if ( xc_domain_stop_sync( xc_handle, domid, &op, &ctxt ) )
+ if ( xc_domain_pause(xc_handle, domid) )
{
- PERROR("Could not sync stop domain");
+ PERROR("Could not pause domain");
goto out;
}
@@ -381,9 +380,9 @@ int xc_linux_save(int xc_handle,
goto out;
}
- if ( xc_domain_start( xc_handle, domid ) < 0 )
+ if ( xc_domain_unpause(xc_handle, domid) < 0 )
{
- ERROR("Couldn't restart domain");
+ ERROR("Couldn't unpause domain");
goto out;
}
@@ -754,8 +753,7 @@ int xc_linux_save(int xc_handle,
DPRINTF("Start last iteration\n");
last_iter = 1;
- xc_domain_stop_sync( xc_handle, domid, &op, NULL );
-
+ xc_domain_pause(xc_handle, domid);
}
if ( xc_shadow_control( xc_handle, domid,
diff --git a/tools/xc/lib/xc_netbsd_build.c b/tools/xc/lib/xc_netbsd_build.c
index a0c73fa1bc..04a47b5068 100644
--- a/tools/xc/lib/xc_netbsd_build.c
+++ b/tools/xc/lib/xc_netbsd_build.c
@@ -258,7 +258,7 @@ int xc_netbsd_build(int xc_handle,
PERROR("Could not get info on domain");
goto error_out;
}
- if ( !(op.u.getdomaininfo.flags & DOMFLAGS_STOPPED) ||
+ if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
(op.u.getdomaininfo.ctxt->pt_base != 0) )
{
ERROR("Domain is already constructed");
diff --git a/tools/xc/lib/xc_private.c b/tools/xc/lib/xc_private.c
index ccf5f97299..344f48254d 100644
--- a/tools/xc/lib/xc_private.c
+++ b/tools/xc/lib/xc_private.c
@@ -199,19 +199,6 @@ int finish_mmu_updates(int xc_handle, mmu_t *mmu)
}
-/***********************************************************/
-
-/* this function is a hack until we get proper synchronous domain stop */
-
-int xc_domain_stop_sync( int xc_handle, domid_t domid,
- dom0_op_t *op, full_execution_context_t *ctxt)
-{
- op->cmd = DOM0_STOPDOMAIN;
- op->u.stopdomain.domain = (domid_t)domid;
- do_dom0_op(xc_handle, op);
- return 0;
-}
-
long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid )
{
dom0_op_t op;
@@ -229,8 +216,6 @@ long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid )
}
-/**********************************************************************/
-
/* This is shared between save and restore, and may generally be useful. */
unsigned long csum_page (void * page)
{
diff --git a/tools/xc/lib/xc_private.h b/tools/xc/lib/xc_private.h
index 6602cf7a9f..81213cff21 100644
--- a/tools/xc/lib/xc_private.h
+++ b/tools/xc/lib/xc_private.h
@@ -200,11 +200,6 @@ int mfn_mapper_flush_queue(mfn_mapper_t *t);
void * mfn_mapper_queue_entry(mfn_mapper_t *t, int offset,
unsigned long mfn, int size );
-/*********************/
-
-int xc_domain_stop_sync( int xc_handle, domid_t dom,
- dom0_op_t *op, full_execution_context_t *ctxt );
-
long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid );
#endif /* __XC_PRIVATE_H__ */
diff --git a/tools/xc/py/Xc.c b/tools/xc/py/Xc.c
index 2ece932085..1c6a90c1b4 100644
--- a/tools/xc/py/Xc.c
+++ b/tools/xc/py/Xc.c
@@ -55,7 +55,7 @@ static PyObject *pyxc_domain_create(PyObject *self,
return PyInt_FromLong(dom);
}
-static PyObject *pyxc_domain_start(PyObject *self,
+static PyObject *pyxc_domain_pause(PyObject *self,
PyObject *args,
PyObject *kwds)
{
@@ -68,16 +68,16 @@ static PyObject *pyxc_domain_start(PyObject *self,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
return NULL;
- if ( xc_domain_start(xc->xc_handle, dom) != 0 )
+ if ( xc_domain_pause(xc->xc_handle, dom) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
return zero;
}
-static PyObject *pyxc_domain_stop(PyObject *self,
- PyObject *args,
- PyObject *kwds)
+static PyObject *pyxc_domain_unpause(PyObject *self,
+ PyObject *args,
+ PyObject *kwds)
{
XcObject *xc = (XcObject *)self;
@@ -88,7 +88,7 @@ static PyObject *pyxc_domain_stop(PyObject *self,
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
return NULL;
- if ( xc_domain_stop(xc->xc_handle, dom) != 0 )
+ if ( xc_domain_unpause(xc->xc_handle, dom) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
@@ -102,15 +102,13 @@ static PyObject *pyxc_domain_destroy(PyObject *self,
XcObject *xc = (XcObject *)self;
u32 dom;
- int force = 0;
- static char *kwd_list[] = { "dom", "force", NULL };
+ static char *kwd_list[] = { "dom", NULL };
- if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
- &dom, &force) )
+ if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list, &dom) )
return NULL;
- if ( xc_domain_destroy(xc->xc_handle, dom, force) != 0 )
+ if ( xc_domain_destroy(xc->xc_handle, dom) != 0 )
return PyErr_SetFromErrno(xc_error);
Py_INCREF(zero);
@@ -166,19 +164,21 @@ static PyObject *pyxc_domain_getinfo(PyObject *self,
{
PyList_SetItem(
list, i,
- Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:l,s:L,s:s,s:l}",
+ Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
+ ",s:l,s:L,s:s,s:l,s:i}",
"dom", info[i].domid,
"cpu", info[i].cpu,
"dying", info[i].dying,
"crashed", info[i].crashed,
- "suspended", info[i].suspended,
- "stopped", info[i].stopped,
+ "shutdown", info[i].shutdown,
+ "paused", info[i].paused,
"blocked", info[i].blocked,
"running", info[i].running,
"mem_kb", info[i].nr_pages*4,
"cpu_time", info[i].cpu_time,
"name", info[i].name,
- "maxmem_kb", info[i].max_memkb
+ "maxmem_kb", info[i].max_memkb,
+ "shutdown_reason", info[i].shutdown_reason
));
}
@@ -270,7 +270,7 @@ static PyObject *pyxc_linux_save(PyObject *self,
if ( rc == 0 )
{
printf("Migration succesful -- destroy local copy\n");
- xc_domain_destroy( xc->xc_handle, dom, 1 );
+ xc_domain_destroy(xc->xc_handle, dom);
close(sd);
Py_INCREF(zero);
return zero;
@@ -281,7 +281,7 @@ static PyObject *pyxc_linux_save(PyObject *self,
serr:
printf("Migration failed -- restart local copy\n");
- xc_domain_start( xc->xc_handle, dom );
+ xc_domain_unpause(xc->xc_handle, dom);
PyErr_SetFromErrno(xc_error);
if ( sd >= 0 ) close(sd);
return NULL;
@@ -327,7 +327,7 @@ static PyObject *pyxc_linux_save(PyObject *self,
/* kill domain. We don't want to do this for checkpointing, but
if we don't do it here I think people will hurt themselves
by accident... */
- xc_domain_destroy( xc->xc_handle, dom, 1 );
+ xc_domain_destroy(xc->xc_handle, dom);
gzclose(gfd);
close(fd);
@@ -1015,26 +1015,25 @@ static PyMethodDef pyxc_methods[] = {
" name [str, '(anon)']: Informative textual name.\n\n"
"Returns: [int] new domain identifier; -1 on error.\n" },
- { "domain_start",
- (PyCFunction)pyxc_domain_start,
+ { "domain_pause",
+ (PyCFunction)pyxc_domain_pause,
METH_VARARGS | METH_KEYWORDS, "\n"
- "Start execution of a domain.\n"
- " dom [int]: Identifier of domain to be started.\n\n"
+ "Temporarily pause execution of a domain.\n"
+ " dom [int]: Identifier of domain to be paused.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
- { "domain_stop",
- (PyCFunction)pyxc_domain_stop,
+ { "domain_unpause",
+ (PyCFunction)pyxc_domain_unpause,
METH_VARARGS | METH_KEYWORDS, "\n"
- "Stop execution of a domain.\n"
- " dom [int]: Identifier of domain to be stopped.\n\n"
+ "(Re)start execution of a domain.\n"
+ " dom [int]: Identifier of domain to be unpaused.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_destroy",
(PyCFunction)pyxc_domain_destroy,
METH_VARARGS | METH_KEYWORDS, "\n"
"Destroy a domain.\n"
- " dom [int]: Identifier of domain to be destroyed.\n"
- " force [int, 0]: Bool - force immediate destruction?\n\n"
+ " dom [int]: Identifier of domain to be destroyed.\n\n"
"Returns: [int] 0 on success; -1 on error.\n" },
{ "domain_pincpu",
@@ -1059,13 +1058,15 @@ static PyMethodDef pyxc_methods[] = {
" cpu [int]: CPU to which this domain is bound\n"
" dying [int]: Bool - is the domain dying?\n"
" crashed [int]: Bool - has the domain crashed?\n"
- " suspended[int]: Bool - has the domain suspended itself?\n"
- " stopped [int]: Bool - is the domain stopped by control software?\n"
+ " shutdown [int]: Bool - has the domain shut itself down?\n"
+ " paused [int]: Bool - is the domain paused by control software?\n"
" blocked [int]: Bool - is the domain blocked waiting for an event?\n"
" running [int]: Bool - is the domain currently running?\n"
" mem_kb [int]: Memory reservation, in kilobytes\n"
" cpu_time [long]: CPU time consumed, in nanoseconds\n"
- " name [str]: Identifying name\n" },
+ " name [str]: Identifying name\n"
+ " shutdown_reason [int]: Numeric code from guest OS, explaining "
+ "reason why it shut itself down.\n" },
{ "linux_save",
(PyCFunction)pyxc_linux_save,
diff --git a/tools/xend/lib/domain_controller.h b/tools/xend/lib/domain_controller.h
index 8a9cea0664..76dd164fcb 100644
--- a/tools/xend/lib/domain_controller.h
+++ b/tools/xend/lib/domain_controller.h
@@ -29,13 +29,13 @@ typedef struct {
/*
- * Stop codes for SCHEDOP_suspend. These are opaque to Xen but interpreted by
- * control software to determine appropriate action.
+ * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
+ * interpreted by control software to determine the appropriate action. These
+ * are only really advisories: the controller can actually do as it likes.
*/
-
-#define STOPCODE_shutdown 0 /* Domain exited normally. Clean up and kill. */
-#define STOPCODE_reboot 1 /* Clean up, kill, and then restart. */
-#define STOPCODE_suspend 2 /* Clean up, save suspend info, kill. */
+#define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
+#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
+#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
/*
@@ -69,7 +69,6 @@ typedef struct {
#define CMSG_BLKIF_FE 2 /* Block-device frontend */
#define CMSG_NETIF_BE 3 /* Network-device backend */
#define CMSG_NETIF_FE 4 /* Network-device frontend */
-#define CMSG_SUSPEND 5 /* Suspend messages */
#define CMSG_SHUTDOWN 6 /* Shutdown messages */
@@ -519,24 +518,15 @@ typedef struct {
/******************************************************************************
- * SUSPEND DEFINITIONS
- */
-
-/*
- * Subtypes for suspend messages.
- */
-/* None. */
-
-
-/******************************************************************************
* SHUTDOWN DEFINITIONS
*/
/*
* Subtypes for shutdown messages.
*/
-#define CMSG_SHUTDOWN_HALT 0 /* Shutdown and halt (don't die). */
-#define CMSG_SHUTDOWN_POWEROFF 1 /* 'Poweroff' => clean death. */
-#define CMSG_SHUTDOWN_REBOOT 2 /* Shutdown and restart. */
+#define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */
+#define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */
+#define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */
+ /* SHUTDOWN_suspend. */
#endif /* __DOMAIN_CONTROLLER_H__ */
diff --git a/tools/xenmgr/lib/EventTypes.py b/tools/xenmgr/lib/EventTypes.py
index 3d4230e2ba..c8d5e62aa7 100644
--- a/tools/xenmgr/lib/EventTypes.py
+++ b/tools/xenmgr/lib/EventTypes.py
@@ -5,8 +5,8 @@
## xend.domain.destroy: dom, reason:died/crashed
## xend.domain.up ?
-## xend.domain.start: dom
-## xend.domain.stop: dom
+## xend.domain.unpause: dom
+## xend.domain.pause: dom
## xend.domain.shutdown: dom
## xend.domain.halt: dom
diff --git a/tools/xenmgr/lib/XendClient.py b/tools/xenmgr/lib/XendClient.py
index 7eec62290f..fb4a5b4421 100644
--- a/tools/xenmgr/lib/XendClient.py
+++ b/tools/xenmgr/lib/XendClient.py
@@ -187,13 +187,13 @@ class Xend:
def xend_domain(self, id):
return xend_get(self.domainurl(id))
- def xend_domain_start(self, id):
+ def xend_domain_unpause(self, id):
return xend_call(self.domainurl(id),
- {'op' : 'start'})
+ {'op' : 'unpause'})
- def xend_domain_stop(self, id):
+ def xend_domain_pause(self, id):
return xend_call(self.domainurl(id),
- {'op' : 'stop'})
+ {'op' : 'pause'})
def xend_domain_shutdown(self, id):
return xend_call(self.domainurl(id),
diff --git a/tools/xenmgr/lib/XendDomain.py b/tools/xenmgr/lib/XendDomain.py
index 9ed3c6370d..e37cb5d05c 100644
--- a/tools/xenmgr/lib/XendDomain.py
+++ b/tools/xenmgr/lib/XendDomain.py
@@ -192,18 +192,18 @@ class XendDomain:
self.refresh_domain(id)
return self.domain[id]
- def domain_start(self, id):
- """Start domain running.
+ def domain_unpause(self, id):
+ """(Re)start domain running.
"""
dom = int(id)
- eserver.inject('xend.domain.start', id)
- return xend.domain_start(dom)
+ eserver.inject('xend.domain.unpause', id)
+ return xc.domain_unpause(dom=dom)
- def domain_stop(self, id):
- """Stop domain running.
+ def domain_pause(self, id):
+ """Pause domain execution.
"""
dom = int(id)
- return xend.domain_stop(dom)
+ return xc.domain_pause(dom=dom)
def domain_shutdown(self, id):
"""Shutdown domain (nicely).
@@ -212,7 +212,7 @@ class XendDomain:
if dom <= 0:
return 0
eserver.inject('xend.domain.shutdown', id)
- val = xend.domain_destroy(dom, force=0)
+ val = xc.domain_destroy(dom=dom) # FIXME -- send CMSG_SHUTDOWN
self.refresh()
return val
@@ -223,7 +223,7 @@ class XendDomain:
if dom <= 0:
return 0
eserver.inject('xend.domain.halt', id)
- val = xend.domain_destroy(dom, force=1)
+ val = xc.domain_destroy(dom=dom)
self.refresh()
return val
@@ -237,7 +237,7 @@ class XendDomain:
"""Save domain state to file, halt domain.
"""
dom = int(id)
- self.domain_stop(id)
+ self.domain_pause(id)
eserver.inject('xend.domain.save', id)
rc = xc.linux_save(dom=dom, state_file=dst, progress=progress)
if rc == 0:
diff --git a/tools/xenmgr/lib/XendDomainInfo.py b/tools/xenmgr/lib/XendDomainInfo.py
index db636136a2..8283584f38 100644
--- a/tools/xenmgr/lib/XendDomainInfo.py
+++ b/tools/xenmgr/lib/XendDomainInfo.py
@@ -118,8 +118,8 @@ class XendDomainInfo:
if self.info:
run = (self.info['running'] and 'r') or '-'
block = (self.info['blocked'] and 'b') or '-'
- stop = (self.info['stopped'] and 's') or '-'
- susp = (self.info['suspended'] and 'S') or '-'
+ stop = (self.info['paused'] and 'p') or '-'
+ susp = (self.info['shutdown'] and 's') or '-'
crash = (self.info['crashed'] and 'c') or '-'
state = run + block + stop + susp + crash
sxpr.append(['cpu', self.info['cpu']])
@@ -177,7 +177,7 @@ class XendDomainInfo:
def destroy(self):
if self.dom <= 0:
return 0
- return xc.domain_destroy(dom=self.dom, force=1)
+ return xc.domain_destroy(dom=self.dom)
def show(self):
"""Print virtual machine info.
diff --git a/tools/xenmgr/lib/server/SrvDomain.py b/tools/xenmgr/lib/server/SrvDomain.py
index 0ef5676941..07d3cfa7de 100644
--- a/tools/xenmgr/lib/server/SrvDomain.py
+++ b/tools/xenmgr/lib/server/SrvDomain.py
@@ -18,12 +18,12 @@ class SrvDomain(SrvDir):
self.xd = XendDomain.instance()
self.xconsole = XendConsole.instance()
- def op_start(self, op, req):
- val = self.xd.domain_start(self.dom.id)
+ def op_unpause(self, op, req):
+ val = self.xd.domain_unpause(self.dom.id)
return val
- def op_stop(self, op, req):
- val = self.xd.domain_stop(self.dom.id)
+ def op_pause(self, op, req):
+ val = self.xd.domain_pause(self.dom.id)
return val
def op_shutdown(self, op, req):
diff --git a/tools/xenmgr/lib/xm/create.py b/tools/xenmgr/lib/xm/create.py
index a5e9e888c5..a365424acf 100644
--- a/tools/xenmgr/lib/xm/create.py
+++ b/tools/xenmgr/lib/xm/create.py
@@ -279,7 +279,7 @@ def make_domain(opts, config):
else:
console_port = None
- if server.xend_domain_start(dom) < 0:
+ if server.xend_domain_unpause(dom) < 0:
server.xend_domain_halt(dom)
opts.err("Failed to start domain %d" % dom)
opts.info("Started domain %d, console on port %d"
diff --git a/tools/xenmgr/lib/xm/main.py b/tools/xenmgr/lib/xm/main.py
index fb7d839f4a..f124d63518 100644
--- a/tools/xenmgr/lib/xm/main.py
+++ b/tools/xenmgr/lib/xm/main.py
@@ -143,11 +143,11 @@ class Xm:
"""Pause execution of a domain."""
if help:
print args[0], 'DOM'
- print '\nStop execution of domain DOM.'
+ print '\nPause execution of domain DOM.'
return
if len(args) < 2: self.err("%s: Missing domain" % args[0])
dom = args[1]
- server.xend_domain_stop(dom)
+ server.xend_domain_pause(dom)
def xm_unpause(self, help, args):
"""Unpause a paused domain."""
@@ -157,7 +157,7 @@ class Xm:
return
if len(args) < 2: self.err("%s: Missing domain" % args[0])
dom = args[1]
- server.xend_domain_start(dom)
+ server.xend_domain_unpause(dom)
def xm_pincpu(self, help, args):
"""Pin a domain to a cpu. """