Exemplo n.º 1
0
def server_create(request, name, image, flavor, key_name, user_data,
	          security_groups, block_device_mapping=None,
	          block_device_mapping_v2=None, nics=None,
	          availability_zone=None, instance_count=1, admin_pass=None):
    tenant_data = request.user.authorized_tenants
    current_tenant_description = ''
    for tenant in tenant_data:
        if request.user.tenant_name ==tenant.name:
            current_tenant_description = tenant.description
		

    if request.method =='POST' and request.POST.has_key('workload_type'):
	return Server(novaclient(request).servers.create(
		name, image, flavor, userdata=user_data,
		security_groups=security_groups,
		key_name=key_name, block_device_mapping=block_device_mapping,
		block_device_mapping_v2=block_device_mapping_v2,
		nics=nics, availability_zone=availability_zone,
		min_count=instance_count, admin_pass=admin_pass,workload_type=request.POST['workload_type'],
		policy=current_tenant_description), request)


    else:
	return Server(novaclient(request).servers.create(
		name, image, flavor, userdata=user_data,
		security_groups=security_groups,
		key_name=key_name, block_device_mapping=block_device_mapping,
		block_device_mapping_v2=block_device_mapping_v2,
		nics=nics, availability_zone=availability_zone,
		min_count=instance_count, admin_pass=admin_pass), request)
Exemplo n.º 2
0
    def update(self, request, **kwargs):
        self.choices = []
        flavors = nova.novaclient(request).flavors.list()

        # If no requirements are present, return all the flavors.
        if not hasattr(self, 'requirements'):
            self.choices = [(flavor.name, flavor.name) for flavor in flavors]
        else:
            for flavor in flavors:
                # If a flavor doesn't meet a minimum requirement,
                # do not add it to the options list and skip to the
                # next flavor.
                if flavor.vcpus < self.requirements.get('min_vcpus', 0):
                    continue
                if flavor.disk < self.requirements.get('min_disk', 0):
                    continue
                if flavor.ram < self.requirements.get('min_memory_mb', 0):
                    continue
                if 'max_vcpus' in self.requirements:
                    if flavor.vcpus > self.requirements['max_vcpus']:
                        continue
                if 'max_disk' in self.requirements:
                    if flavor.disk > self.requirements['max_disk']:
                        continue
                if 'max_memory_mb' in self.requirements:
                    if flavor.ram > self.requirements['max_memory_mb']:
                        continue
                self.choices.append((flavor.name, flavor.name))
        # Search through selected flavors
        for flavor_name, flavor_name in self.choices:
            if 'medium' in flavor_name:
                self.initial = flavor_name
                break
Exemplo n.º 3
0
    def update(self, request, environment_id, **kwargs):
        self.update_network_params(request, environment_id)

        if self.network_topology == 'nova':
            try:
                network_list = nova.novaclient(request).networks.list()
                ip_ranges = [network.cidr for network in network_list]
                ranges = ', '.join(ip_ranges)
            except StandardError:
                ip_ranges, ranges = [], ''
            if ip_ranges:
                self.help_text = _('Select IP from '
                                   'available range: {0} ').format(ranges)
            else:
                self.help_text = _('Specify valid fixed IP')
            self.validators = [self.make_nova_validator(request, ip_ranges)]
        elif self.network_topology in ('routed', 'manual'):
            if self.network_topology == 'manual' and self.router_id is None:
                raise muranoclient_exc.NotFound(_(
                    'Router is not found. You should create one explicitly.'))
            self.widget.attrs['placeholder'] = self.existing_subnet
            self.validators = [self.make_neutron_validator()]
        else:  # 'flat' topology
            raise NotImplementedError('Flat topology is not implemented yet')
        self.error_messages['invalid'] = \
            django_validator.validate_ipv4_address.message
