def init(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        fusionstorIsReady = False
        fusionstorIsReady = lichbd.lichbd_check_cluster_is_ready(
            cmd.monHostnames, cmd.sshUsernames, cmd.sshPasswords)

        if fusionstorIsReady is not True:
            lichbd.lichbd_create_cluster(cmd.monHostnames, cmd.sshPasswords)
            for monHostname in cmd.monHostnames:
                lichbd.lichbd_add_disks(monHostname)

        existing_pools = lichbd.lichbd_lspools()
        for pool in cmd.pools:
            if pool.predefined and pool.name not in existing_pools:
                raise Exception(
                    'cannot find pool[%s] in the fusionstor cluster, you must create it manually'
                    % pool.name)
            elif pool.name not in existing_pools:
                lichbd.lichbd_mkpool(pool.name)

        rsp = InitRsp()
        rsp.fsid = lichbd.lichbd_get_fsid()
        rsp.userKey = "AQDVyu9VXrozIhAAuT2yMARKBndq9g3W8KUQvw=="
        self._set_capacity_to_response(rsp)

        return jsonobject.dumps(rsp)
    def init(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])

        existing_pools = lichbd.lichbd_lspools()
        for pool in cmd.pools:
            if pool.predefined and pool.name not in existing_pools:
                raise Exception('cannot find pool[%s] in the fusionstor cluster, you must create it manually' % pool.name)
            elif pool.name not in existing_pools:
                lichbd.lichbd_mkpool(pool.name)

        rsp = InitRsp()
        rsp.fsid = "96a91e6d-892a-41f4-8fd2-4a18c9002425"
        self._set_capacity_to_response(rsp)

        return jsonobject.dumps(rsp)
Exemple #3
0
    def init(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])

        existing_pools = lichbd.lichbd_lspools()
        for pool in cmd.pools:
            if pool.predefined and pool.name not in existing_pools:
                raise Exception('cannot find pool[%s] in the fusionstor cluster, you must create it manually' % pool.name)
            elif pool.name not in existing_pools:
                lichbd.lichbd_mkpool(pool.name)

        rsp = InitRsp()
        rsp.fsid = lichbd.lichbd_get_fsid()
        self._set_capacity_to_response(rsp)

        return jsonobject.dumps(rsp)
    def init(self, req):
        cmd = jsonobject.loads(req[http.REQUEST_BODY])
        fusionstorIsReady = False
        fusionstorIsReady = lichbd.lichbd_check_cluster_is_ready(cmd.monHostnames, cmd.sshUsernames, cmd.sshPasswords)

        if fusionstorIsReady is not True:
            lichbd.lichbd_create_cluster(cmd.monHostnames, cmd.sshPasswords)
            for monHostname in cmd.monHostnames:
                lichbd.lichbd_add_disks(monHostname)

        existing_pools = lichbd.lichbd_lspools()
        for pool in cmd.pools:
            if pool.predefined and pool.name not in existing_pools:
                raise Exception('cannot find pool[%s] in the fusionstor cluster, you must create it manually' % pool.name)
            elif pool.name not in existing_pools:
                lichbd.lichbd_mkpool(pool.name)

        rsp = InitRsp()
        rsp.fsid = lichbd.lichbd_get_fsid()
        rsp.userKey = "AQDVyu9VXrozIhAAuT2yMARKBndq9g3W8KUQvw=="
        self._set_capacity_to_response(rsp)

        return jsonobject.dumps(rsp)