Exemplo n.º 1
0
    def refresh(self, cloud_name=None):
        print "Refershing cloud %s" % cloud_name
        servers = {}
        cloud = None

        if(cloud_name is None):
            all_clouds = self.clouds.keys()
            for cloud_name in all_clouds:
                try:
                    type = self.clouds[cloud_name]['cm_type']

                    if type == 'openstack':
                        cloud = openstack(cloud_name)

                    elif type == 'eucalyptus':
                        # Where do i find the project name ? Is there a defaul
                        # one ?
                        cloud = eucalyptus(cloud_name, 'fg-82')

                    elif type == 'azure':
                        cloud = azure.cm_azure()

                    cloud.refresh()
                    self.clouds[cloud_name]['flavors'] = cloud.flavors
                    self.clouds[cloud_name]['images'] = cloud.images
                    self.clouds[cloud_name]['servers'] = cloud.servers

                except Exception, e:
                    print e
Exemplo n.º 2
0
    def refresh(self, cloud_name=None):
        print "Refershing cloud %s" % cloud_name
        servers = {}
        cloud = None

        if (cloud_name is None):
            all_clouds = self.clouds.keys()
            for cloud_name in all_clouds:
                try:
                    type = self.clouds[cloud_name]['cm_type']

                    if type == 'openstack':
                        cloud = openstack(cloud_name)

                    elif type == 'eucalyptus':
                        # Where do i find the project name ? Is there a defaul
                        # one ?
                        cloud = eucalyptus(cloud_name, 'fg-82')

                    elif type == 'azure':
                        cloud = azure.cm_azure()

                    cloud.refresh()
                    self.clouds[cloud_name]['flavors'] = cloud.flavors
                    self.clouds[cloud_name]['images'] = cloud.images
                    self.clouds[cloud_name]['servers'] = cloud.servers

                except Exception, e:
                    print e
Exemplo n.º 3
0
        else:
            try:
                type = self.clouds[cloud_name]['cm_type']

                if type == 'openstack':
                    cloud = openstack(cloud_name)

                elif type == 'eucalyptus':
                    # Where do i find the project name ? Is there a defaul one ?
                    # this is obvious;ly wrong as the tennent comes from profile
                    # TODO EUCALYPTUS DOES NOT YET WORK

                    cloud = eucalyptus(cloud_name, 'fg-82')

                elif type == 'azure':
                    cloud = azure.cm_azure()

                cloud.refresh()
                self.clouds[cloud_name]['flavors'] = cloud.flavors
                self.clouds[cloud_name]['images'] = cloud.images
                self.clouds[cloud_name]['servers'] = cloud.servers

            except Exception, e:
                print e
        return cloud

    def update(self, name, type):
        servers = self.refresh(name)
        self.clouds[name].update({'name': name,
                                  'cm_type': type,
                                  "servers": servers})
Exemplo n.º 4
0
        else:
            try:
                type = self.clouds[cloud_name]['cm_type']

                if type == 'openstack':
                    cloud = openstack(cloud_name)

                elif type == 'eucalyptus':
                    # Where do i find the project name ? Is there a defaul one ?
                    # this is obvious;ly wrong as the tennent comes from profile
                    # TODO EUCALYPTUS DOES NOT YET WORK

                    cloud = eucalyptus(cloud_name, 'fg-82')

                elif type == 'azure':
                    cloud = azure.cm_azure()

                cloud.refresh()
                self.clouds[cloud_name]['flavors'] = cloud.flavors
                self.clouds[cloud_name]['images'] = cloud.images
                self.clouds[cloud_name]['servers'] = cloud.servers

            except Exception, e:
                print e
        return cloud

    def update(self, name, type):
        servers = self.refresh(name)
        self.clouds[name].update({
            'name': name,
            'cm_type': type,