Make desired_capacity default to min_size if min_size specified

This patch makes desired_capacity default to min_size if min_zize
specified but desired_capacity not when creating cluster, it would
be more friendly to user.

Change-Id: Ie498f128bbd410d116abdf759d65adec0488dcec
This commit is contained in:
lvdongbing 2015-12-07 21:48:19 -05:00
parent 4389e144ca
commit 7a00707cbb

@ -574,7 +574,8 @@ def _show_cluster(sc, cluster_id):
@utils.arg('-m', '--max-size', metavar='<MAX-SIZE>', default=-1,
help=_('Max size of the cluster. Default to -1, means unlimited.'))
@utils.arg('-c', '--desired-capacity', metavar='<DESIRED-CAPACITY>', default=0,
help=_('Desired capacity of the cluster. Default to 0.'))
help=_('Desired capacity of the cluster. Default to min_size if '
'min_size is specified else 0.'))
@utils.arg('-o', '--parent', metavar='<PARENT_ID>',
help=_('ID of the parent cluster, if exists.'))
@utils.arg('-t', '--timeout', metavar='<TIMEOUT>', type=int,
@ -588,6 +589,8 @@ def _show_cluster(sc, cluster_id):
help=_('Name of the cluster to create.'))
def do_cluster_create(sc, args):
'''Create the cluster.'''
if args.min_size and not args.desired_capacity:
args.desired_capacity = args.min_size
attrs = {
'name': args.name,
'profile_id': args.profile,