diff options
author | Alastair Tse <atse@xensource.com> | 2007-01-30 11:37:18 +0000 |
---|---|---|
committer | Alastair Tse <atse@xensource.com> | 2007-01-30 11:37:18 +0000 |
commit | 9fd37a76223247cfb87c5220942f0c9e9e8390a0 (patch) | |
tree | e2e96f3c8b02ae049996b0932bcfe9df627e1119 /tools | |
parent | 4708b773f58fe05adc9b23bc8e3d6887383a061b (diff) | |
download | xen-9fd37a76223247cfb87c5220942f0c9e9e8390a0.tar.gz xen-9fd37a76223247cfb87c5220942f0c9e9e8390a0.tar.bz2 xen-9fd37a76223247cfb87c5220942f0c9e9e8390a0.zip |
[XEND] Unparsable VLAN numbers should default to -1
Signed-off-by: Alastair Tse <atse@xensource.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/python/xen/xend/XendNode.py | 7 | ||||
-rw-r--r-- | tools/python/xen/xend/XendPIF.py | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/tools/python/xen/xend/XendNode.py b/tools/python/xen/xend/XendNode.py index 6a01e958f2..c2e336b345 100644 --- a/tools/python/xen/xend/XendNode.py +++ b/tools/python/xen/xend/XendNode.py @@ -125,8 +125,13 @@ class XendNode: # Compatibility hack, can go pretty soon. pif['metrics'] = uuid.createString() + try: + pif['VLAN'] = int(pif.get('VLAN', -1)) + except (ValueError, TypeError): + pif['VLAN'] = -1 + self._PIF_create(pif['device'], pif['MTU'], - int(pif['VLAN']), + pif['VLAN'], pif['MAC'], network, False, pif_uuid, pif['metrics']) except NetworkAlreadyConnected, exn: diff --git a/tools/python/xen/xend/XendPIF.py b/tools/python/xen/xend/XendPIF.py index 6c8fcae6d6..b028427863 100644 --- a/tools/python/xen/xend/XendPIF.py +++ b/tools/python/xen/xend/XendPIF.py @@ -138,8 +138,9 @@ class XendPIF: rc, _ = _cmd('vconfig add %s %d', self.device, self.vlan) if rc != 0: - log.error('Could not refresh %s', ifname) + log.error('Could not refresh VLAN for interface %s', ifname) return + log.info('Created network interface %s', ifname) for brname, nics in bridges.items(): |