Example #1
0
def create_storage_group(request):
    status = ""
    msg = ""
    body = json.loads(request.body)
    try:
        rsp = vsmapi.storage_group_create(request, body=body)
        status = "OK"
        msg = "Add Cache Tier Successfully!"
    except ex:
        print ex
        status = "Failed"
        msg = "Add Cache Tier Failed!"

    resp = dict(message=msg, status=status)
    resp = json.dumps(resp)
    return HttpResponse(resp)
Example #2
0
File: views.py Project: hl10502/vsm
def create_storage_group(request):
    status = ""
    msg = ""
    body = json.loads(request.body)
    try:
        rsp = vsmapi.storage_group_create(request, body=body)
        status = "OK"
        msg = "Add Cache Tier Successfully!"
    except ex:
        print ex
        status = "Failed"
        msg = "Add Cache Tier Failed!"

    resp = dict(message=msg, status=status)
    resp = json.dumps(resp)
    return HttpResponse(resp)
    def handle(self, request, data):
        # TODO deliver a cluster id in data
        data['cluster_id'] = 1
        #try:
        if True:
            LOG.debug("DEBUG in storage groups, %s" % str(data))
            body = {
                    'storage_group': {
                        'name': data['name'],
                        'friendly_name': data['friendly_name'],
                        'storage_class': data['storage_class'],
                        'cluster_id': data['cluster_id']
                    }
            }
            LOG.debug("DEBUG in handle body %s" % str(body))
            rsp = vsm_api.storage_group_create(request, body=body)
            LOG.debug("DEBUG in storage groups" + str(rsp))

            messages.success(request,
                     _('Successfully created Storage Group: %s')
                     % data['name'])
            return True
    def handle(self, request, data):
        # TODO deliver a cluster id in data
        data['cluster_id'] = 1
        #try:
        if True:
            LOG.error("DEBUG in storage groups, %s" % str(data))
            body = {
                'storage_group': {
                    'name': data['name'],
                    'friendly_name': data['friendly_name'],
                    'storage_class': data['storage_class'],
                    'cluster_id': data['cluster_id']
                }
            }
            LOG.error("DEBUG in handle body %s" % str(body))
            rsp = vsm_api.storage_group_create(request, body=body)
            LOG.error("DEBUG in storage groups" + str(rsp))

            messages.success(
                request,
                _('Successfully created Storage Group: %s') % data['name'])
            return True