mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
bitkeeper revision 1.1075 (40f3d929OFHwDCndxHCAhHnmUAclPg)
Improve error trapping in xm. Allow nfs_server to override dummy addr.
This commit is contained in:
1 parent
6d83f76bb1
commit
634b06df4c
4 files changed
+11
-10
No files matched your search
@@ -107,11 +107,11 @@ class Args:
|
||||
|
||||
def call_with_args(self, fn, args, xargs=None):
|
||||
(params, keys) = self.get_args(args, xargs=xargs)
|
||||
fn(*params, **keys)
|
||||
return fn(*params, **keys)
|
||||
|
||||
def call_with_form_args(self, fn, fargs, xargs=None):
|
||||
(params, keys) = self.get_form_args(fargs, xargs=xargs)
|
||||
fn(*params, **keys)
|
||||
return fn(*params, **keys)
|
||||
|
||||
class ArgFn(Args):
|
||||
"""Represent a remote HTTP operation as a function.
|
||||
|
||||
@@ -136,7 +136,7 @@ def xend_request(url, method, data=None):
|
||||
#if isinstance(val, types.ListType) and sxp.name(val) == 'val':
|
||||
# val = val[1]
|
||||
if isinstance(val, types.ListType) and sxp.name(val) == 'err':
|
||||
raise RuntimeError(val[1])
|
||||
raise XendError(val[1])
|
||||
if DEBUG: print '**val='; sxp.show(val); print
|
||||
return val
|
||||
|
||||
|
||||
@@ -347,8 +347,9 @@ def preprocess_ip(opts, vals):
|
||||
setip = (vals.hostname or vals.netmask
|
||||
or vals.gateway or vals.dhcp or vals.interface)
|
||||
if not setip: return
|
||||
dummy_nfs_server = '1.2.3.4'
|
||||
ip = (vals.ip
|
||||
+ ':' + '1.2.3.4'
|
||||
+ ':' + (vals.nfs_server or dummy_nfs_server)
|
||||
+ ':' + vals.gateway
|
||||
+ ':' + vals.netmask
|
||||
+ ':' + vals.hostname
|
||||
@@ -357,11 +358,9 @@ def preprocess_ip(opts, vals):
|
||||
vals.cmdline_ip = ip
|
||||
|
||||
def preprocess_nfs(opts, vals):
|
||||
if (vals.nfs_root or vals.nfs_server):
|
||||
if (not vals.nfs_root) or (not vals.nfs_server):
|
||||
opts.err('Must set nfs root and nfs server')
|
||||
else:
|
||||
return
|
||||
if not vals.nfs_root: return
|
||||
if not vals.nfs_server:
|
||||
opts.err('Must set nfs root and nfs server')
|
||||
nfs = 'nfsroot=' + vals.nfs_server + ':' + vals.nfs_root
|
||||
vals.extra = nfs + ' ' + vals.extra
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import socket
|
||||
|
||||
from xen.xend import PrettyPrint
|
||||
from xen.xend import sxp
|
||||
from xen.xend.XendClient import server
|
||||
from xen.xend.XendClient import XendError, server
|
||||
from xen.xend.XendClient import main as xend_client_main
|
||||
from xen.xm import create, shutdown
|
||||
|
||||
@@ -72,6 +72,8 @@ class Xm:
|
||||
except socket.error, ex:
|
||||
print >>sys.stderr, ex
|
||||
self.err("Error connecting to xend, is xend running?")
|
||||
except XendError, ex:
|
||||
self.err(str(ex))
|
||||
|
||||
def main_call(self, args):
|
||||
"""Main entry point. Dispatches to the progs.
|
||||
|
||||