From: Justin Pettit Date: Thu, 18 Jun 2009 21:13:00 +0000 (-0700) Subject: xenserver: Handle slave disconnection more gracefully in xsconsole plugin X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73945b1fddef445c06441b8ab0054910935bc764;p=openvswitch xenserver: Handle slave disconnection more gracefully in xsconsole plugin When a slave cannot connect to the master, the vSwitch xsconsole plugin complained with some Python style errors on the main display. This commit cleans up that behavior. Bug #1341 --- diff --git a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py index 8f4be313..95020ad4 100644 --- a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py +++ b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py @@ -90,7 +90,11 @@ class VSwitchControllerDialogue(Dialogue): self.hostsInPool = 0 self.hostsUpdated = 0 - self.controller = data.GetPoolForThisHost().get("other_config", {}).get("vSwitchController", "") + pool = data.GetPoolForThisHost() + if pool is not None: + self.controller = pool.get("other_config", {}).get("vSwitchController", "") + else: + self.controller = "" choiceDefs = [ ChoiceDef(Lang("Set pool-wide controller"), @@ -253,7 +257,13 @@ class XSFeatureVSwitch: inPane.AddStatusField(Lang("Version", 20), versionStr) inPane.NewLine() - dbController = data.GetPoolForThisHost().get("other_config", {}).get("vSwitchController", "") + + pool = data.GetPoolForThisHost() + if pool is not None: + dbController = pool.get("other_config", {}).get("vSwitchController", "") + else: + dbController = "" + if dbController == "": dbController = Lang("") inPane.AddStatusField(Lang("Controller (config)", 20), dbController)