From ab9e48d131af313cf01b10d6badf899cd9fe9de6 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 11 Mar 2013 12:53:36 +0100
Subject: [PATCH] Enable split queries for the network

Now that all fields are implemented, and (I think) behave equivalent
to the Python implementation, we can switch on the split queries for
networks.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
---
 lib/client/gnt_network.py | 8 +++++---
 lib/rapi/rlib2.py         | 6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/client/gnt_network.py b/lib/client/gnt_network.py
index 558903fb9..a8706c1c6 100644
--- a/lib/client/gnt_network.py
+++ b/lib/client/gnt_network.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2011, 2012 Google Inc.
+# Copyright (C) 2011, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -167,7 +167,7 @@ def ListNetworks(opts, args):
     "tags": (",".join, False),
     }
 
-  cl = GetClient()
+  cl = GetClient(query=True)
   return GenericList(constants.QR_NETWORK, desired_fields, args, None,
                      opts.separator, not opts.no_headers,
                      verbose=opts.verbose, format_override=fmtoverride,
@@ -184,8 +184,10 @@ def ListNetworkFields(opts, args):
   @return: the desired exit code
 
   """
+  cl = GetClient(query=True)
+
   return GenericListFields(constants.QR_NETWORK, args, opts.separator,
-                           not opts.no_headers)
+                           not opts.no_headers, cl=cl)
 
 
 def ShowNetworkConfig(_, args):
diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
index a47515157..f73f3dce8 100644
--- a/lib/rapi/rlib2.py
+++ b/lib/rapi/rlib2.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -675,7 +675,7 @@ class R_2_networks(baserlib.OpcodeResource):
     """Returns a list of all networks.
 
     """
-    client = self.GetClient()
+    client = self.GetClient(query=True)
 
     if self.useBulk():
       bulkdata = client.QueryNetworks([], NET_FIELDS, False)
@@ -698,7 +698,7 @@ class R_2_networks_name(baserlib.OpcodeResource):
 
     """
     network_name = self.items[0]
-    client = self.GetClient()
+    client = self.GetClient(query=True)
 
     result = baserlib.HandleItemQueryErrors(client.QueryNetworks,
                                             names=[network_name],
-- 
GitLab