diff --git a/horizon/dashboards/nova/images_and_snapshots/images/forms.py b/horizon/dashboards/nova/images_and_snapshots/images/forms.py index 2e6d84ae1..39b5d1c33 100644 --- a/horizon/dashboards/nova/images_and_snapshots/images/forms.py +++ b/horizon/dashboards/nova/images_and_snapshots/images/forms.py @@ -99,10 +99,9 @@ class LaunchForm(forms.SelfHandlingForm): required=False, help_text=_("Which keypair to use for " "authentication.")) - count = forms.CharField(label=_("Instance Count"), + count = forms.IntegerField(label=_("Instance Count"), required=True, initial=1, - widget=forms.TextInput(), help_text=_("Number of instances to launch.")) security_groups = forms.MultipleChoiceField( label=_("Security Groups"), @@ -156,7 +155,7 @@ class LaunchForm(forms.SelfHandlingForm): normalize_newlines(data.get('user_data')), data.get('security_groups'), dev_mapping, - instance_count=int(data.get('count'))) + instance_count=data.get('count')) messages.success(request, _('Instance "%s" launched.') % data["name"]) except: diff --git a/horizon/dashboards/syspanel/flavors/forms.py b/horizon/dashboards/syspanel/flavors/forms.py index cb940e07c..809535207 100644 --- a/horizon/dashboards/syspanel/flavors/forms.py +++ b/horizon/dashboards/syspanel/flavors/forms.py @@ -35,19 +35,19 @@ class CreateFlavor(forms.SelfHandlingForm): # flavorid is required in novaclient flavor_id = forms.IntegerField(label=_("Flavor ID")) name = forms.CharField(max_length="25", label=_("Name")) - vcpus = forms.CharField(max_length="5", label=_("VCPUs")) - memory_mb = forms.CharField(max_length="5", label=_("Memory MB")) - disk_gb = forms.CharField(max_length="5", label=_("Root Disk GB")) - eph_gb = forms.CharField(max_length="5", label=_("Ephemeral Disk GB")) + vcpus = forms.IntegerField(label=_("VCPUs")) + memory_mb = forms.IntegerField(label=_("Memory MB")) + disk_gb = forms.IntegerField(label=_("Root Disk GB")) + eph_gb = forms.IntegerField(label=_("Ephemeral Disk GB")) def handle(self, request, data): api.flavor_create(request, data['name'], - int(data['memory_mb']), - int(data['vcpus']), - int(data['disk_gb']), - int(data['flavor_id']), - ephemeral=int(data['eph_gb'])) + data['memory_mb'], + data['vcpus'], + data['disk_gb'], + data['flavor_id'], + ephemeral=data['eph_gb']) msg = _('%s was successfully added to flavors.') % data['name'] LOG.info(msg) messages.success(request, msg) diff --git a/horizon/dashboards/syspanel/projects/forms.py b/horizon/dashboards/syspanel/projects/forms.py index 59086a856..340dc28de 100644 --- a/horizon/dashboards/syspanel/projects/forms.py +++ b/horizon/dashboards/syspanel/projects/forms.py @@ -107,16 +107,16 @@ class UpdateTenant(forms.SelfHandlingForm): class UpdateQuotas(forms.SelfHandlingForm): tenant_id = forms.CharField(label=_("ID (name)"), widget=forms.TextInput(attrs={'readonly': 'readonly'})) - metadata_items = forms.CharField(label=_("Metadata Items")) - injected_files = forms.CharField(label=_("Injected Files")) - injected_file_content_bytes = forms.CharField(label=_("Injected File " + metadata_items = forms.IntegerField(label=_("Metadata Items")) + injected_files = forms.IntegerField(label=_("Injected Files")) + injected_file_content_bytes = forms.IntegerField(label=_("Injected File " "Content Bytes")) - cores = forms.CharField(label=_("VCPUs")) - instances = forms.CharField(label=_("Instances")) - volumes = forms.CharField(label=_("Volumes")) - gigabytes = forms.CharField(label=_("Gigabytes")) - ram = forms.CharField(label=_("RAM (in MB)")) - floating_ips = forms.CharField(label=_("Floating IPs")) + cores = forms.IntegerField(label=_("VCPUs")) + instances = forms.IntegerField(label=_("Instances")) + volumes = forms.IntegerField(label=_("Volumes")) + gigabytes = forms.IntegerField(label=_("Gigabytes")) + ram = forms.IntegerField(label=_("RAM (in MB)")) + floating_ips = forms.IntegerField(label=_("Floating IPs")) def handle(self, request, data): try: @@ -126,7 +126,7 @@ class UpdateQuotas(forms.SelfHandlingForm): injected_file_content_bytes=data['injected_file_content_bytes'], volumes=data['volumes'], gigabytes=data['gigabytes'], - ram=int(data['ram']), + ram=data['ram'], floating_ips=data['floating_ips'], instances=data['instances'], injected_files=data['injected_files'], diff --git a/horizon/dashboards/syspanel/projects/tests.py b/horizon/dashboards/syspanel/projects/tests.py index 4e3db2f34..30d45579f 100644 --- a/horizon/dashboards/syspanel/projects/tests.py +++ b/horizon/dashboards/syspanel/projects/tests.py @@ -39,15 +39,15 @@ class TenantsViewTests(test.BaseAdminViewTests): def test_modify_quota(self): tenant = self.tenants.first() quota = self.quotas.first() - quota_data = {"metadata_items": '1', - "injected_files": '1', - "injected_file_content_bytes": '1', - "cores": '1', - "instances": '1', - "volumes": '1', - "gigabytes": '1', + quota_data = {"metadata_items": 1, + "injected_files": 1, + "injected_file_content_bytes": 1, + "cores": 1, + "instances": 1, + "volumes": 1, + "gigabytes": 1, "ram": 1, - "floating_ips": '1'} + "floating_ips": 1} self.mox.StubOutWithMock(api.keystone, 'tenant_get') self.mox.StubOutWithMock(api.nova, 'tenant_quota_get') self.mox.StubOutWithMock(api.nova, 'tenant_quota_update')