Exemplo n.º 4
0
    def update(self, request, environment_id, **kwargs):
        self.update_network_params(request, environment_id)

        if self.network_topology == 'nova':
            try:
                network_list = nova.novaclient(request).networks.list()
                ip_ranges = [network.cidr for network in network_list]
                ranges = ', '.join(ip_ranges)
            except StandardError:
                ip_ranges, ranges = [], ''
            if ip_ranges:
                self.help_text = _('Select IP from '
                                   'available range: {0} ').format(ranges)
            else:
                self.help_text = _('Specify valid fixed IP')
            self.validators = [self.make_nova_validator(request, ip_ranges)]
        elif self.network_topology in ('routed', 'manual'):
            if self.network_topology == 'manual' and self.router_id is None:
                raise muranoclient_exc.NotFound(
                    _('Router is not found. You should create one explicitly.')
                )
            self.widget.attrs['placeholder'] = self.existing_subnet
            self.validators = [self.make_neutron_validator()]
        else:  # 'flat' topology
            raise NotImplementedError('Flat topology is not implemented yet')
        self.error_messages['invalid'] = \
            django_validator.validate_ipv4_address.message
    def update(self, request, **kwargs):
        self.choices = []
        flavors = nova.novaclient(request).flavors.list()

        # If no requirements are present, return all the flavors.
        if not hasattr(self, 'requirements'):
            self.choices = [(flavor.name, flavor.name) for flavor in flavors]
        else:
            for flavor in flavors:
                # If a flavor doesn't meet a minimum requirement,
                # do not add it to the options list and skip to the
                # next flavor.
                if flavor.vcpus < self.requirements.get('min_vcpus', 0):
                    continue
                if flavor.disk < self.requirements.get('min_disk', 0):
                    continue
                if flavor.ram < self.requirements.get('min_memory_mb', 0):
                    continue
                if 'max_vcpus' in self.requirements:
                    if flavor.vcpus > self.requirements['max_vcpus']:
                        continue
                if 'max_disk' in self.requirements:
                    if flavor.disk > self.requirements['max_disk']:
                        continue
                if 'max_memory_mb' in self.requirements:
                    if flavor.ram > self.requirements['max_memory_mb']:
                        continue
                self.choices.append((flavor.name, flavor.name))
        # Search through selected flavors
        for flavor_name, flavor_name in self.choices:
            if 'medium' in flavor_name:
                self.initial = flavor_name
                break
Exemplo n.º 6
0
def get_device_usage(request, device_id):
    if device_id is None:
        raise nova_exceptions.ResourceNotFound

    usage = wrs_pci.PciDevicesManager(
        novaclient(request)).list(device=device_id)
    return DeviceUsage(usage[0])
Exemplo n.º 7
0
 def update(self, request, initial):
     self.choices = [(flavor.name, flavor.name)
                     for flavor in novaclient(request).flavors.list()]
     for flavor in self.choices:
         if 'medium' in flavor[1]:
             self.initial = flavor[0]
             break
Exemplo n.º 8
0
 def update(self, request, form=None, **kwargs):
     self.choices = [('', _('No keypair'))]
     with helpers.current_region(request,
                                 getattr(form, 'region', None)):
         keypairs = nova.novaclient(request).keypairs.list()
     for keypair in sorted(keypairs, key=lambda e: e.name):
         self.choices.append((keypair.name, keypair.name))
Exemplo n.º 9
0
 def update(self, request, initial):
     self.choices = [(flavor.name, flavor.name) for flavor in
                     novaclient(request).flavors.list()]
     for flavor in self.choices:
         if 'medium' in flavor[1]:
             self.initial = flavor[0]
             break
Exemplo n.º 10
0
 def update(self, request, **kwargs):
     try:
         availability_zones = nova.novaclient(request).availability_zones.list(detailed=False)
     except Exception:
         availability_zones = []
         exceptions.handle(request, _("Unable to retrieve  availability zones."))
     az_choices = [(az.zoneName, az.zoneName) for az in availability_zones if az.zoneState['available']]
     if not az_choices:
         az_choices.insert(0, ("", _("No availability zones available")))
     else:
         az_choices.insert(0, ("", _("Select Availability Zone")))
     self.choices = az_choices
