Package com.cloud.ucs.database

Examples of com.cloud.ucs.database.UcsManagerVO


        if (bvo.getHostId() != null) {
            throw new CloudRuntimeException(String.format("blade[id:%s,  dn:%s] has been associated with host[id:%s]", bvo.getId(), bvo.getDn(), bvo.getHostId()));
        }

        UcsManagerVO mgrvo = ucsDao.findById(cmd.getUcsManagerId());
        String cookie = getCookie(cmd.getUcsManagerId());
        String pdn = cloneProfile(mgrvo.getId(), cmd.getProfileDn(), "profile-for-blade-" + bvo.getId());
        String ucscmd = UcsCommands.associateProfileToBlade(cookie, pdn, bvo.getDn());
        UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
        String res = client.call(ucscmd);
        int count = 0;
        int timeout = 3600;
        while (count < timeout) {
            if (isBladeAssociated(mgrvo.getId(), bvo.getDn())) {
                break;
            }

            try {
                TimeUnit.SECONDS.sleep(2);
View Full Code Here


        if (bvo.getHostId() != null) {
            throw new CloudRuntimeException(String.format("blade[id:%s,  dn:%s] has been associated with host[id:%s]", bvo.getId(), bvo.getDn(), bvo.getHostId()));
        }

        UcsManagerVO mgrvo = ucsDao.findById(cmd.getUcsManagerId());
        String cookie = getCookie(cmd.getUcsManagerId());
        String instantiateTemplateCmd = UcsCommands.instantiateTemplate(cookie, cmd.getTemplateDn(), profileName);
        UcsHttpClient http = new UcsHttpClient(mgrvo.getUrl());
        String res = http.call(instantiateTemplateCmd);
        XmlObject xo = XmlObjectParser.parseFromString(res);
        String profileDn = xo.get("outConfig.lsServer.dn");
        String ucscmd = UcsCommands.associateProfileToBlade(cookie, profileDn, bvo.getDn());
        res = http.call(ucscmd);
        int count = 0;
        int timeout = 3600;
        while (count < timeout) {
            if (isBladeAssociated(mgrvo.getId(), bvo.getDn())) {
                break;
            }

            try {
                TimeUnit.SECONDS.sleep(2);
View Full Code Here

        DataCenterVO vo = dcDao.findById(zoneId);
        return vo.getUuid();
    }
   
    private String ucsManagerIdToUuid(Long ucsMgrId) {
        UcsManagerVO vo = ucsDao.findById(ucsMgrId);
        return vo.getUuid();
    }
View Full Code Here

    @Override
    public ListResponse<UcsManagerResponse> listUcsManager(ListUcsManagerCmd cmd) {
        List<UcsManagerResponse> rsps = new ArrayList<UcsManagerResponse>();
        ListResponse<UcsManagerResponse> response = new ListResponse<UcsManagerResponse>();
      if (cmd.getId() != null) {
        UcsManagerVO vo = ucsDao.findById(cmd.getId());
            UcsManagerResponse rsp = new UcsManagerResponse();
            rsp.setObjectName("ucsmanager");
            rsp.setId(vo.getUuid());
            rsp.setName(vo.getName());
            rsp.setUrl(vo.getUrl());
            rsp.setZoneId(zoneIdToUuid(vo.getZoneId()));
            rsps.add(rsp);
            response.setResponses(rsps);
            return response;
      }

        SearchCriteria<UcsManagerVO> sc = ucsDao.createSearchCriteria();
        sc.addAnd("zoneId", Op.EQ, cmd.getZoneId());
        List<UcsManagerVO> vos = ucsDao.search(sc, null);

        for (UcsManagerVO vo : vos) {
            UcsManagerResponse rsp = new UcsManagerResponse();
            rsp.setObjectName("ucsmanager");
            rsp.setId(vo.getUuid());
            rsp.setName(vo.getName());
            rsp.setUrl(vo.getUrl());
            rsp.setZoneId(zoneIdToUuid(vo.getZoneId()));
            rsps.add(rsp);
        }
        response.setResponses(rsps);
        return response;
    }
View Full Code Here

    @DB
    public ListResponse<UcsBladeResponse> refreshBlades(Long mgrId) {
        SyncBladesThread synct = new SyncBladesThread();
        synct.run();

        UcsManagerVO mgrvo = ucsDao.findById(mgrId);
        List<ComputeBlade> blades = listBlades(mgrvo.getId());
        for (ComputeBlade b : blades) {
            SearchCriteria<UcsBladeVO> sc = bladeDao.createSearchCriteria();
            sc.addAnd("dn", Op.EQ, b.getDn());
            UcsBladeVO vo = bladeDao.findOneBy(sc);
            if (vo == null) {
View Full Code Here

    }

    @Override
    public UcsBladeResponse disassociateProfile(DisassociateUcsProfileCmd cmd) {
        UcsBladeVO blade = bladeDao.findById(cmd.getBladeId());
        UcsManagerVO mgrvo = ucsDao.findById(blade.getUcsManagerId());
        UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
        String cookie = getCookie(mgrvo.getId());
        String call = UcsCommands.disassociateProfileFromBlade(cookie, blade.getProfileDn());
        client.call(call);
        if (cmd.isDeleteProfile()) {
            call = UcsCommands.deleteProfile(cookie, blade.getProfileDn());
            client = new UcsHttpClient(mgrvo.getUrl());
            client.call(call);
        }
        blade.setProfileDn(null);
        bladeDao.update(blade.getId(), blade);
        UcsBladeResponse rsp = bladeVOToResponse(blade);
View Full Code Here

    }
   
    @Override
    @DB
    public UcsManagerResponse addUcsManager(AddUcsManagerCmd cmd) {
        UcsManagerVO vo = new UcsManagerVO();
        vo.setUuid(UUID.randomUUID().toString());
        vo.setPassword(cmd.getPassword());
        vo.setUrl(cmd.getUrl());
        vo.setUsername(cmd.getUsername());
        vo.setZoneId(cmd.getZoneId());
        vo.setName(cmd.getName());

        Transaction txn = Transaction.currentTxn();
        txn.start();
        ucsDao.persist(vo);
        txn.commit();
        UcsManagerResponse rsp = new UcsManagerResponse();
        rsp.setId(String.valueOf(vo.getId()));
        rsp.setName(vo.getName());
        rsp.setUrl(vo.getUrl());
        rsp.setZoneId(String.valueOf(vo.getZoneId()));
       
        discoverBlades(vo);
       
        return rsp;
    }
View Full Code Here

    private String getCookie(Long ucsMgrId) {
        try {
            String cookie = cookies.get(ucsMgrId);
            if (cookie == null) {
                UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
                UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
                String login = UcsCommands.loginCmd(mgrvo.getUsername(), mgrvo.getPassword());
                String ret = client.call(login);
                XmlObject xo = XmlObjectParser.parseFromString(ret);
                cookie = xo.get("outCookie");
                cookies.put(ucsMgrId, cookie);
            }
View Full Code Here

        }
    }

    private List<ComputeBlade> listBlades(Long ucsMgrId) {
        String cookie = getCookie(ucsMgrId);
        UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
        UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
        String cmd = UcsCommands.listComputeBlades(cookie);
        String ret = client.call(cmd);
        return ComputeBlade.fromXmString(ret);
    }
View Full Code Here

        return ComputeBlade.fromXmString(ret);
    }

    private List<UcsProfile> getUcsProfiles(Long ucsMgrId) {
        String cookie = getCookie(ucsMgrId);
        UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId);
        String cmd = UcsCommands.listProfiles(cookie);
        UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
        String res = client.call(cmd);
        List<UcsProfile> profiles = UcsProfile.fromXmlString(res);
        return profiles;
    }
View Full Code Here

TOP

Related Classes of com.cloud.ucs.database.UcsManagerVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.