Initial support to cluster create
This commit is contained in:
parent
698b5f8f84
commit
02bf9dcaae
@ -69,7 +69,10 @@ class Client(object):
|
|||||||
|
|
||||||
def create(self, cls, params):
|
def create(self, cls, params):
|
||||||
obj = cls.new(**params)
|
obj = cls.new(**params)
|
||||||
return obj.create(self.session)
|
try:
|
||||||
|
return obj.create(self.session)
|
||||||
|
except exc.HttpException as ex:
|
||||||
|
client_exc.parse_exception(ex)
|
||||||
|
|
||||||
def get(self, cls, options=None):
|
def get(self, cls, options=None):
|
||||||
try:
|
try:
|
||||||
|
@ -186,7 +186,7 @@ class Cluster(resource.Resource):
|
|||||||
allow_list = True
|
allow_list = True
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
links = resource.prop('links', type=dict)
|
id = resource.prop('id')
|
||||||
name = resource.prop('name')
|
name = resource.prop('name')
|
||||||
profile_id = resource.prop('profile_id')
|
profile_id = resource.prop('profile_id')
|
||||||
user = resource.prop('user')
|
user = resource.prop('user')
|
||||||
@ -256,7 +256,6 @@ class Node(resource.Resource):
|
|||||||
allow_list = True
|
allow_list = True
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
links = resource.prop('links', type=dict)
|
|
||||||
id = resource.prop('id')
|
id = resource.prop('id')
|
||||||
name = resource.prop('name')
|
name = resource.prop('name')
|
||||||
physical_id = resource.prop('physical_id')
|
physical_id = resource.prop('physical_id')
|
||||||
|
@ -260,8 +260,9 @@ def do_cluster_list(sc, args=None):
|
|||||||
help=_('Profile Id used for this cluster.'))
|
help=_('Profile Id used for this cluster.'))
|
||||||
@utils.arg('-n', '--size', metavar='<NUMBER>',
|
@utils.arg('-n', '--size', metavar='<NUMBER>',
|
||||||
help=_('Initial size of the cluster.'))
|
help=_('Initial size of the cluster.'))
|
||||||
@utils.arg('-t', '--timeout', metavar='<TIMEOUT>',
|
@utils.arg('-o', '--parent', metavar='<PARENT_ID>',
|
||||||
type=int,
|
help=_('ID of the parent cluster, if exists.'))
|
||||||
|
@utils.arg('-t', '--timeout', metavar='<TIMEOUT>', type=int,
|
||||||
help=_('Cluster creation timeout in minutes.'))
|
help=_('Cluster creation timeout in minutes.'))
|
||||||
@utils.arg('-g', '--tags', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
|
@utils.arg('-g', '--tags', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
|
||||||
help=_('Tag values to be attached to the cluster. '
|
help=_('Tag values to be attached to the cluster. '
|
||||||
@ -275,13 +276,17 @@ def do_cluster_create(sc, args):
|
|||||||
params = {
|
params = {
|
||||||
'name': args.name,
|
'name': args.name,
|
||||||
'profile_id': args.profile,
|
'profile_id': args.profile,
|
||||||
'tags': utils.format_parameters(args.tags),
|
|
||||||
'size': args.size,
|
'size': args.size,
|
||||||
|
'parent': args.parent,
|
||||||
|
'tags': utils.format_parameters(args.tags),
|
||||||
'timeout': args.timeout
|
'timeout': args.timeout
|
||||||
}
|
}
|
||||||
|
|
||||||
sc.create(models.Cluster, params)
|
cluster, resp = sc.create(models.Cluster, params)
|
||||||
do_cluster_list(sc)
|
print(_('Action CLUSTER_CREATE(%(action)s) scheduled for '
|
||||||
|
'cluster %(cluster)s') % {
|
||||||
|
'action': resp['action_id'],
|
||||||
|
'cluster': resp['id']})
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('id', metavar='<NAME or ID>', nargs='+',
|
@utils.arg('id', metavar='<NAME or ID>', nargs='+',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user