Exemplo n.º 11
0
 def update(self, request, initial):
     try:
         network_list = novaclient(request).networks.list()
         ip_ranges = [network.cidr for network in network_list]
         ranges = ', '.join(ip_ranges)
     except StandardError:
         ip_ranges, ranges = [], ''
     if ip_ranges:
         self.help_text = _('Select IP from available range: ' + ranges)
     else:
         self.help_text = _('Specify valid fixed IP')
     self.validators = [self.validate_cluster_ip(request, ip_ranges)]
     self.error_messages = {'invalid': validate_ipv4_address.message}
Exemplo n.º 12
0
 def update(self, request, initial):
     try:
         network_list = novaclient(request).networks.list()
         ip_ranges = [network.cidr for network in network_list]
         ranges = ', '.join(ip_ranges)
     except StandardError:
         ip_ranges, ranges = [], ''
     if ip_ranges:
         self.help_text = _('Select IP from available range: ' + ranges)
     else:
         self.help_text = _('Specify valid fixed IP')
     self.validators = [self.validate_cluster_ip(request, ip_ranges)]
     self.error_messages = {'invalid': validate_ipv4_address.message}
Exemplo n.º 13
0
    def update(self, request, **kwargs):
        try:
            availability_zones = nova.novaclient(
                request).availability_zones.list(detailed=False)
        except Exception:
            availability_zones = []
            exceptions.handle(request,
                              _("Unable to retrieve  availability zones."))

        az_choices = [(az.zoneName, az.zoneName) for az in availability_zones
                      if az.zoneState]
        if not az_choices:
            az_choices.insert(0, ("", _("No availability zones available")))

        self.choices = az_choices
Exemplo n.º 14
0
 def perform_checking(ip):
     validate_ipv4_address(ip)
     if not all_matching_cidrs(ip, ip_ranges) and ip_ranges:
         raise forms.ValidationError(_('Specified Cluster Static IP is'
                                       'not in valid IP range'))
     try:
         ip_info = novaclient(request).fixed_ips.get(ip)
     except exceptions.UNAUTHORIZED:
         exceptions.handle(
             request, _("Unable to retrieve information "
                        "about fixed IP or IP is not valid."),
             ignore=True)
     else:
         if ip_info.hostname:
             raise forms.ValidationError(
                 _('Specified Cluster Static IP is already in use'))
Exemplo n.º 15
0
    def update(self, request, initial):
        try:
            availability_zones = novaclient(request).availability_zones.\
                list(detailed=False)
        except:
            availability_zones = []
            exceptions.handle(request,
                              _("Unable to retrieve  availability zones."))

        az_choices = [(az.zoneName, az.zoneName) for az in availability_zones
                      if az.zoneState]
        if az_choices:
            az_choices.insert(0, ("", _("Select Availability Zone")))
        else:
            az_choices.insert(0, ("", _("No availability zones available")))

        self.choices = az_choices
Exemplo n.º 16
0
 def perform_checking(ip):
     validate_ipv4_address(ip)
     if not all_matching_cidrs(ip, ip_ranges) and ip_ranges:
         raise forms.ValidationError(
             _('Specified Cluster Static IP is'
               'not in valid IP range'))
     try:
         ip_info = novaclient(request).fixed_ips.get(ip)
     except exceptions.UNAUTHORIZED:
         exceptions.handle(request,
                           _("Unable to retrieve information "
                             "about fixed IP or IP is not valid."),
                           ignore=True)
     else:
         if ip_info.hostname:
             raise forms.ValidationError(
                 _('Specified Cluster Static IP is already in use'))
