Revision c270ee07

b/lib/cli.py
81 81
  "DST_NODE_OPT",
82 82
  "EARLY_RELEASE_OPT",
83 83
  "ENABLED_HV_OPT",
84
  "ENABLED_STORAGE_TYPES_OPT",
84 85
  "ERROR_CODES_OPT",
85 86
  "FAILURE_ONLY_OPT",
86 87
  "FIELDS_OPT",
......
1156 1157
                            help="Comma-separated list of hypervisors",
1157 1158
                            type="string", default=None)
1158 1159

  
1160
ENABLED_STORAGE_TYPES_OPT = cli_option("--enabled-storage-types",
1161
                                       dest="enabled_storage_types",
1162
                                       help="Comma-separated list of "
1163
                                            "storage methods",
1164
                                       type="string", default=None)
1165

  
1159 1166
NIC_PARAMS_OPT = cli_option("-N", "--nic-parameters", dest="nicparams",
1160 1167
                            type="keyval", default={},
1161 1168
                            help="NIC parameters")
b/lib/client/gnt_cluster.py
962 962
          opts.use_external_mip_script is not None or
963 963
          opts.prealloc_wipe_disks is not None or
964 964
          opts.hv_state or
965
          opts.enabled_storage_types or
965 966
          opts.disk_state or
966 967
          opts.ispecs_mem_size or
967 968
          opts.ispecs_cpu_count or
......
994 995
  if hvlist is not None:
995 996
    hvlist = hvlist.split(",")
996 997

  
998
  enabled_storage_types = opts.enabled_storage_types
999
  if enabled_storage_types is not None:
1000
    enabled_storage_types = enabled_storage_types.split(",")
1001

  
997 1002
  # a list of (name, dict) we can pass directly to dict() (or [])
998 1003
  hvparams = dict(opts.hvparams)
999 1004
  for hv_params in hvparams.values():
......
1061 1066

  
1062 1067
  hv_state = dict(opts.hv_state)
1063 1068

  
1064
  op = opcodes.OpClusterSetParams(vg_name=vg_name,
1065
                                  drbd_helper=drbd_helper,
1066
                                  enabled_hypervisors=hvlist,
1067
                                  hvparams=hvparams,
1068
                                  os_hvp=None,
1069
                                  beparams=beparams,
1070
                                  nicparams=nicparams,
1071
                                  ndparams=ndparams,
1072
                                  diskparams=diskparams,
1073
                                  ipolicy=ipolicy,
1074
                                  candidate_pool_size=opts.candidate_pool_size,
1075
                                  maintain_node_health=mnh,
1076
                                  uid_pool=uid_pool,
1077
                                  add_uids=add_uids,
1078
                                  remove_uids=remove_uids,
1079
                                  default_iallocator=opts.default_iallocator,
1080
                                  prealloc_wipe_disks=opts.prealloc_wipe_disks,
1081
                                  master_netdev=opts.master_netdev,
1082
                                  master_netmask=opts.master_netmask,
1083
                                  reserved_lvs=opts.reserved_lvs,
1084
                                  use_external_mip_script=ext_ip_script,
1085
                                  hv_state=hv_state,
1086
                                  disk_state=disk_state,
1087
                                  )
1069
  op = opcodes.OpClusterSetParams(
1070
    vg_name=vg_name,
1071
    drbd_helper=drbd_helper,
1072
    enabled_hypervisors=hvlist,
1073
    hvparams=hvparams,
1074
    os_hvp=None,
1075
    beparams=beparams,
1076
    nicparams=nicparams,
1077
    ndparams=ndparams,
1078
    diskparams=diskparams,
1079
    ipolicy=ipolicy,
1080
    candidate_pool_size=opts.candidate_pool_size,
1081
    maintain_node_health=mnh,
1082
    uid_pool=uid_pool,
1083
    add_uids=add_uids,
1084
    remove_uids=remove_uids,
1085
    default_iallocator=opts.default_iallocator,
1086
    prealloc_wipe_disks=opts.prealloc_wipe_disks,
1087
    master_netdev=opts.master_netdev,
1088
    master_netmask=opts.master_netmask,
1089
    reserved_lvs=opts.reserved_lvs,
1090
    use_external_mip_script=ext_ip_script,
1091
    hv_state=hv_state,
1092
    disk_state=disk_state,
1093
    enabled_storage_types=enabled_storage_types,
1094
    )
