WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Check "mac" address sooner in device_crea

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Check "mac" address sooner in device_create function, before doing device_add.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 24 Jun 2010 14:00:19 -0700
Delivery-date: Thu, 24 Jun 2010 14:01:15 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1277219220 -3600
# Node ID 9da3abe88c90bd8ec48963a9ec537a8871e266db
# Parent  2ad890d46cb8a11fc6ea329126d398021307e627
Check "mac" address sooner in device_create function, before doing device_add.

In XendDomainInfo.py device_create function, when device type is
"vif", it has a paragraph to check the validity of "mac"
address. Before checking validity, device_add has been done. But after
checking validity, if the mac address is invlid, it raises VmError and
exits directly without doing clean work like removing the device item
from config info. This will cause that the incorrect mac address is
saved into VM Config file and VM fails to restart. If check "mac"
validity before doing device_add, there will be no problem.

Signed-off-by Chunyan Liu <CYLiu@xxxxxxxxxx>
---
 tools/python/xen/xend/XendDomainInfo.py |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff -r 2ad890d46cb8 -r 9da3abe88c90 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Jun 22 16:00:08 2010 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Jun 22 16:07:00 2010 +0100
@@ -833,17 +833,17 @@ class XendDomainInfo:
         @type  dev_config: SXP object (parsed config)
         """
         log.debug("XendDomainInfo.device_create: %s" % 
scrub_password(dev_config))
-        dev_type = sxp.name(dev_config)
-        dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
-        dev_config_dict = self.info['devices'][dev_uuid][1]
-        log.debug("XendDomainInfo.device_create: %s" % 
scrub_password(dev_config_dict))
-
         if dev_type == 'vif':
             for x in dev_config:
                 if x != 'vif' and x[0] == 'mac':
                     if not re.match('^([0-9a-f]{2}:){5}[0-9a-f]{2}$', x[1], 
re.I):
                         log.error("Virtual network interface creation error - 
invalid MAC Address entered: %s", x[1])
                         raise VmError("Cannot create a new virtual network 
interface - MAC address is not valid!");
+
+        dev_type = sxp.name(dev_config)
+        dev_uuid = self.info.device_add(dev_type, cfg_sxp = dev_config)
+        dev_config_dict = self.info['devices'][dev_uuid][1]
+        log.debug("XendDomainInfo.device_create: %s" % 
scrub_password(dev_config_dict))
 
         if self.domid is not None:
             try:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Check "mac" address sooner in device_create function, before doing device_add., Xen patchbot-unstable <=