Exemplo n.º 17
0
    def update(self, request, form=None, **kwargs):
        choices = []
        with helpers.current_region(request,
                                    getattr(form, 'region', None)):
            flavors = nova.novaclient(request).flavors.list()

        # If no requirements are present, return all the flavors.
        if not hasattr(self, 'requirements'):
            choices = [(flavor.id, flavor.name) for flavor in flavors]
        else:
            for flavor in flavors:
                # If a flavor doesn't meet a minimum requirement,
                # do not add it to the options list and skip to the
                # next flavor.
                if flavor.vcpus < self.requirements.get('min_vcpus', 0):
                    continue
                if flavor.disk < self.requirements.get('min_disk', 0):
                    continue
                if flavor.ram < self.requirements.get('min_memory_mb', 0):
                    continue
                if 'max_vcpus' in self.requirements:
                    if flavor.vcpus > self.requirements['max_vcpus']:
                        continue
                if 'max_disk' in self.requirements:
                    if flavor.disk > self.requirements['max_disk']:
                        continue
                if 'max_memory_mb' in self.requirements:
                    if flavor.ram > self.requirements['max_memory_mb']:
                        continue
                choices.append((flavor.id, flavor.name))

        choices.sort(key=lambda e: e[1])
        self.choices = choices
        if kwargs.get('form'):
            kwargs_form_flavor = kwargs["form"].fields.get('flavor')
        else:
            kwargs_form_flavor = None
        if kwargs_form_flavor:
            self.initial = kwargs["form"]["flavor"].value()
        else:
            # Search through selected flavors
            for flavor_id, flavor_name in self.choices:
                if 'medium' in flavor_name:
                    self.initial = flavor_id
                    break
Exemplo n.º 18
0
 def perform_checking(ip):
     django_validator.validate_ipv4_address(ip)
     if not netaddr.all_matching_cidrs(ip, ip_ranges) and ip_ranges:
         raise forms.ValidationError(_("Specified Cluster Static IP is" " not in valid IP range"))
     try:
         ip_info = nova.novaclient(request).fixed_ips.get(ip)
     except exceptions.UNAUTHORIZED:
         LOG.error("Error to get information about IP address" " using novaclient")
         exceptions.handle(
             request, _("Unable to retrieve information " "about fixed IP or IP is not valid."), ignore=True
         )
     except exceptions.NOT_FOUND:
         msg = "Could not found fixed ips for ip %s" % (ip,)
         LOG.error(msg)
         exceptions.handle(request, msg, ignore=True)
     else:
         if ip_info.hostname:
             raise forms.ValidationError(_("Specified Cluster Static IP is already in use"))
Exemplo n.º 19
0
    def test_capacity_host(self, request):
        self.mox.ReplayAll()
        url_param = '?group=' + self.TEST_GROUP + '&name=' + self.TEST_NAME

        nova.novaclient(self.request).hypervisors = self.hypervisors

        hypervisor_list = self.hypervisors.list()
        context_name = hypervisor_list[0].hypervisor_hostname

        context_url = './capacity_host/detail?group=' + self.CONTEXT_GROUP + \
                      '&name=' + context_name

        res = self.client.get(INDEX_URL + url_param +
                              '&tab=capacity_group_tabs__capacity_host')

        self.assertTemplateUsed(res,
                                'admin/capacity/capacity_host/_index.html')
        self.assertEqual(res.context['detail_url'], context_url)
Exemplo n.º 20
0
    def get_az_context(self, request, detail_base='./detail'):
        context = {}

        try:
            az_list = nova.novaclient(request).availability_zones.list()
            context['az_list'] = [az.zoneName for az in az_list
                                  if az.zoneName != 'internal']
        except Exception:
            az_list = []
            context['az_list'] = []
            exceptions.handle(request,
                              _('Unable to retrieve availability zones.'))

        context.update(
            self.get_common_context(
                request, detail_base, context['az_list'],
                AZ_GROUP_NAME))
        return context
