bitkeeper revision 1.1041.17.1 (40ec2bcdVkWjir8BhuFahaTuaVaDeQ)

Merge http://xen.bkbits.net/xeno-unstable.bk
into gandalf.hpl.hp.com:/var/bk/djm/xeno-unstable-common.bk
This commit is contained in:
xenbk@gandalf.hpl.hp.com committed 2004-07-07 16:58:53 +00:00
commit e758760be9
8 files changed
+530 -108

No files matched your search

@@ -220,9 +220,11 @@ int blkif_disconnect(blkif_be_disconnect_t *disconnect, u8 rsp_id)
free_irq(blkif->irq, blkif);
blkif_deschedule(blkif);
blkif_put(blkif);
return 0; /* Caller should not send response message. */
}
return 0; /* Caller should not send response message. */
disconnect->status = BLKIF_BE_STATUS_OKAY;
return 1;
}
void __init blkif_interface_init(void)
@@ -21,7 +21,7 @@
#define ASSERT(_p) \
if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
__LINE__, __FILE__); *(int*)0=0; }
#define DPRINTK(_f, _a...) printk("(file=%s, line=%d) " _f, \
#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
#else
#define ASSERT(_p) ((void)0)
@@ -269,9 +269,11 @@ int netif_disconnect(netif_be_disconnect_t *disconnect, u8 rsp_id)
free_irq(netif->irq, netif);
netif_deschedule(netif);
netif_put(netif);
return 0; /* Caller should not send response message. */
}
return 0; /* Caller should not send response message. */
disconnect->status = NETIF_BE_STATUS_OKAY;
return 1;
}
void netif_interface_init(void)
@@ -17,6 +17,13 @@
#include <asm/ctrl_if.h>
#include <asm/evtchn.h>
#if 0
#define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
__FILE__ , __LINE__ , ## _a )
#else
#define DPRINTK(_f, _a...) ((void)0)
#endif
/*
* Only used by initial domain which must create its own control-interface
* event channel. This value is picked up by the user-space domain controller
@@ -86,6 +93,11 @@ static void __ctrl_if_tx_tasklet(unsigned long data)
{
msg = &ctrl_if->tx_ring[MASK_CONTROL_IDX(ctrl_if_tx_resp_cons)];
DPRINTK("Rx-Rsp %u/%u :: %d/%d\n",
ctrl_if_tx_resp_cons,
ctrl_if->tx_resp_prod,
msg->type, msg->subtype);
/* Execute the callback handler, if one was specified. */
if ( msg->id != 0xFF )
{
@@ -131,8 +143,15 @@ static void __ctrl_if_rx_tasklet(unsigned long data)
{
pmsg = &ctrl_if->rx_ring[MASK_CONTROL_IDX(ctrl_if_rx_req_cons++)];
memcpy(&msg, pmsg, offsetof(ctrl_msg_t, msg));
DPRINTK("Rx-Req %u/%u :: %d/%d\n",
ctrl_if_rx_req_cons-1,
ctrl_if->rx_req_prod,
msg.type, msg.subtype);
if ( msg.length != 0 )
memcpy(msg.msg, pmsg->msg, msg.length);
if ( test_bit(msg.type, &ctrl_if_rxmsg_blocking_context) )
{
pmsg = &ctrl_if_rxmsg_deferred[MASK_CONTROL_IDX(
@@ -185,6 +204,11 @@ int ctrl_if_send_message_noblock(
msg->id = i;
}
DPRINTK("Tx-Req %u/%u :: %d/%d\n",
ctrl_if->tx_req_prod,
ctrl_if_tx_resp_cons,
msg->type, msg->subtype);
memcpy(&ctrl_if->tx_ring[MASK_CONTROL_IDX(ctrl_if->tx_req_prod)],
msg, sizeof(*msg));
wmb(); /* Write the message before letting the controller peek at it. */
@@ -262,11 +286,18 @@ void ctrl_if_send_response(ctrl_msg_t *msg)
* In this situation we may have src==dst, so no copying is required.
*/
spin_lock_irqsave(&ctrl_if_lock, flags);
DPRINTK("Tx-Rsp %u :: %d/%d\n",
ctrl_if->rx_resp_prod,
msg->type, msg->subtype);
dmsg = &ctrl_if->rx_ring[MASK_CONTROL_IDX(ctrl_if->rx_resp_prod)];
if ( dmsg != msg )
memcpy(dmsg, msg, sizeof(*msg));
wmb(); /* Write the message before letting the controller peek at it. */
ctrl_if->rx_resp_prod++;
spin_unlock_irqrestore(&ctrl_if_lock, flags);
ctrl_if_notify_controller();
+12 -15
View File
@@ -292,9 +292,6 @@ def vm_restore(src, progress=0):
if dom < 0:
raise VmError('restore failed')
vmconfig = sxp.from_string(d['vmconfig'])
if not vmconfig:
raise VmError('bad vmconfig s-expression')
vmconfig = vmconfig[0]
vm.config = sxp.child_value(vmconfig, 'config')
deferred = vm.dom_configure(dom)
def vifs_cb(val, vm):
@@ -423,8 +420,8 @@ class XendDomainInfo:
self.config = config
try:
self.name = sxp.child_value(config, 'name')
self.memory = int(sxp.child_value(config, 'memory') or '128')
if sxp.child(config, 'autorestart'):
self.memory = int(sxp.child_value(config, 'memory', '128'))
if sxp.child(config, 'autorestart', None):
self.autorestart = 1
self.configure_backends()
image = sxp.child_value(config, 'image')
@@ -457,7 +454,7 @@ class XendDomainInfo:
"""
devices = []
for d in sxp.children(self.config, 'device'):
dev = sxp.child(d)
dev = sxp.child0(d)
if dev is None: continue
if name == sxp.name(dev):
devices.append(dev)
@@ -588,7 +585,7 @@ class XendDomainInfo:
if self.recreate: return
memory = self.memory
name = self.name
cpu = int(sxp.child_value(self.config, 'cpu') or '-1')
cpu = int(sxp.child_value(self.config, 'cpu', '-1'))
print 'init_domain>', memory, name, cpu
dom = xc.domain_create(mem_kb= memory * 1024, name= name, cpu= cpu)
if dom <= 0:
@@ -653,7 +650,7 @@ class XendDomainInfo:
devices = sxp.children(self.config, 'device')
index = {}
for d in devices:
dev = sxp.child(d)
dev = sxp.child0(d)
if dev is None:
raise VmError('invalid device')
dev_name = sxp.name(dev)
@@ -672,7 +669,7 @@ class XendDomainInfo:
"""Set configuration flags if the vm is a backend for netif of blkif.
"""
for c in sxp.children(self.config, 'backend'):
name = sxp.name(sxp.child(c))
name = sxp.name(sxp.child0(c))
if name == 'blkif':
self.blkif_backend = 1
elif name == 'netif':
@@ -754,7 +751,7 @@ def vm_image_linux(vm, image):
"""
kernel = sxp.child_value(image, "kernel")
cmdline = ""
ip = sxp.child_value(image, "ip") or "dhcp"
ip = sxp.child_value(image, "ip", "dhcp")
if ip:
cmdline += " ip=" + ip
root = sxp.child_value(image, "root")
@@ -763,7 +760,7 @@ def vm_image_linux(vm, image):
args = sxp.child_value(image, "args")
if args:
cmdline += " " + args
ramdisk = sxp.child_value(image, "ramdisk") or ''
ramdisk = sxp.child_value(image, "ramdisk", '')
vifs = vm.config_devices("vif")
vm.create_domain("linux", kernel, ramdisk, cmdline, len(vifs))
return vm
@@ -780,7 +777,7 @@ def vm_image_netbsd(vm, image):
#todo: Same as for linux. Is that right? If so can unify them.
kernel = sxp.child_value(image, "kernel")
cmdline = ""
ip = sxp.child_value(image, "ip") or "dhcp"
ip = sxp.child_value(image, "ip", "dhcp")
if ip:
cmdline += "ip=" + ip
root = sxp.child_value(image, "root")
@@ -809,7 +806,7 @@ def vm_dev_vif(vm, val, index):
defer = make_vif(vm.dom, vif, vmac, vm.recreate)
def fn(id):
dev = xend.netif_dev(vm.dom, vif)
devid = sxp.child_value(val, 'id')
devid = sxp.attribute(val, 'id')
if devid:
dev.setprop('id', devid)
bridge = sxp.child_value(val, "bridge")
@@ -836,7 +833,7 @@ def vm_dev_vbd(vm, val, index):
dev = sxp.child_value(val, 'dev')
if not dev:
raise VmError('vbd: Missing dev')
mode = sxp.child_value(val, 'mode') or 'r'
mode = sxp.child_value(val, 'mode', 'r')
defer = make_disk(vm.dom, uname, dev, mode, vm.recreate)
def fn(vbd):
dev = xend.blkif_dev(vm.dom, vdev)
@@ -938,7 +935,7 @@ def vm_field_vnet(vm, config, val, index):
if id is None:
raise VmError('vnet: missing vif id')
dev = vm.get_device_by_id('vif', id)
#vnet = sxp.child_value(v, 'vnet') or '1'
#vnet = sxp.child_value(v, 'vnet', 1)
#mac = sxp.child_value(dev, 'mac')
#vif = sxp.child_value(dev, 'vif')
#vnet_bridge(vnet, mac, vm.dom, 0)
+1 -1
View File
@@ -145,7 +145,7 @@ class XendRoot:
val default value (optional, defaults to None)
returns value
"""
return sxp.child_value(self.config, name) or val
return sxp.child_value(self.config, name, val=val)
def instance():
global inst
+471 -81
View File
@@ -21,19 +21,56 @@ from StringIO import StringIO
__all__ = [
"mime_type",
"ParseError",
"Parser",
"show",
"Parser",
"atomp",
"show",
"show_xml",
"elementp",
"name",
"attributes",
"attribute",
"children",
"child",
"child_at",
"child0",
"child1",
"child2",
"child3",
"child4",
"child_value",
"has_id",
"with_id",
"child_with_id",
"elements",
"to_string",
"from_string",
"all_from_string",
"parse",
]
mime_type = "application/sxp"
escapes = {
'a': '\a',
'b': '\b',
't': '\t',
'n': '\n',
'v': '\v',
'f': '\f',
'r': '\r',
'\\': '\\',
'\'': '\'',
'\"': '\"'}
k_list_open = "("
k_list_close = ")"
k_attr_open = "@"
k_eval = "!"
escapes_rev = {}
for k in escapes:
escapes_rev[escapes[k]] = k
class ParseError(StandardError):
def __init__(self, parser, value):
@@ -49,6 +86,7 @@ class ParserState:
self.parent = parent
self.buf = ''
self.val = []
self.delim = None
self.fn = fn
def push(self, fn):
@@ -57,19 +95,28 @@ class ParserState:
class Parser:
def __init__(self):
self.error = sys.stderr
self.reset()
def reset(self):
self.val = []
self.eof = 0
self.err = 0
self.line_no = 0
self.char_no = 0
self.state = self.start_state = ParserState(self.state_start)
self.state = None
def push_state(self, fn):
self.state = self.state.push(fn)
def pop_state(self):
val = self.state
self.state = self.state.parent
if self.state and self.state.fn == self.state_start:
# Return to start state - produce the value.
self.val += self.state.val
self.state.val = []
return val
def in_class(self, c, s):
return s.find(c) >= 0
@@ -89,6 +136,12 @@ class Parser:
def in_printable_class(self, c):
return self.in_class(c, string.printable)
def set_error_stream(self, error):
self.error = error
def has_error(self):
return self.err > 0
def at_eof(self):
return self.eof
@@ -113,131 +166,439 @@ class Parser:
self.char_no += 1
if self.state is None:
self.state = ParserState(self.state_start)
self.begin_start(None)
self.state.fn(c)
def ready(self):
return len(self.start_state.val) > 0
return len(self.val) > 0
def get_val(self):
v = self.start_state.val[0]
self.start_state.val = self.start_state.val[1:]
v = self.val[0]
self.val = self.val[1:]
return v
def get_all(self):
return self.start_state.val
return self.val
def begin_start(self, c):
self.state = ParserState(self.state_start)
def end_start(self):
self.val += self.state.val
self.pop_state()
def state_start(self, c):
if self.at_eof() or self.in_space_class(c):
if self.at_eof():
self.end_start()
elif self.in_space_class(c):
pass
elif self.in_comment_class(c):
self.push_state(self.state_comment)
elif c == '(':
self.push_state(self.state_list)
elif c == ')':
self.begin_comment(c)
elif c == k_list_open:
self.begin_list(c)
elif c == k_list_close:
raise ParseError(self, "syntax error: "+c)
elif self.in_string_quote_class(c):
self.push_state(self.state_string)
self.state.buf = c
self.begin_string(c)
elif self.in_printable_class(c):
self.push_state(self.state_atom)
self.state.buf = c
self.begin_atom(c)
elif c == chr(4):
# ctrl-D, EOT: end-of-text.
self.input_eof()
else:
raise ParseError(self, "invalid character: code %d" % ord(c))
def begin_comment(self, c):
self.push_state(self.state_comment)
self.state.buf += c
def end_comment(self):
self.pop_state()
def state_comment(self, c):
if c == '\n' or self.at_eof():
self.pop_state()
self.end_comment()
else:
self.state.buf += c
def begin_string(self, c):
self.push_state(self.state_string)
self.state.delim = c
def end_string(self):
val = self.state.buf
self.state.parent.val.append(val)
self.pop_state()
def state_string(self, c):
if self.at_eof():
raise ParseError(self, "unexpected EOF")
self.state.buf += c
# Look out for non-escaped end delimiter
if self.state.buf[0] == c and self.state.buf[-2] != '\\':
try: # parse escape sequences but fall back to something simple
val = eval(compile(self.state.buf,'','eval'))
except:
val = self.state.buf[1:-1] # just strip the delimiters
self.state.parent.val.append(val)
self.pop_state()
def state_atom(self, c):
if (self.at_eof() or
self.is_separator(c) or
self.in_space_class(c) or
self.in_comment_class(c)):
val = self.state.buf
self.state.parent.val.append(val)
self.pop_state()
if not self.at_eof():
self.input_char(c)
elif c == self.state.delim:
self.end_string()
elif c == '\\':
self.push_state(self.state_escape)
else:
self.state.buf += c
def state_escape(self, c):
if self.at_eof():
raise ParseError(self, "unexpected EOF")
d = escapes.get(c)
if d:
self.state.parent.buf += d
self.pop_state()
elif c == 'x':
self.state.fn = self.state_hex
self.state.val = 0
else:
self.state.fn = self.state_octal
self.state.val = 0
self.input_char(c)
def state_octal(self, c):
def octaldigit(c):
self.state.val *= 8
self.state.val += ord(c) - ord('0')
self.state.buf += c
if self.state.val < 0 or self.state.val > 0xff:
raise ParseError(self, "invalid octal escape: out of range " + self.state.buf)
if len(self.state.buf) == 3:
octaldone()
def octaldone():
d = chr(self.state.val)
self.state.parent.buf += d
self.pop_state()
if self.at_eof():
raise ParseError(self, "unexpected EOF")
elif '0' <= c <= '7':
octaldigit(c)
elif len(self.buf):
octaldone()
self.input_char(c)
def state_hex(self, c):
def hexdone():
d = chr(self.state.val)
self.state.parent.buf += d
self.pop_state()
def hexdigit(c, d):
self.state.val *= 16
self.state.val += ord(c) - ord(d)
self.state.buf += c
if self.state.val < 0 or self.state.val > 0xff:
raise ParseError(self, "invalid hex escape: out of range " + self.state.buf)
if len(self.state.buf) == 2:
hexdone()
if self.at_eof():
raise ParseError(self, "unexpected EOF")
elif '0' <= c <= '9':
hexdigit(c, '0')
elif 'A' <= c <= 'F':
hexdigit(c, 'A')
elif 'a' <= c <= 'f':
hexdigit(c, 'a')
elif len(buf):
hexdone()
self.input_char(c)
def begin_atom(self, c):
self.push_state(self.state_atom)
self.state.buf = c
def end_atom(self):
val = self.state.buf
self.state.parent.val.append(val)
self.pop_state()
def state_atom(self, c):
if self.at_eof():
self.end_atom()
elif (self.is_separator(c) or
self.in_space_class(c) or
self.in_comment_class(c)):
self.end_atom()
self.input_char(c)
else:
self.state.buf += c
def begin_list(self, c):
self.push_state(self.state_list)
def end_list(self):
val = self.state.val
self.state.parent.val.append(val)
self.pop_state()
def state_list(self, c):
if self.at_eof():
raise ParseError(self, "unexpected EOF")
elif c == ')':
val = self.state.val
self.state.parent.val.append(val)
self.pop_state()
elif c == k_list_close:
self.end_list()
else:
self.state_start(c)
def atomp(sxpr):
"""Check if an sxpr is an atom.
"""
if sxpr.isalnum() or sxpr == '@':
return 1
for c in sxpr:
if c in string.whitespace: return 0
if c in '"\'\\(){}[]<>$#&%^': return 0
if c in string.ascii_letters: continue
if c in string.digits: continue
if c in '.-_:/~': continue
return 0
return 1
def show(sxpr, out=sys.stdout):
"""Print an sxpr in bracketed (lisp-style) syntax.
"""
if isinstance(sxpr, types.ListType):
out.write('(')
out.write(k_list_open)
i = 0
for x in sxpr:
if i: out.write(' ')
show(x, out)
out.write(' ')
out.write(')')
i += 1
out.write(k_list_close)
elif isinstance(sxpr, types.StringType) and atomp(sxpr):
out.write(sxpr)
else:
#out.write("'" + str(sxpr) + "'")
out.write(repr(str(sxpr)))
def name(sxpr):
"""Get the element name of an sxpr, or None if a bad sxpr.
def show_xml(sxpr, out=sys.stdout):
"""Print an sxpr in XML syntax.
"""
if isinstance(sxpr, types.StringType):
return sxpr
if isinstance(sxpr, types.ListType) and len(sxpr):
return sxpr[0]
return None
if isinstance(sxpr, types.ListType):
element = name(sxpr)
out.write('<%s' % element)
for attr in attributes(sxpr):
out.write(' %s=%s' % (attr[0], attr[1]))
out.write('>')
i = 0
for x in children(sxpr):
if i: out.write(' ')
show_xml(x, out)
i += 1
out.write('</%s>' % element)
elif isinstance(sxpr, types.StringType) and atomp(sxpr):
out.write(sxpr)
else:
out.write(str(sxpr))
def children(sxpr, elt=None):
"""Get children of an s-expression @sxpr, optionally filtered by
element type @elt.
def elementp(sxpr, elt=None):
"""Check if an sxpr is an element of the given type.
sxpr sxpr
elt element type
"""
if not isinstance(sxpr, types.ListType): return []
val = filter(lambda x: isinstance(x, types.ListType) and len(x) > 0, sxpr)
if elt:
val = filter(lambda x,y=elt: x[0] == y, val)
return (isinstance(sxpr, types.ListType)
and len(sxpr)
and (None == elt or sxpr[0] == elt))
def name(sxpr):
"""Get the element name of an sxpr.
If the sxpr is not an element (i.e. it's an atomic value) its name
is None.
sxpr
returns name (None if not an element).
"""
val = None
if isinstance(sxpr, types.StringType):
val = sxpr
elif isinstance(sxpr, types.ListType) and len(sxpr):
val = sxpr[0]
return val
def child(sxpr, elt=None, idx=0):
"""Get the @idx'th child of the optional filtering type @elt in @sxpr.
"""
x = children(sxpr, elt)
if len(x) > idx:
return x[idx]
return None
def attributes(sxpr):
"""Get the attribute list of an sxpr.
def child_value(sxpr, elt=None):
"""Get the value of the first child of @sxpr with the optional type @elt.
sxpr
returns attribute list
"""
x = child(sxpr, elt)
if not isinstance(x, types.ListType) or len(x) < 2:
return None
return x[1]
val = []
if isinstance(sxpr, types.ListType) and len(sxpr) > 1:
attr = sxpr[1]
if elementp(attr, k_attr_open):
val = attr[1:]
return val
def attribute(sxpr, key, val=None):
"""Get an attribute of an sxpr.
sxpr sxpr
key attribute key
val default value (default None)
returns attribute value
"""
for x in attributes(sxpr):
if x[0] == key:
val = x[1]
break
return val
def children(sxpr, elt=None):
"""Get children of an sxpr.
sxpr sxpr
elt optional element type to filter by
returns children (filtered by elt if specified)
"""
val = []
if isinstance(sxpr, types.ListType) and len(sxpr) > 1:
i = 1
x = sxpr[i]
if elementp(x, k_attr_open):
i += 1
val = sxpr[i : ]
if elt:
def iselt(x):
return elementp(x, elt)
val = filter(iselt, val)
return val
def child(sxpr, elt, val=None):
"""Get the first child of the given element type.
sxpr sxpr
elt element type
val default value
"""
for x in children(sxpr):
if elementp(x, elt):
val = x
break
return val
def child_at(sxpr, index, val=None):
"""Get the child at the given index (zero-based).
sxpr sxpr
index index
val default value
"""
kids = children(sxpr)
if len(kids) > index:
val = kids[index]
return val
def child0(sxpr, val=None):
"""Get the zeroth child.
"""
return child_at(sxpr, 0, val)
def child1(sxpr, val=None):
"""Get the first child.
"""
return child_at(sxpr, 1, val)
def child2(sxpr, val=None):
"""Get the second child.
"""
return child_at(sxpr, 2, val)
def child3(sxpr, val=None):
"""Get the third child.
"""
return child_at(sxpr, 3, val)
def child4(sxpr, val=None):
"""Get the fourth child.
"""
return child_at(sxpr, 4, val)
def child_value(sxpr, elt, val=None):
"""Get the value of the first child of the given element type.
Assumes the child has an atomic value.
sxpr sxpr
elt element type
val default value
"""
kid = child(sxpr, elt)
if kid:
val = child_at(kid, 0, val)
return val
def has_id(sxpr, id):
"""Test if an s-expression has a given id.
"""
return attribute(sxpr, 'id') == id
def with_id(sxpr, id, val=None):
"""Find the first s-expression with a given id, at any depth.
sxpr s-exp or list
id id
val value if not found (default None)
return s-exp or val
"""
if isinstance(sxpr, types.ListType):
for n in sxpr:
if has_id(n, id):
val = n
break
v = with_id(n, id)
if v is None: continue
val = v
break
return val
def child_with_id(sxpr, id, val=None):
"""Find the first child with a given id.
sxpr s-exp or list
id id
val value if not found (default None)
return s-exp or val
"""
if isinstance(sxpr, types.ListType):
for n in sxpr:
if has_id(n, id):
val = n
break
return val
def elements(sxpr, ctxt=None):
"""Generate elements (at any depth).
Visit elements in pre-order.
Values generated are (node, context)
The context is None if there is no parent, otherwise
(index, parent, context) where index is the node's index w.r.t its parent,
and context is the parent's context.
sxpr s-exp
returns generator
"""
yield (sxpr, ctxt)
i = 0
for n in children(sxpr):
if isinstance(n, types.ListType):
# Calling elements() recursively does not generate recursively,
# it just returns a generator object. So we must iterate over it.
for v in elements(n, (i, sxpr, ctxt)):
yield v
i += 1
def to_string(sxpr):
"""Convert an s-expression @sxpr to a string.
"""Convert an sxpr to a string.
sxpr sxpr
returns string
"""
io = StringIO()
show(sxpr, io)
@@ -247,14 +608,35 @@ def to_string(sxpr):
return val
def from_string(str):
"""Create an sxpr list from a given input string @str.
"""Create an sxpr by parsing a string.
str string
returns sxpr
"""
io = StringIO(str)
vals = parse(io)
if vals is []:
return None
else:
return vals[0]
def all_from_string(str):
"""Create an sxpr list by parsing a string.
str string
returns sxpr list
"""
io = StringIO(str)
vals = parse(io)
return vals
def parse(io):
"""Completely parse all input from file @io.
"""Completely parse all input from 'io'.
io input file object
returns list of values, None if incomplete
raises ParseError on parse error
"""
pin = Parser()
while 1:
@@ -267,11 +649,19 @@ def parse(io):
else:
val = None
return val
if __name__ == '__main__':
print ">main"
pin = Parser()
buf = sys.stdin.read(1024)
pin.input(buf)
while pin.ready():
print '\n****** val=', pin.get_val()
while 1:
buf = sys.stdin.read(1024)
#buf = sys.stdin.readline()
pin.input(buf)
while pin.ready():
val = pin.get_val()
print
print '****** val=', val
if len(buf) == 0:
break
+8 -8
View File
@@ -246,11 +246,11 @@ class ProgList(Prog):
info = server.xend_domain(dom)
d = {}
d['dom'] = int(dom)
d['name'] = sxp.child_value(info, 'name') or '??'
d['mem'] = int(sxp.child_value(info, 'memory') or '-1')
d['cpu'] = int(sxp.child_value(info, 'cpu') or '-1')
d['state'] = sxp.child_value(info, 'state') or '??'
d['cpu_time'] = float(sxp.child_value(info, 'cpu_time') or '-1')
d['name'] = sxp.child_value(info, 'name', '??')
d['mem'] = int(sxp.child_value(info, 'memory', '0'))
d['cpu'] = int(sxp.child_value(info, 'cpu', '0'))
d['state'] = sxp.child_value(info, 'state', '??')
d['cpu_time'] = float(sxp.child_value(info, 'cpu_time', '0'))
print ("%(dom)-4d %(name)-16s %(mem)7d %(cpu)3d %(state)5s %(cpu_time)7.1f" % d)
def long_list(self, doms):
@@ -424,9 +424,9 @@ class ProgConsoles(Prog):
for x in l:
info = server.xend_console(x)
d = {}
d['dom'] = (sxp.child(info, 'dst') or ['dst', '?', '?'])[1]
d['port'] = sxp.child_value(info, 'port') or '?'
d['id'] = sxp.child_value(info, 'id') or '?'
d['dom'] = sxp.child(info, 'dst', ['dst', '?', '?'])[1]
d['port'] = sxp.child_value(info, 'port', '?')
d['id'] = sxp.child_value(info, 'id', '?')
print "%(dom)3s %(port)4s %(id)3s" % d
xm.prog(ProgConsoles)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.