ia64/xen-unstable

changeset 19756:dce4d6840db1

xend: pass-through: tidy up PciController()

Signed-off-by: Simon Horman <horms@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 16 11:36:03 2009 +0100 (2009-06-16)
parents 08de8ec655c2
children c7fabc081498
files tools/python/xen/xend/server/pciif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/pciif.py	Tue Jun 16 11:35:16 2009 +0100
     1.2 +++ b/tools/python/xen/xend/server/pciif.py	Tue Jun 16 11:36:03 2009 +0100
     1.3 @@ -540,33 +540,24 @@ class PciController(DevController):
     1.4                  # In HVM case, I/O resources are disabled in ioemu.
     1.5                  self.cleanupOneDevice(domain, bus, slot, func)
     1.6                  # Remove xenstore nodes.
     1.7 -                self.removeBackend(devid, 'dev-%i' % i)
     1.8 -                self.removeBackend(devid, 'vdev-%i' % i)
     1.9 -                self.removeBackend(devid, 'state-%i' % i)
    1.10 -                self.removeBackend(devid, 'uuid-%i' % i)
    1.11 -                tmpopts = self.readBackend(devid, 'opts-%i' % i)
    1.12 -                if tmpopts is not None:
    1.13 -                    self.removeBackend(devid, 'opts-%i' % i)
    1.14 +                list = ['dev', 'vdev', 'state', 'uuid']
    1.15 +                if self.readBackend(devid, 'opts-%i' % i) is not None:
    1.16 +                    list.append('opts')
    1.17 +                for key in list:
    1.18 +                    self.removeBackend(devid, '%s-%i' % (key, i))
    1.19              else:
    1.20 -                if new_num_devs != i:
    1.21 -                    tmpdev = self.readBackend(devid, 'dev-%i' % i)
    1.22 -                    self.writeBackend(devid, 'dev-%i' % new_num_devs, tmpdev)
    1.23 -                    self.removeBackend(devid, 'dev-%i' % i)
    1.24 -                    tmpvdev = self.readBackend(devid, 'vdev-%i' % i)
    1.25 -                    if tmpvdev is not None:
    1.26 -                        self.writeBackend(devid, 'vdev-%i' % new_num_devs,
    1.27 -                                          tmpvdev)
    1.28 -                    self.removeBackend(devid, 'vdev-%i' % i)
    1.29 -                    tmpstate = self.readBackend(devid, 'state-%i' % i)
    1.30 -                    self.writeBackend(devid, 'state-%i' % new_num_devs, tmpstate)
    1.31 -                    self.removeBackend(devid, 'state-%i' % i)
    1.32 -                    tmpuuid = self.readBackend(devid, 'uuid-%i' % i)
    1.33 -                    self.writeBackend(devid, 'uuid-%i' % new_num_devs, tmpuuid)
    1.34 -                    self.removeBackend(devid, 'uuid-%i' % i)
    1.35 -                    tmpopts = self.readBackend(devid, 'opts-%i' % i)
    1.36 -                    if tmpopts is not None:
    1.37 -                        self.removeBackend(devid, 'opts-%i' % i)
    1.38                  new_num_devs = new_num_devs + 1
    1.39 +                if new_num_devs == i + 1:
    1.40 +                    continue
    1.41 +
    1.42 +                list = ['dev', 'vdev', 'state', 'uuid', 'opts']
    1.43 +                for key in list:
    1.44 +                    tmp = self.readBackend(devid, '%s-%i' % (key, i))
    1.45 +                    if tmp is None:
    1.46 +                        continue
    1.47 +                    self.removeBackend(devid, '%s-%i' % (key, i))
    1.48 +                    self.writeBackend(devid,
    1.49 +                                      '%s-%i' % (key, new_num_devs - 1), tmp)
    1.50  
    1.51          self.writeBackend(devid, 'num_devs', str(new_num_devs))
    1.52