Exemplo n.º 21
0
    def update(self, request, form=None, **kwargs):
        try:
            with helpers.current_region(request, getattr(form, 'region',
                                                         None)):
                availability_zones = nova.novaclient(
                    request).availability_zones.list(detailed=False)
        except Exception:
            availability_zones = []
            exceptions.handle(request,
                              _("Unable to retrieve  availability zones."))

        az_choices = [(az.zoneName, az.zoneName) for az in availability_zones
                      if az.zoneState]
        if not az_choices:
            az_choices.insert(0, ("", _("No availability zones available")))

        az_choices.sort(key=lambda e: e[1])
        self.choices = az_choices
Exemplo n.º 22
0
    def get_host_context(self, request, detail_base='./detail'):
        context = {}

        try:
            hypervisor_list = nova.novaclient(request).hypervisors.list()
            context['host_list'] = [hypervisor.hypervisor_hostname
                                    for hypervisor in hypervisor_list]
        except Exception:
            hypervisor_list = []
            context['host_list'] = []
            exceptions.handle(request,
                              _('Unable to retrieve hosts.'))

        context.update(
            self.get_common_context(
                request, detail_base, context['host_list'],
                HOST_GROUP_NAME))
        return context
Exemplo n.º 23
0
    def get_routers(self, request, **search_opts):
        page_size = utils.get_page_size(request)
        paginate = False
        if 'paginate' in search_opts:
            paginate = search_opts.pop('paginate')
            search_opts['limit'] = page_size + 1
        if 'tenant_id' not in search_opts:
            search_opts['all_tenants'] = True

        routers_metadata = []
        nova_client = novaclient(request)
        routers = (
            neutronclient(request)
            .list_routers(**search_opts)
            .get("routers", [])
        )
        for router in routers:
            search_opts = {'name': 'ak-' + router['id'], 'all_tenants': True}
            instances = nova_client.servers.list(True, search_opts=search_opts)
            instance = instances[0] if instances else None
            image = (
                nova_client.images.get(instance.image['id'])
                if instance else None
            )
            routers_metadata.append(Router(
                id=router['id'],
                name=router['name'],
                latest=image.id == self.image_uuid if image else '',
                image_name=image.name if image else '',
                last_fetch=datetime.utcnow(),
                booted=instance.created if instance else '',
                status=router['status'],
                tenant_id=router['tenant_id'],
            ))

        has_more_data = False
        if paginate and len(routers_metadata) > page_size:
            routers_metadata.pop(-1)
            has_more_data = True
        elif paginate and len(routers_metadata) == self.api_limit:
            has_more_data = True

        return routers_metadata, has_more_data
Exemplo n.º 24
0
    def get_routers(self, request, **search_opts):
        page_size = utils.get_page_size(request)
        paginate = False
        if 'paginate' in search_opts:
            paginate = search_opts.pop('paginate')
            search_opts['limit'] = page_size + 1
        if 'tenant_id' not in search_opts:
            search_opts['all_tenants'] = True

        routers_metadata = []
        nova_client = novaclient(request)
        routers = (
            neutronclient(request)
            .list_routers(**search_opts)
            .get("routers", [])
        )
        for router in routers:
            search_opts = {'name': 'ak-' + router['id'], 'all_tenants': True}
            instances = nova_client.servers.list(True, search_opts=search_opts)
            instance = instances[0] if instances else None
            image = (
                nova_client.images.get(instance.image['id'])
                if instance else None
            )
            routers_metadata.append(Router(
                id=router['id'],
                name=router['name'],
                latest=image.id == self.image_uuid if image else '',
                image_name=image.name if image else '',
                last_fetch=datetime.utcnow(),
                booted=instance.created if instance else '',
                status=router['status'],
                tenant_id=router['tenant_id'],
            ))

        has_more_data = False
        if paginate and len(routers_metadata) > page_size:
            routers_metadata.pop(-1)
            has_more_data = True
        elif paginate and len(routers_metadata) == self.api_limit:
            has_more_data = True

        return routers_metadata, has_more_data