1088 1095
  SubmitOrSend(op, opts)
1089 1096
  return 0
1090 1097

  
......
1566 1573
     DRBD_HELPER_OPT, NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT,
1567 1574
     RESERVED_LVS_OPT, DRY_RUN_OPT, PRIORITY_OPT, PREALLOC_WIPE_DISKS_OPT,
1568 1575
     NODE_PARAMS_OPT, USE_EXTERNAL_MIP_SCRIPT, DISK_PARAMS_OPT, HV_STATE_OPT,
1569
     DISK_STATE_OPT, SUBMIT_OPT] +
1576
     DISK_STATE_OPT, SUBMIT_OPT, ENABLED_STORAGE_TYPES_OPT] +
1570 1577
    INSTANCE_POLICY_OPTS,
1571 1578
    "[opts...]",
1572 1579
    "Alters the parameters of the cluster"),
b/lib/cmdlib.py
4408 4408
          hv_class.CheckParameterSyntax(hv_params)
4409 4409
          _CheckHVParams(self, node_list, hv_name, hv_params)
4410 4410

  
4411
    # FIXME: Regarding enabled_storage_types: If a method is removed
4412
    # which is actually currently used by an instance, should removing
4413
    # it be prevented?
4414

  
4411 4415
    if self.op.os_hvp:
4412 4416
      # no need to check any newly-enabled hypervisors, since the
4413 4417
      # defaults have already been checked in the above code-block
......
4459 4463
    if self.op.enabled_hypervisors is not None:
4460 4464
      self.cluster.hvparams = self.new_hvparams
4461 4465
      self.cluster.enabled_hypervisors = self.op.enabled_hypervisors
4466
    if self.op.enabled_storage_types is not None:
4467
      self.cluster.enabled_storage_types = \
4468
        list(set(self.op.enabled_storage_types))
4462 4469
    if self.op.beparams:
4463 4470
      self.cluster.beparams[constants.PP_DEFAULT] = self.new_beparams
4464 4471
    if self.op.nicparams:
b/lib/opcodes.py
954 954
     " ``%s`` or ``%s``" % (constants.DDM_ADD, constants.DDM_REMOVE)),
955 955
    ("use_external_mip_script", None, ht.TMaybeBool,
956 956
     "Whether to use an external master IP address setup script"),
957
    ("enabled_storage_types", None,
958
     ht.TMaybe(ht.TAnd(ht.TListOf(ht.TElemOf(constants.VALID_STORAGE_TYPES)),
959
                       ht.TTrue)),
960
     "List of enabled storage types"),
957 961
    ]
958 962
  OP_RESULT = ht.TNone
959 963

  
b/src/Ganeti/OpCodes.hs
175 175
     , pHiddenOs
176 176
     , pBlacklistedOs
177 177
     , pUseExternalMipScript
178
     , pEnabledStorageTypes
178 179
     ])
179 180
  , ("OpClusterRedistConf", [])
180 181
  , ("OpClusterActivateMasterIp", [])
b/src/Ganeti/OpParams.hs
237 237
  , pDependencies
238 238
  , pComment
239 239
  , pReason
240
  , pEnabledStorageTypes
240 241
  , dOldQuery
241 242
  , dOldQueryNoLocking
242 243
  ) where
......
758 759
  optionalField $
759 760
  simpleField "enabled_hypervisors" [t| NonEmpty Hypervisor |]
760 761

  
762
-- | List of enabled storage methods.
763
pEnabledStorageTypes :: Field
764
pEnabledStorageTypes =
765
  optionalField $
766
  simpleField "enabled_storage_types" [t| NonEmpty StorageType |]
767

  
761 768
-- | Selected hypervisor for an instance.
762 769
pHypervisor :: Field
763 770
pHypervisor =
b/test/hs/Test/Ganeti/OpCodes.hs
163 163
          arbitrary <*> arbitrary <*> arbitrary <*>
164 164
          emptyMUD <*> emptyMUD <*> arbitrary <*>
165 165
          arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*>
166
          arbitrary <*> arbitrary <*> arbitrary
166
          arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
167 167
      "OP_CLUSTER_REDIST_CONF" -> pure OpCodes.OpClusterRedistConf
168 168
      "OP_CLUSTER_ACTIVATE_MASTER_IP" ->
169 169
        pure OpCodes.OpClusterActivateMasterIp

Also available in: Unified diff