ia64/xen-unstable

changeset 14529:5dfa9b09b07c

Fix xenapi_create re: Multiple VIFs for test 04_restore_withdevices_pos

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Mar 23 11:00:08 2007 +0000 (2007-03-23)
parents 8b0be0ddc223
children a34ab3f899c4
files tools/python/xen/xm/xenapi_create.py
line diff
     1.1 --- a/tools/python/xen/xm/xenapi_create.py	Fri Mar 23 10:59:49 2007 +0000
     1.2 +++ b/tools/python/xen/xm/xenapi_create.py	Fri Mar 23 11:00:08 2007 +0000
     1.3 @@ -611,7 +611,10 @@ class sxp2xml:
     1.4  
     1.5          vif = document.createElement("vif")
     1.6  
     1.7 -        dev = get_child_by_name(vif_sxp, "vifname", "eth0")
     1.8 +        dev = get_child_by_name(vif_sxp, "vifname", None)
     1.9 +
    1.10 +        if dev is None:
    1.11 +            dev = self.getFreshEthDevice()
    1.12  
    1.13          vif.attributes["name"] \
    1.14              = "vif" + str(dev.__hash__())
    1.15 @@ -628,7 +631,8 @@ class sxp2xml:
    1.16          
    1.17          return vif
    1.18  
    1.19 -
    1.20 +    _eths = -1
    1.21  
    1.22 -
    1.23 -
    1.24 +    def getFreshEthDevice(self):
    1.25 +        self._eths += 1
    1.26 +        return "eth%i" % self._eths