Exemplo n.º 25
0
    def update(self, request, **kwargs):
        self.choices = []
        flavors = nova.novaclient(request).flavors.list()

        # If no requirements are present, return all the flavors.
        if not hasattr(self, 'requirements'):
            self.choices = [(flavor.name, flavor.name) for flavor in flavors]
        else:
            for flavor in flavors:
                # If a flavor doesn't meet a minimum requirement,
                # do not add it to the options list and skip to the
                # next flavor.
                if flavor.vcpus < self.requirements.get('min_vcpus', 0):
                    continue
                if flavor.disk < self.requirements.get('min_disk', 0):
                    continue
                if flavor.ram < self.requirements.get('min_memory_mb', 0):
                    continue
                self.choices.append((flavor.name, flavor.name))
Exemplo n.º 26
0
    def test_capacity_az(self, request):
        self.mox.ReplayAll()
        url_param = '?group=' + self.TEST_GROUP + '&name=' + self.TEST_NAME

        nova.novaclient(self.request).availability_zones = \
            self.availability_zones

        availability_zone_list = self.availability_zones.list()
        for az in availability_zone_list:
            if not az.zoneName == 'internal':
                context_name = az.zoneName
                break

        context_url = './capacity_az/detail?group=' + self.CONTEXT_GROUP + \
                      '&name=' + context_name

        res = self.client.get(INDEX_URL + url_param +
                              '&tab=capacity_group_tabs__capacity_az')

        self.assertTemplateUsed(res, 'admin/capacity/capacity_az/_index.html')
        self.assertEqual(res.context['detail_url'], context_url)
Exemplo n.º 27
0
 def perform_checking(ip):
     django_validator.validate_ipv4_address(ip)
     if not netaddr.all_matching_cidrs(ip, ip_ranges) and ip_ranges:
         raise forms.ValidationError(
             _('Specified Cluster Static IP is'
               ' not in valid IP range'))
     try:
         ip_info = nova.novaclient(request).fixed_ips.get(ip)
     except exceptions.UNAUTHORIZED:
         LOG.error("Error to get information about IP address"
                   " using novaclient")
         exceptions.handle(request,
                           _("Unable to retrieve information "
                             "about fixed IP or IP is not valid."),
                           ignore=True)
     except exceptions.NOT_FOUND:
         msg = "Could not found fixed ips for ip %s" % (ip, )
         LOG.error(msg)
         exceptions.handle(request, msg, ignore=True)
     else:
         if ip_info.hostname:
             raise forms.ValidationError(
                 _('Specified Cluster Static IP is already in use'))
Exemplo n.º 28
0
    def update(self, request, environment_id, **kwargs):
        self.update_network_params(request, environment_id)

        if self.network_topology == "nova":
            try:
                network_list = nova.novaclient(request).networks.list()
                ip_ranges = [network.cidr for network in network_list]
                ranges = ", ".join(ip_ranges)
            except StandardError:
                ip_ranges, ranges = [], ""
            if ip_ranges:
                self.help_text = _("Select IP from " "available range: {0} ").format(ranges)
            else:
                self.help_text = _("Specify valid fixed IP")
            self.validators = [self.make_nova_validator(request, ip_ranges)]
        elif self.network_topology in ("routed", "manual"):
            if self.network_topology == "manual" and self.router_id is None:
                raise muranoclient_exc.NotFound(_("Router is not found. You should create one explicitly."))
            self.widget.attrs["placeholder"] = self.existing_subnet
            self.validators = [self.make_neutron_validator()]
        else:  # 'flat' topology
            raise NotImplementedError("Flat topology is not implemented yet")
        self.error_messages["invalid"] = django_validator.validate_ipv4_address.message
Exemplo n.º 29
0
def server_group_delete(request, server_group_id):
    return novaclient(request).server_groups.delete(server_group_id)
Exemplo n.º 30
0
def provider_network_get(request, providernet_id):
    return wrs_providernets.ProviderNetsManager(
        novaclient(request)).get(providernet_id)
