diff options
author | Ben Pfaff <blp@ovn.org> | 2019-09-18 08:01:40 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2019-09-20 08:34:37 -0700 |
commit | 4dcdf55bc4b14f02d1409bf128714df00bf0f253 (patch) | |
tree | f7336642bda1790cc6c3f1826c90748e9e5ef433 /xenserver | |
parent | ab4514890587d1d74e1d1c4d8e1c18926ca0642b (diff) | |
download | openvswitch-4dcdf55bc4b14f02d1409bf128714df00bf0f253.tar.gz |
xenserver: Make Python files parse in Python 3 also.
I don't actually have any idea whether XenServer has moved
forward to Python 3 these days, but these files are still
OK in Python 2.x as well.
The rest of the Python files in OVS seem to already be OK in
Python 3.
Acked-by: Numan Siddique <nusididq@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'xenserver')
-rw-r--r-- | xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py | 10 | ||||
-rw-r--r-- | xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py index a93e43866..5cc22319a 100644 --- a/xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py +++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureBridge.py @@ -65,7 +65,7 @@ def load_bonding_driver(): f = open(sysfs_bonding_masters, "w") f.write("-bond0") f.close() - except IOError, e: + except IOError as e: log("Failed to load bonding driver: %s" % e) def bonding_driver_loaded(): @@ -92,7 +92,7 @@ def __create_bond_device(name): f = open(sysfs_bonding_masters, "w") f.write("+" + name) f.close() - except IOError, e: + except IOError as e: log("Failed to create %s: %s" % (name, e)) def create_bond_device(pif): @@ -114,7 +114,7 @@ def __destroy_bond_device(name): f.write("-" + name) f.close() retries = 0 - except IOError, e: + except IOError as e: time.sleep(0.5) else: log("bond master %s does not exist, not destroying" % name) @@ -355,8 +355,8 @@ def _configure_bond_interface(pif): # override defaults with values from other-config whose keys being with "bond-" oc = pifrec['other_config'] - overrides = filter(lambda (key,val): key.startswith("bond-"), oc.items()) - overrides = map(lambda (key,val): (key[5:], val), overrides) + overrides = filter(lambda key,val: key.startswith("bond-"), oc.items()) + overrides = map(lambda key,val: (key[5:], val), overrides) bond_options.update(overrides) # write the bond options to ifcfg-bondX diff --git a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py index fdbbc0ed4..8946917d5 100644 --- a/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py +++ b/xenserver/usr_lib_xsconsole_plugins-base_XSFeatureVSwitch.py @@ -39,7 +39,7 @@ class VSwitchService: def version(self): try: output = ShellPipe(["service", self.name, "version"]).Stdout() - except StandardError, e: + except StandardError as e: XSLogError("vswitch version retrieval error: " + str(e)) return "<unknown>" for line in output: @@ -50,7 +50,7 @@ class VSwitchService: def status(self): try: output = ShellPipe(["service", self.name, "status"]).Stdout() - except StandardError, e: + except StandardError as e: XSLogError("vswitch status retrieval error: " + str(e)) return "<unknown>" if len(output) == 0: @@ -69,7 +69,7 @@ class VSwitchService: def restart(self): try: ShellPipe(["service", self.name, "restart"]).Call() - except StandardError, e: + except StandardError as e: XSLogError("vswitch restart error: " + str(e)) @classmethod @@ -88,7 +88,7 @@ class VSwitchConfig: try: arg = [vsctl, "-vconsole:off"] + action.split() output = ShellPipe(arg).Stdout() - except StandardError, e: + except StandardError as e: XSLogError("config retrieval error: " + str(e)) return "<unknown>" @@ -189,7 +189,7 @@ class VSwitchControllerDialogue(Dialogue): try: self.SetController(self.controller) Layout.Inst().PushDialogue(InfoDialogue(Lang("Setting controller successful"))) - except Exception, e: + except Exception as e: Layout.Inst().PushDialogue(InfoDialogue(Lang("Setting controller failed"))) self.ChangeState("INITIAL") @@ -213,7 +213,7 @@ class VSwitchControllerDialogue(Dialogue): try: self.SetController(None) Layout.Inst().PushDialogue(InfoDialogue(Lang("Controller deletion successful"))) - except Exception, e: + except Exception as e: Layout.Inst().PushDialogue(InfoDialogue(Lang("Controller deletion failed"))) def syncController(self): @@ -222,7 +222,7 @@ class VSwitchControllerDialogue(Dialogue): try: Task.Sync(lambda s: self._updateThisServer(s)) Layout.Inst().PushDialogue(InfoDialogue(Lang("Resyncing controller config successful"))) - except Exception, e: + except Exception as e: Layout.Inst().PushDialogue(InfoDialogue(Lang("Resyncing controller config failed"))) def SetController(self, ip): |