Beispiel #1
0
    def handle(self, request, data):
        try:

            body = {
                'pool': {
                    'name': data['name'],
                    'storageGroupId': data['storage_group'],
                    'replicationFactor': data['replication_factor'],
                    'tag': data['tag'],
                    'clusterId': '0',
                    'createdBy': 'VSM'
                }
            }
            rsp, ret = vsm_api.create_storage_pool(request, body=body)

            res = str(ret['message']).strip()
            if res.startswith('pool') and res.endswith('created'):
                messages.success(
                    request,
                    _('Successfully created storage pool: %s') % data['name'])
            else:
                messages.error(
                    request,
                    _('Because %s, failed to create storage pool') %
                    ret['message'])

            return ret
        except:
            redirect = reverse("horizon:vsm:poolsmanagement:index")
            exceptions.handle(request,
                              _('Unable to create storage pool.'),
                              redirect=redirect)
Beispiel #2
0
    def handle(self, request, data):
        try:

            body = {
                    'pool': {
                        'name': data['name'],
                        'storageGroupId': data['storage_group'],
                        'replicationFactor': data['replication_factor'],
                        'tag': data['tag'],
                        'clusterId': '0',
                        'createdBy': 'VSM'
                    }
            }
            rsp, ret = vsm_api.create_storage_pool(request,body=body)

            res = str(ret['message']).strip( )
            if res.startswith('pool') and res.endswith('created'):
                messages.success(request,
                                _('Successfully created storage pool: %s')
                                % data['name'])
            else:
                messages.error(request,
                                _('Because %s, failed to create storage pool')
                                % ret['message'])

            return ret
        except:
            redirect = reverse("horizon:vsm:poolsmanagement:index")
            exceptions.handle(request,
                              _('Unable to create storage pool.'),
                              redirect=redirect)
Beispiel #3
0
    def handle(self, request, data):
        try:
            body = {
                'pool': {
                    'name': data['name'],
                    'storageGroupId': data['storage_group'],
                    'tag': data['tag'],
                    'clusterId': '0',
                    'createdBy': 'VSM',
                    'ecProfileId': data['ec_profile'],
                    'ecFailureDomain': data['ec_failure_domain'],
                    'enablePoolQuota': data['enable_pool_quota'],
                    'poolQuota': data['pool_quota'],
                }
            }
            rsp, ret = vsm_api.create_storage_pool(request, body=body)

            res = str(ret['message']).strip()
            if res.startswith('pool') and res.endswith('created'):
                messages.success(
                    request,
                    _('Successfully created storage pool: %s') % data['name'])
            else:
                messages.error(
                    request,
                    _('%s Failed to create storage pool!') % ret['message'])

            return ret
        except:
            redirect = reverse("horizon:vsm:poolsmanagement:index")
            exceptions.handle(request,
                              _('Unable to create storage pool.'),
                              redirect=redirect)
Beispiel #4
0
def create_replicated_pool(request):
    status = ""
    msg = ""
    body = json.loads(request.body)
    print body
    try:
        rsp, ret = vsmapi.create_storage_pool(request,body=body)
        res = str(ret['message']).strip()
        if res.startswith('pool') and res.endswith('created'):
            status = "OK"
            msg = "Created storage pool successfully!"
    except:
        status = "Failed"
        msg = "Create Replication Pool Failed!"
    resp = dict(message=msg, status=status)
    resp = json.dumps(resp)
    return HttpResponse(resp)
Beispiel #5
0
def create_replicated_pool(request):
    status = ""
    msg = ""
    body = json.loads(request.body)
    print body
    try:
        rsp, ret = vsmapi.create_storage_pool(request, body=body)
        res = str(ret['message']).strip()
        if res.startswith('pool') and res.endswith('created'):
            status = "OK"
            msg = "Created storage pool successfully!"
    except:
        status = "Failed"
        msg = "Create Replication Pool Failed!"
    resp = dict(message=msg, status=status)
    resp = json.dumps(resp)
    return HttpResponse(resp)
def create_replicated_pool(request):
    status = ""
    msg = ""
    body = json.loads(request.body)
    print body
    try:
        rsp, ret = vsmapi.create_storage_pool(request, body=body)
        res = str(ret["message"]).strip()
        if res.startswith("pool") and res.endswith("created"):
            status = "OK"
            msg = "Created storage pool successfully!"
    except:
        status = "Failed"
        msg = "Remove Cache Tier Failed!"
    resp = dict(message=msg, status=status)
    resp = json.dumps(resp)
    return HttpResponse(resp)