Exemplo n.º 31
0
def get_device_usage_list(request):
    usages = wrs_pci.PciDevicesManager(novaclient(request)).list()
    return [DeviceUsage(n) for n in usages]
Exemplo n.º 32
0
def baremetalclient(request):
    nc = nova.novaclient(request)
    return baremetal.BareMetalNodeManager(nc)
Exemplo n.º 33
0
def tenant_quota_get(request, tenant_id):
    return cloud_quota(request, novaclient(request).quotas.get(tenant_id))
Exemplo n.º 34
0
def server_group_list(request, all_projects=False):
    return novaclient(request).server_groups.list(all_projects)
Exemplo n.º 35
0
def server_group_get(request, server_group_id):
    return novaclient(request).server_groups.get(server_group_id)
Exemplo n.º 36
0
def default_quota_get(request, tenant_id):
    return cloud_quota(request, novaclient(request).quotas.defaults(tenant_id))
Exemplo n.º 37
0
def tenant_quota_get(request, tenant_id):
    return cloud_quota(request, novaclient(request).quotas.get(tenant_id))
Exemplo n.º 38
0
def baremetalclient(request):
    nc = nova.novaclient(request)
    return baremetal.BareMetalNodeManager(nc)
Exemplo n.º 39
0
def _nova_network_list(request):
    nets = nova.novaclient(request).networks.list()
    for net in nets:
        net.name_or_id = net.to_dict().get('label', net.to_dict().get('id'))
    return nets
Exemplo n.º 40
0
def _nova_network_get(request, nova_net_id):
    net = nova.novaclient(request).networks.get(nova_net_id)
    net.name_or_id = net.to_dict().get('label', net.to_dict().get('id'))
    return net
Exemplo n.º 41
0
def novaclient(request):
    c = nova_api.novaclient(request)
    c.daolinets = daolinets.NetworkManager(c)
    return c
Exemplo n.º 42
0
def server_group_create(request, name, project_id, metadata, policies):
    return novaclient(request).server_groups.create(name, project_id, metadata,
                                                    policies)
Exemplo n.º 43
0
def novaclient(request):
    c = nova_api.novaclient(request)
    c.daolinets = daolinets.NetworkManager(c)
    return c
Exemplo n.º 44
0
 def update(self, request, **kwargs):
     self.choices = [('', _('No keypair'))]
     for keypair in novaclient(request).keypairs.list():
         self.choices.append((keypair.name, keypair.name))
Exemplo n.º 45
0
 def update(self, request, **kwargs):
     self.choices = [('', _('No keypair'))]
     for keypair in nova.novaclient(request).keypairs.list():
         self.choices.append((keypair.name, keypair.name))
Exemplo n.º 46
0
 def populate_instances(self, request):
     results = [(None, 'Select an instance')]
     for server in nova.novaclient(request).servers.list():
         results.append((server.networks['public'][0], server.name))
     return results
Exemplo n.º 47
0
def default_quota_get(request, tenant_id):
    return cloud_quota(request, novaclient(request).quotas.defaults(tenant_id))
Exemplo n.º 48
0
def get_detail_usage(request, device_id):
    usages = wrs_pci.PciDevicesManager(novaclient(request)).get(device_id)
    return [DetailUsage(n) for n in usages]
Exemplo n.º 49
0
def _firewall(request):
    client = novaclient(request)
    return d_firewalls.FirewallManager(client)
Exemplo n.º 50
0
def _group(request):
    client = novaclient(request)
    return d_groups.SecurityGroupManager(client)
 def update(self, request, **kwargs):
     self.choices = [('', _('No keypair'))]
     for keypair in sorted(nova.novaclient(request).keypairs.list(),
                           key=lambda e: e.name):
         self.choices.append((keypair.name, keypair.name))
Exemplo n.º 52
0
def _gateway(request):
    client = novaclient(request)
    return d_gateways.GatewayManager(client)