xenserver: Verify updates in ovs-xapi-sync.
authorEthan Jackson <ethan@nicira.com>
Tue, 20 Mar 2012 01:00:54 +0000 (18:00 -0700)
committerEthan Jackson <ethan@nicira.com>
Tue, 20 Mar 2012 01:08:45 +0000 (18:08 -0700)
This prevents potential race conditions when updating database
tables.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
xenserver/usr_share_openvswitch_scripts_ovs-xapi-sync

index 7c78251e2443f8cece635f0a0ffcd050f2eef6cc..cc14d6f28bf9aa6e0c133707fdbe6caf4b82e965 100755 (executable)
@@ -162,6 +162,7 @@ def set_or_delete(d, key, value):
 
 
 def set_external_id(row, key, value):
+    row.verify("external_ids")
     external_ids = row.external_ids
     if set_or_delete(external_ids, key, value):
         row.external_ids = external_ids
@@ -186,6 +187,7 @@ def update_fail_mode(row):
     if fail_mode not in ['standalone', 'secure']:
         fail_mode = 'standalone'
 
+    row.verify("fail_mode")
     if row.fail_mode != fail_mode:
         row.fail_mode = fail_mode
 
@@ -197,6 +199,7 @@ def update_in_band_mgmt(row):
 
     dib = rec['other_config'].get('vswitch-disable-in-band')
 
+    row.verify("other_config")
     other_config = row.other_config
     if dib and dib not in ['true', 'false']:
         vlog.warn('"%s" isn\'t a valid setting for '