netdev-linux: Set missing cache validity bit.
[openvswitch] / xenserver / opt_xensource_libexec_interface-reconfigure
index cb4a2ee4bf89ce3535a2f3f73e7bb2a674e5a522..07e7ba24b2f7ee0e87d8927d818fa3dd3000b6d8 100755 (executable)
@@ -8,6 +8,7 @@
     %(command-name)s --session <SESSION-REF> --pif <PIF-REF> [up|down|rewrite]
     %(command-name)s --force <BRIDGE> [up|down|rewrite <CONFIG>]
     %(command-name)s --force all down
+    %(command-name)s init-dbcache
 
     where,
           <CONFIG> = --device=<INTERFACE> --mode=dhcp
@@ -1030,7 +1031,7 @@ def configure_physdev(pif):
     run_ethtool(device, oc)
 
 def modify_config(commands):
-    run_command(['/root/vswitch/bin/ovs-cfg-mod', '-vANY:console:emer',
+    run_command(['/usr/bin/ovs-cfg-mod', '-vANY:console:emer',
                  '-F', '/etc/ovs-vswitchd.conf']
                 + commands + ['-c'])
     run_command(['/sbin/service', 'vswitch', 'reload'])
@@ -1190,7 +1191,7 @@ def action_up(pif):
     # - The networks corresponding to any VLANs attached to the
     #   datapath's PIF.
     network_uuids = []
-    for nwpif in db.get_pifs_by_device({'device': pifrec['device']}):
+    for nwpif in db.get_pifs_by_device(pifrec['device']):
         net = db.get_pif_record(nwpif)['network']
         network_uuids += [db.get_network_record(net)['uuid']]
 
@@ -1441,6 +1442,9 @@ def main(argv=None):
         if len(force_rewrite_config) and not (force_interface and action == "rewrite"):
             raise Usage("\"--force rewrite\" needed for --device, --mode, --ip, --netmask, and --gateway")
 
+        if action == "init-dbcache" and arglist:
+            raise Usage("\"init-dbcache\" action does not accept any options")
+
         global db
         if force_interface:
             log("Force interface %s %s" % (force_interface, action))
@@ -1458,6 +1462,8 @@ def main(argv=None):
                     action_down(pif)
                 else:
                     raise Usage("Unknown action %s"  % action)
+        elif action == "init-dbcache":
+            DatabaseCache().save(dbcache_file)
         else:
             db = DatabaseCache(session_ref=session)
 
@@ -1491,7 +1497,6 @@ def main(argv=None):
                 raise Usage("Unknown action %s"  % action)
 
             # Save cache.
-            pifrec = db.get_pif_record(pif)
             db.save(dbcache_file)
         
     except Usage, err: