Revision a5728081 lib/cmdlib.py

b/lib/cmdlib.py
1409 1409
    if the given volume group is valid.
1410 1410

  
1411 1411
    """
1412
    # FIXME: This only works because there is only one parameter that can be
1413
    # changed or removed.
1414 1412
    if self.op.vg_name is not None and not self.op.vg_name:
1415 1413
      instances = self.cfg.GetAllInstancesInfo().values()
1416 1414
      for inst in instances:
......
1439 1437
    self.cluster = cluster = self.cfg.GetClusterInfo()
1440 1438
    # validate beparams changes
1441 1439
    if self.op.beparams:
1442
      utils.CheckBEParams(self.op.beparams)
1440
      utils.ForceDictType(self.op.beparams, constants.BES_PARAMETER_TYPES)
1443 1441
      self.new_beparams = cluster.FillDict(
1444 1442
        cluster.beparams[constants.BEGR_DEFAULT], self.op.beparams)
1445 1443

  
......
1467 1465
             hv_name in self.op.enabled_hypervisors)):
1468 1466
          # either this is a new hypervisor, or its parameters have changed
1469 1467
          hv_class = hypervisor.GetHypervisor(hv_name)
1468
          utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES)
1470 1469
          hv_class.CheckParameterSyntax(hv_params)
1471 1470
          _CheckHVParams(self, node_list, hv_name, hv_params)
1472 1471

  
......
4227 4226
                                  ",".join(enabled_hvs)))
4228 4227

  
4229 4228
    # check hypervisor parameter syntax (locally)
4230

  
4229
    utils.ForceDictType(self.op.hvparams, constants.HVS_PARAMETER_TYPES)
4231 4230
    filled_hvp = cluster.FillDict(cluster.hvparams[self.op.hypervisor],
4232 4231
                                  self.op.hvparams)
4233 4232
    hv_type = hypervisor.GetHypervisor(self.op.hypervisor)
4234 4233
    hv_type.CheckParameterSyntax(filled_hvp)
4235 4234

  
4236 4235
    # fill and remember the beparams dict
4237
    utils.CheckBEParams(self.op.beparams)
4236
    utils.ForceDictType(self.op.beparams, constants.BES_PARAMETER_TYPES)
4238 4237
    self.be_full = cluster.FillDict(cluster.beparams[constants.BEGR_DEFAULT],
4239 4238
                                    self.op.beparams)
4240 4239

  
......
5608 5607
            self.op.hvparams or self.op.beparams):
5609 5608
      raise errors.OpPrereqError("No changes submitted")
5610 5609

  
5611
    utils.CheckBEParams(self.op.beparams)
5612

  
5613 5610
    # Disk validation
5614 5611
    disk_addremove = 0
5615 5612
    for disk_op, disk_dict in self.op.disks:
......
5731 5728
            del i_hvdict[key]
5732 5729
          except KeyError:
5733 5730
            pass
5734
        elif val == constants.VALUE_NONE:
5735
          i_hvdict[key] = None
5736 5731
        else:
5737 5732
          i_hvdict[key] = val
5738 5733
      cluster = self.cfg.GetClusterInfo()
5734
      utils.ForceDictType(i_hvdict, constants.HVS_PARAMETER_TYPES)
5739 5735
      hv_new = cluster.FillDict(cluster.hvparams[instance.hypervisor],
5740 5736
                                i_hvdict)
5741 5737
      # local check
......
5759 5755
        else:
5760 5756
          i_bedict[key] = val
5761 5757
      cluster = self.cfg.GetClusterInfo()
5758
      utils.ForceDictType(i_bedict, constants.BES_PARAMETER_TYPES)
5762 5759
      be_new = cluster.FillDict(cluster.beparams[constants.BEGR_DEFAULT],
5763 5760
                                i_bedict)
5764 5761
      self.be_new = be_new # the new actual values

Also available in: Unified diff