ia64/xen-unstable

changeset 13967:82f66bc01da2

Protect self.domid from being empty
author Wim Colgate <wim@xensource.com>
date Wed Feb 14 12:18:32 2007 -0800 (2007-02-14)
parents f8030a569811
children 0d488e53446a
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed Feb 14 19:17:41 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Wed Feb 14 12:18:32 2007 -0800
     1.3 @@ -1569,16 +1569,17 @@ class XendDomainInfo:
     1.4          # get associated devices to destroy
     1.5          # build list of phantom devices to be removed after normal devices
     1.6          plist = []
     1.7 -        from xen.xend.xenstore.xstransact import xstransact
     1.8 -        t = xstransact("%s/device/vbd" % GetDomainPath(self.domid))
     1.9 -        for dev in t.list():
    1.10 -            backend_phantom_vbd = xstransact.Read("%s/device/vbd/%s/phantom_vbd" \
    1.11 -                                  % (self.dompath, dev))
    1.12 -            if backend_phantom_vbd is not None:
    1.13 -                frontend_phantom_vbd =  xstransact.Read("%s/frontend" \
    1.14 -                                  % backend_phantom_vbd)
    1.15 -                plist.append(backend_phantom_vbd)
    1.16 -                plist.append(frontend_phantom_vbd)
    1.17 +        if self.domid is not None:
    1.18 +            from xen.xend.xenstore.xstransact import xstransact
    1.19 +            t = xstransact("%s/device/vbd" % GetDomainPath(self.domid))
    1.20 +            for dev in t.list():
    1.21 +                backend_phantom_vbd = xstransact.Read("%s/device/vbd/%s/phantom_vbd" \
    1.22 +                                      % (self.dompath, dev))
    1.23 +                if backend_phantom_vbd is not None:
    1.24 +                    frontend_phantom_vbd =  xstransact.Read("%s/frontend" \
    1.25 +                                      % backend_phantom_vbd)
    1.26 +                    plist.append(backend_phantom_vbd)
    1.27 +                    plist.append(frontend_phantom_vbd)
    1.28          return plist
    1.29  
    1.30      def _cleanup_phantom_devs(self, plist):