示例#1
0
    def get_iaas_history(self):
        ha = self._db.get_iaas_history()

        l = []
        for h in ha:
            svc = SVCContainer(self._db, h.service, None, log=self._log, boot=False, ready=True, terminate=False)
            con = cb_iaas.iaas_get_con(svc)
            try:
                inst = con.find_instance(h.instance_id)
            except:
                inst = None
            i = IaaSHistory(inst, h.instance_id, svc)
            l.append(i)
        return l
示例#2
0
    def boot_validate(self):
        bo = self._bo
        connnections = {}
        for level in bo.levels:
            for s in level.services:
                svc = self._boot_top.get_service(s.name)

                cb_iaas.iaas_validate(svc, self._log)

                hash_str = ""
                iaas_url = svc.get_dep("iaas_url")
                if iaas_url:
                    hash_str = hash_str + iaas_url
                hash_str = hash_str + "/"
                iaas = svc.get_dep("iaas")
                if iaas:
                    hash_str = hash_str + iaas
                hash_str = hash_str + "/"
                key = svc.get_dep("iaas_key")
                if key:
                    hash_str = hash_str + key
                hash_str = hash_str + "/"
                secret = svc.get_dep("iaas_secret")
                if secret:
                    hash_str = hash_str + secret

                if hash_str not in connnections.keys():
                    con = cb_iaas.iaas_get_con(svc, key=key, secret=secret, iaasurl=iaas_url)
                    #con = cb_iaas.iaas_get_con(svc)
                    connnections[hash_str] = (con, [svc])
                else:
                    (con, svc_list) = connnections[hash_str]
                    svc_list.append(svc)

        exception_list = []
        for (con, svc_list) in connnections.values():
            try:
                con.get_all_instances()
            except Exception, ex:
                # this means that there is a problem connection with all the associated services
                names = ""
                d = ""
                for svc in svc_list:
                    exception_list.append((svc, ex,))
                    names = names + d + svc.name
                    d = ","
                msg = "The following services have problems with their IaaS configuration.  Please check the launch plan to verify the iaas configuration is correct. %s || %s" % (names, str(ex))
                cloudinitd.log(self._log, logging.ERROR, msg)