aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-05-19 02:23:32 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-05-19 02:23:32 +0100
commitc3122a4018eeb7ddb8682f115970331801f3f677 (patch)
treec83ca671c6ff305f548b95cfabc200682ff8e00a /tools
parent41af6f38d95ac1ec058488705c048539df92c125 (diff)
downloadxen-c3122a4018eeb7ddb8682f115970331801f3f677.tar.gz
xen-c3122a4018eeb7ddb8682f115970331801f3f677.tar.bz2
xen-c3122a4018eeb7ddb8682f115970331801f3f677.zip
xend: Fix xm pci commands for inactive managed domains.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/python/xen/xend/XendDomainInfo.py25
-rw-r--r--tools/python/xen/xm/main.py22
2 files changed, 36 insertions, 11 deletions
diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py
index c4da7fba79..7723a355a5 100644
--- a/tools/python/xen/xend/XendDomainInfo.py
+++ b/tools/python/xen/xend/XendDomainInfo.py
@@ -621,9 +621,13 @@ class XendDomainInfo:
pci_conf = self.info['devices'][dev_uuid][1]
pci_devs = pci_conf['devs']
for x in pci_devs:
- if (int(x['vslot'], 16) == int(new_dev['vslot'], 16) and
- int(x['vslot'], 16) != AUTO_PHP_SLOT):
- raise VmError("vslot %s already have a device." % (new_dev['vslot']))
+ if x.has_key('vslot'):
+ x_vslot = x['vslot']
+ else:
+ x_vslot = x['requested_vslot']
+ if (int(x_vslot, 16) == int(new_dev['requested_vslot'], 16) and
+ int(x_vslot, 16) != AUTO_PHP_SLOT):
+ raise VmError("vslot %s already have a device." % (new_dev['requested_vslot']))
if (int(x['domain'], 16) == int(new_dev['domain'], 16) and
int(x['bus'], 16) == int(new_dev['bus'], 16) and
@@ -710,14 +714,14 @@ class XendDomainInfo:
new_dev['bus'],
new_dev['slot'],
new_dev['func'],
- new_dev['vslot'],
+ new_dev['requested_vslot'],
opts)
self.image.signalDeviceModel('pci-ins', 'pci-inserted', bdf_str)
vslot = xstransact.Read("/local/domain/0/device-model/%i/parameter"
% self.getDomid())
else:
- vslot = new_dev['vslot']
+ vslot = new_dev['requested_vslot']
return vslot
@@ -815,7 +819,10 @@ class XendDomainInfo:
int(x['bus'], 16) == int(dev['bus'], 16) and
int(x['slot'], 16) == int(dev['slot'], 16) and
int(x['func'], 16) == int(dev['func'], 16) ):
- vslot = x['vslot']
+ if x.has_key('vslot'):
+ vslot = x['vslot']
+ else:
+ vslot = x['requested_vslot']
break
if vslot == AUTO_PHP_SLOT_STR:
raise VmError("Device %04x:%02x:%02x.%01x is not connected"
@@ -1112,7 +1119,11 @@ class XendDomainInfo:
#find the pass-through device with the virtual slot
devnum = 0
for x in pci_conf['devs']:
- if int(x['vslot'], 16) == vslot:
+ if x.has_key('vslot'):
+ x_vslot = x['vslot']
+ else:
+ x_vslot = x['requested_vslot']
+ if int(x_vslot, 16) == vslot:
break
devnum += 1
diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py
index a460bc8a3a..f33a74f9b6 100644
--- a/tools/python/xen/xm/main.py
+++ b/tools/python/xen/xm/main.py
@@ -2165,13 +2165,27 @@ def xm_pci_list(args):
if len(devs) == 0:
return
- has_vslot = devs[0].has_key('vslot')
+ has_vslot = False
+ for x in devs:
+ if x.has_key('vslot'):
+ if x['vslot'] == "0x%s" % AUTO_PHP_SLOT_STR:
+ x['vslot'] = '-'
+ else:
+ has_vslot = True
+ elif not x.has_key('requested_vslot'):
+ x['vslot'] = '-'
+ elif x['requested_vslot'] == "0x%s" % AUTO_PHP_SLOT_STR:
+ x['vslot'] = '-'
+ else:
+ has_vslot = True
+ x['vslot'] = x['requested_vslot']
+
if has_vslot:
hdr_str = 'VSlt domain bus slot func'
- fmt_str = "%(vslot)-3s %(domain)-3s %(bus)-3s %(slot)-3s %(func)-3s "
+ fmt_str = "%(vslot)-4s %(domain)-6s %(bus)-4s %(slot)-4s %(func)-3s "
else:
hdr_str = 'domain bus slot func'
- fmt_str = "%(domain)-3s %(bus)-3s %(slot)-3s %(func)-3s "
+ fmt_str = "%(domain)-6s %(bus)-4s %(slot)-4s %(func)-3s "
hdr = 0
for x in devs:
@@ -2457,7 +2471,7 @@ def parse_pci_configuration(args, state, opts = ''):
['bus', '0x'+ pci_dev_info['bus']],
['slot', '0x'+ pci_dev_info['slot']],
['func', '0x'+ pci_dev_info['func']],
- ['vslot', '0x%x' % int(vslot, 16)]]
+ ['requested_vslot', '0x%x' % int(vslot, 16)]]
if len(opts) > 0:
pci_bdf.append(['opts', opts])
pci.append(pci_bdf)