ff4b346ede
disk fails with UnboundLocalError: local variable 'dev_type' referenced before assignment 21678-xend-mac-fix.patch - bnc#586221 - cannot add DomU with USB host controller defined domu-usb-controller.patch (Chun Yan Liu) - Upstream patches from Jan 21151-trace-bounds-check.patch 21627-cpuidle-wrap.patch 21643-vmx-vpmu-pmc-offset.patch 21682-trace-buffer-range.patch 21683-vtd-kill-timer-conditional.patch 21693-memevent-64bit-only.patch 21695-trace-t_info-readonly.patch 21698-x86-pirq-range-check.patch 21699-p2m-query-for-type-change.patch 21700-32on64-vm86-gpf.patch 21705-trace-printk.patch 21706-trace-security.patch 21712-amd-osvw.patch 21744-x86-cpufreq-range-check.patch - bnc #599550 - Xen cannot distinguish the status of 'pause' addcommand_domstate.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=63
173 lines
6.3 KiB
Diff
173 lines
6.3 KiB
Diff
Index: xen-4.0.0-testing/tools/python/xen/xend/XendDomain.py
|
|
===================================================================
|
|
--- xen-4.0.0-testing.orig/tools/python/xen/xend/XendDomain.py
|
|
+++ xen-4.0.0-testing/tools/python/xen/xend/XendDomain.py
|
|
@@ -251,6 +251,18 @@ class XendDomain:
|
|
@return: path to config file.
|
|
"""
|
|
return os.path.join(self._managed_path(domuuid), CACHED_CONFIG_FILE)
|
|
+ def domain_setpauseflag(self, dom, flag=False):
|
|
+ try:
|
|
+ dominfo = self.domain_lookup_nr(dom)
|
|
+ dominfo.paused_by_admin = flag
|
|
+ except Exception, err:
|
|
+ log.debug("error in in setpauseflag")
|
|
+ def domain_getpauseflag(self, dom):
|
|
+ try:
|
|
+ dominfo = self.domain_lookup_nr(dom)
|
|
+ return dominfo.paused_by_admin
|
|
+ except Exception, err:
|
|
+ log.debug("error in in getpauseflag")
|
|
|
|
def _managed_check_point_path(self, domuuid):
|
|
"""Returns absolute path to check point file for managed domain.
|
|
Index: xen-4.0.0-testing/tools/python/xen/xend/XendDomainInfo.py
|
|
===================================================================
|
|
--- xen-4.0.0-testing.orig/tools/python/xen/xend/XendDomainInfo.py
|
|
+++ xen-4.0.0-testing/tools/python/xen/xend/XendDomainInfo.py
|
|
@@ -329,7 +329,9 @@ class XendDomainInfo:
|
|
@type info: dictionary
|
|
@ivar domid: Domain ID (if VM has started)
|
|
@type domid: int or None
|
|
- @ivar guest_bitsize: the bitsize of guest
|
|
+ @ivar paused_by_admin: Is this Domain paused by command or API
|
|
+ @type paused_by_admin: bool
|
|
+ @ivar guest_bitsize: the bitsize of guest
|
|
@type guest_bitsize: int or None
|
|
@ivar alloc_mem: the memory domain allocated when booting
|
|
@type alloc_mem: int or None
|
|
@@ -392,6 +394,7 @@ class XendDomainInfo:
|
|
self.domid = domid
|
|
self.guest_bitsize = None
|
|
self.alloc_mem = None
|
|
+ self.paused_by_admin = False
|
|
|
|
maxmem = self.info.get('memory_static_max', 0)
|
|
memory = self.info.get('memory_dynamic_max', 0)
|
|
Index: xen-4.0.0-testing/tools/python/xen/xend/server/SrvDomain.py
|
|
===================================================================
|
|
--- xen-4.0.0-testing.orig/tools/python/xen/xend/server/SrvDomain.py
|
|
+++ xen-4.0.0-testing/tools/python/xen/xend/server/SrvDomain.py
|
|
@@ -250,6 +250,20 @@ class SrvDomain(SrvDir):
|
|
self.acceptCommand(req)
|
|
return self.xd.domain_reset(self.dom.getName())
|
|
|
|
+ def op_do_get_pauseflag(self, op, req):
|
|
+ self.acceptCommand(req)
|
|
+ return req.threadRequest(self.do_get_pauseflag, op, req)
|
|
+
|
|
+ def do_get_pauseflag(self, _, req):
|
|
+ return self.xd.domain_getpauseflag(self.dom.getName(), req)
|
|
+
|
|
+ def op_do_set_pauseflag(self, op, req):
|
|
+ self.acceptCommand(req)
|
|
+ return req.threadRequest(self.do_set_pauseflag, op, req)
|
|
+
|
|
+ def do_set_pauseflag(self, _, req):
|
|
+ return self.xd.domain_setpauseflag(self.dom.getName(), req)
|
|
+
|
|
def op_usb_add(self, op, req):
|
|
self.acceptCommand(req)
|
|
return req.threadRequest(self.do_usb_add, op, req)
|
|
Index: xen-4.0.0-testing/tools/python/xen/xm/main.py
|
|
===================================================================
|
|
--- xen-4.0.0-testing.orig/tools/python/xen/xm/main.py
|
|
+++ xen-4.0.0-testing/tools/python/xen/xm/main.py
|
|
@@ -174,6 +174,8 @@ SUBCOMMAND_HELP = {
|
|
#usb
|
|
'usb-add' : ('<domain> <[host:bus.addr] [host:vendor_id:product_id]>','Add the usb device to FV VM.'),
|
|
'usb-del' : ('<domain> <[host:bus.addr] [host:vendor_id:product_id]>','Delete the usb device to FV VM.'),
|
|
+ #domstate
|
|
+ 'domstate' : ('<domain> ', 'get the state of a domain'),
|
|
|
|
# device commands
|
|
|
|
@@ -409,6 +411,7 @@ common_commands = [
|
|
"uptime",
|
|
"usb-add",
|
|
"usb-del",
|
|
+ "domstate",
|
|
"vcpu-set",
|
|
]
|
|
|
|
@@ -447,6 +450,7 @@ domain_commands = [
|
|
"uptime",
|
|
"usb-add",
|
|
"usb-del",
|
|
+ "domstate",
|
|
"vcpu-list",
|
|
"vcpu-pin",
|
|
"vcpu-set",
|
|
@@ -1018,7 +1022,6 @@ def getDomains(domain_names, state, full
|
|
return "-"
|
|
state_str = "".join([state_on_off(state)
|
|
for state in states])
|
|
-
|
|
dom_rec.update({'name': dom_rec['name_label'],
|
|
'memory_actual': int(dom_metrics_rec['memory_actual'])/1024,
|
|
'vcpus': dom_metrics_rec['VCPUs_number'],
|
|
@@ -1527,8 +1530,10 @@ def xm_pause(args):
|
|
|
|
if serverType == SERVER_XEN_API:
|
|
server.xenapi.VM.pause(get_single_vm(dom))
|
|
+ server.xenapi.VM.set_pauseflag(get_single_vm(dom), True)
|
|
else:
|
|
server.xend.domain.pause(dom)
|
|
+ server.xend.domain.setpauseflag(dom, True)
|
|
|
|
def xm_unpause(args):
|
|
arg_check(args, "unpause", 1)
|
|
@@ -1536,8 +1541,10 @@ def xm_unpause(args):
|
|
|
|
if serverType == SERVER_XEN_API:
|
|
server.xenapi.VM.unpause(get_single_vm(dom))
|
|
+ server.xenapi.VM.set_pauseflag(get_single_vm(dom), False)
|
|
else:
|
|
server.xend.domain.unpause(dom)
|
|
+ server.xend.domain.setpauseflag(dom, False)
|
|
|
|
def xm_dump_core(args):
|
|
live = False
|
|
@@ -1647,6 +1654,32 @@ def xm_usb_add(args):
|
|
arg_check(args, "usb-add", 2)
|
|
server.xend.domain.usb_add(args[0],args[1])
|
|
|
|
+def xm_domstate(args):
|
|
+ arg_check(args, "domstate", 1)
|
|
+ (opitons, params) = getopt.gnu_getopt(args, 's', ['domname='])
|
|
+ doms = getDomains(params, 'all')
|
|
+ d = parse_doms_info(doms[0])
|
|
+ state = d['state']
|
|
+ if state:
|
|
+ if state.find('s') > 0:
|
|
+ print 'shutoff'
|
|
+ elif state.find('b') > 0:
|
|
+ print 'idle'
|
|
+ elif state.find('d') > 0:
|
|
+ print 'shutdown'
|
|
+ elif state.find('r') > 0:
|
|
+ print 'running'
|
|
+ elif state.find('c') > 0:
|
|
+ print 'crashed'
|
|
+ elif state.find('p') > 0:
|
|
+ if server.xend.domain.getpauseflag(args[0]):
|
|
+ print 'paused by admin'
|
|
+ else:
|
|
+ print 'paused'
|
|
+ else:
|
|
+ print 'shutoff'
|
|
+ return
|
|
+
|
|
def xm_usb_del(args):
|
|
arg_check(args, "usb-del", 2)
|
|
server.xend.domain.usb_del(args[0],args[1])
|
|
@@ -3859,6 +3892,8 @@ commands = {
|
|
#usb
|
|
"usb-add": xm_usb_add,
|
|
"usb-del": xm_usb_del,
|
|
+ #domstate
|
|
+ "domstate": xm_domstate,
|
|
}
|
|
|
|
## The commands supported by a separate argument parser in xend.xm.
|