Ejemplo n.º 1
0
    def __init__(self, origin, prefix, pool):
        super(OpenstackClone, self).__init__(origin, prefix, pool)
        self.platform = origin.short_name

        from core.utils import openstack_utils
        self.nova_client = openstack_utils.nova_client()
        self.network_client = openstack_utils.neutron_client()

        self.network_id = self.get_network_id()
        self.network_name = self.get_network_name(self.network_id)
Ejemplo n.º 2
0
    def __init__(self, origin):
        self.client = openstack_utils.nova_client()
        self.id = origin.id
        self.name = origin.name
        self.short_name = origin.name.split(
            config.OPENSTACK_PLATFORM_NAME_PREFIX)[1]
        self.min_disk = origin.min_disk
        self.min_ram = origin.min_ram

        try:
            self.flavor_id = origin.instance_type_flavorid
            self.flavor_name = (
                lambda s: s.client.flavors.get(s.flavor_id).name)(self)
        except Exception:
            self.flavor_name = config.OPENSTACK_DEFAULT_FLAVOR
Ejemplo n.º 3
0
 def _get_nova_client():
     from core.utils import openstack_utils
     return openstack_utils.nova_client()
Ejemplo n.º 4
0
    def __init__(self, origin, prefix, pool):
        super(OpenstackClone, self).__init__(origin, prefix, pool)
        self.platform = origin.short_name

        from core.utils import openstack_utils
        self.nova_client = openstack_utils.nova_client()
Ejemplo n.º 5
0
 def images():
     return openstack_utils.nova_client().glance.list()
Ejemplo n.º 6
0
 def flavor_params(cls, flavor_name):
     return openstack_utils.nova_client().flavors.find(
         name=flavor_name).to_dict()
Ejemplo n.º 7
0
 def limits(cls, if_none):
     return openstack_utils.nova_client().limits.get().to_dict().get(
         'absolute', if_none)