[ovs-dev] [PATCH] xenserver: Fix interface reconfigure crash when setting fail_mode.
Ethan Jackson
ethan at nicira.com
Thu Jan 20 02:11:13 UTC 2011
For the curious. The patch ended up being:
diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
index a3d4bd2..22201ae 100644
--- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
+++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
@@ -334,7 +334,7 @@ def configure_datapath(pif):
pool = db().get_pool_record()
if pool:
- fail_mode = pool['other_config']['vswitch-controller-fail-mode']
+ fail_mode = pool['other_config'].get('vswitch-controller-fail-mode')
else:
fail_mode = 'standalone'
I will go ahead and merge it.
On Wed, Jan 19, 2011 at 6:04 PM, Justin Pettit <jpettit at nicira.com> wrote:
> Looks good. I think you can write that more compactly (and without the try/except block), as follows:
>
> fail_mode = pool['other_config'].get('vswitch-controller-fail-mode', 'standalone')
>
> I haven't tested it that way, so give it a try first.
>
> --Justin
>
>
> On Jan 19, 2011, at 5:59 PM, Ethan Jackson wrote:
>
>> Interface reconfigure can crash when setting fail_mode if an
>> expected other_config setting is not set.
>> ---
>> ...ensource_libexec_InterfaceReconfigureVswitch.py | 9 ++++++---
>> 1 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
>> index a3d4bd2..a9bdf9b 100644
>> --- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
>> +++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
>> @@ -333,10 +333,13 @@ def configure_datapath(pif):
>>
>> pool = db().get_pool_record()
>>
>> + fail_mode = 'standalone'
>> +
>> if pool:
>> - fail_mode = pool['other_config']['vswitch-controller-fail-mode']
>> - else:
>> - fail_mode = 'standalone'
>> + try:
>> + fail_mode = pool['other_config']['vswitch-controller-fail-mode']
>> + except KeyError:
>> + pass
>>
>> if fail_mode in ['standalone', 'secure']:
>> vsctl_argv += ['--', 'set', 'Bridge', bridge, 'fail_mode=%s' % fail_mode]
>> --
>> 1.7.2
>>
>>
>> _______________________________________________
>> dev mailing list
>> dev at openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
>
>
More information about the dev
mailing list