On Thu, Dec 8, 2011 at 9:20 AM, Iustin Pop <[email protected]> wrote:
> On Tue, Dec 06, 2011 at 06:52:13PM +0100, Agata Murawska wrote:
>> gnt-cluster modify can now change instance policy specs. Again, sanity
>> checks are performed.
>>
>> Signed-off-by: Agata Murawska <[email protected]>
>> ---
>>  lib/client/gnt_cluster.py |   17 ++++++++++++++++-
>>  lib/cmdlib.py             |   11 +++++++++++
>>  lib/opcodes.py            |    1 +
>>  3 files changed, 28 insertions(+), 1 deletions(-)
>>
>> diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
>> index e3a8f8a..7c1cf0b 100644
>> --- a/lib/client/gnt_cluster.py
>> +++ b/lib/client/gnt_cluster.py
>> @@ -919,7 +919,12 @@ def SetClusterParams(opts, args):
>>            opts.master_netdev is not None or
>>            opts.master_netmask is not None or
>>            opts.use_external_mip_script is not None or
>> -          opts.prealloc_wipe_disks is not None):
>> +          opts.prealloc_wipe_disks is not None or
>> +          opts.mem_count_ispecs is not None or
>> +          opts.cpu_count_ispecs is not None or
>> +          opts.disk_count_ispecs is not None or
>> +          opts.disk_size_ispecs is not None or
>> +          opts.nic_count_ispecs is not None):
>
> Right. Let me know when you submitted, this needs refactoring.
>
> LGTM,
> iustin

Changes due to previous changes + styling issue Michael mentioned +
iteritems -> items in cmdlib:

diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index 7150929..2d2cbfd 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -920,11 +920,11 @@ def SetClusterParams(opts, args):
           opts.master_netmask is not None or
           opts.use_external_mip_script is not None or
           opts.prealloc_wipe_disks is not None or
-          opts.mem_count_ispecs is not None or
-          opts.cpu_count_ispecs is not None or
-          opts.disk_count_ispecs is not None or
-          opts.disk_size_ispecs is not None or
-          opts.nic_count_ispecs is not None):
+          opts.ispecs_mem_size is not None or
+          opts.ispecs_cpu_count is not None or
+          opts.ispecs_disk_count is not None or
+          opts.ispecs_disk_size is not None or
+          opts.ispecs_nic_count is not None):
     ToStderr("Please give at least one of the parameters.")
     return 1

@@ -968,12 +968,12 @@ def SetClusterParams(opts, args):
   if ndparams is not None:
     utils.ForceDictType(ndparams, constants.NDS_PARAMETER_TYPES)

-  ipolicy = objects.CreateIPolicyFromOpts(\
-    mem_count_ispecs=opts.mem_count_ispecs,
-    cpu_count_ispecs=opts.cpu_count_ispecs,
-    disk_count_ispecs=opts.disk_count_ispecs,
-    disk_size_ispecs=opts.disk_size_ispecs,
-    nic_count_ispecs=opts.nic_count_ispecs)
+  ipolicy = \
+    objects.CreateIPolicyFromOpts(ispecs_mem_size=opts.ispecs_mem_size,
+                                  ispecs_cpu_count=opts.ispecs_cpu_count,
+                                  ispecs_disk_count=opts.ispecs_disk_count,
+                                  ispecs_disk_size=opts.ispecs_disk_size,
+                                  ispecs_nic_count=opts.ispecs_nic_count)
   for value in ipolicy.values():
     utils.ForceDictType(value, constants.ISPECS_PARAMETER_TYPES)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index aa635af..920fa02 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -3597,7 +3597,7 @@ class LUClusterSetParams(LogicalUnit):

     if self.op.ipolicy:
       ipolicy = {}
-      for key, value in self.op.ipolicy.iteritems():
+      for key, value in self.op.ipolicy.items():
         utils.ForceDictType(value, constants.ISPECS_PARAMETER_TYPES)
         ipolicy[key] = _GetUpdatedParams(cluster.ipolicy.get(key, {}),
                                           value)


Agata

Reply via email to