Merge "Set quota "per_volume_gigabytes", "backup_gigabytes" and "backups""
This commit is contained in:
		| @@ -2,9 +2,10 @@ | |||||||
| quota | quota | ||||||
| ===== | ===== | ||||||
|  |  | ||||||
| Resource quotas appear in multiple APIs, OpenStackClient presents them as a single object with multiple properties. | Resource quotas appear in multiple APIs, OpenStackClient presents them as a | ||||||
|  | single object with multiple properties. | ||||||
|  |  | ||||||
| Block Storage v1, Compute v2, Network v2 | Block Storage v1, v2, Compute v2, Network v2 | ||||||
|  |  | ||||||
| quota set | quota set | ||||||
| --------- | --------- | ||||||
| @@ -29,7 +30,10 @@ Set quotas for project | |||||||
|         [--server-group-members <num-server-group-members>] |         [--server-group-members <num-server-group-members>] | ||||||
|  |  | ||||||
|         # Block Storage settings |         # Block Storage settings | ||||||
|  |         [--backups <new-backups>] | ||||||
|  |         [--backup-gigabytes <new-backup-gigabytes>] | ||||||
|         [--gigabytes <new-gigabytes>] |         [--gigabytes <new-gigabytes>] | ||||||
|  |         [--per-volume-gigabytes <new-per-volume-gigabytes>] | ||||||
|         [--snapshots <new-snapshots>] |         [--snapshots <new-snapshots>] | ||||||
|         [--volumes <new-volumes>] |         [--volumes <new-volumes>] | ||||||
|         [--volume-type <volume-type>] |         [--volume-type <volume-type>] | ||||||
| @@ -70,7 +74,10 @@ Set quotas for class | |||||||
|         [--server-group-members <num-server-group-members>] |         [--server-group-members <num-server-group-members>] | ||||||
|  |  | ||||||
|         # Block Storage settings |         # Block Storage settings | ||||||
|  |         [--backups <new-backups>] | ||||||
|  |         [--backup-gigabytes <new-backup-gigabytes>] | ||||||
|         [--gigabytes <new-gigabytes>] |         [--gigabytes <new-gigabytes>] | ||||||
|  |         [--per-volume-gigabytes <new-per-volume-gigabytes>] | ||||||
|         [--snapshots <new-snapshots>] |         [--snapshots <new-snapshots>] | ||||||
|         [--volumes <new-volumes>] |         [--volumes <new-volumes>] | ||||||
|  |  | ||||||
| @@ -136,10 +143,22 @@ Set quotas for class | |||||||
|  |  | ||||||
|     New value for the injected-path-size quota |     New value for the injected-path-size quota | ||||||
|  |  | ||||||
|  | .. option:: --backups <new-backups> | ||||||
|  |  | ||||||
|  |     New value for the backups quota | ||||||
|  |  | ||||||
|  | .. option:: --backup-gigabytes <new-backup-gigabytes> | ||||||
|  |  | ||||||
|  |     New value for the backup gigabytes quota | ||||||
|  |  | ||||||
| .. option:: --gigabytes <new-gigabytes> | .. option:: --gigabytes <new-gigabytes> | ||||||
|  |  | ||||||
|     New value for the gigabytes quota |     New value for the gigabytes quota | ||||||
|  |  | ||||||
|  | .. option:: --per-volume-gigabytes <new-per-volume-gigabytes> | ||||||
|  |  | ||||||
|  |     New value for the gigabytes quota of per volume | ||||||
|  |  | ||||||
| .. option:: --volumes <new-volumes> | .. option:: --volumes <new-volumes> | ||||||
|  |  | ||||||
|     New value for the volumes quota |     New value for the volumes quota | ||||||
| @@ -150,7 +169,8 @@ Set quotas for class | |||||||
|  |  | ||||||
| .. option:: --volume-type <volume-type> | .. option:: --volume-type <volume-type> | ||||||
|  |  | ||||||
|     Set quotas for a specific <volume-type> |     Set quotas for a specific <volume-type>. The supported quotas are: | ||||||
|  |     gigabytes, snapshots, volumes. | ||||||
|  |  | ||||||
| .. option:: --networks <num-networks> | .. option:: --networks <num-networks> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,11 +43,20 @@ COMPUTE_QUOTAS = { | |||||||
| } | } | ||||||
|  |  | ||||||
| VOLUME_QUOTAS = { | VOLUME_QUOTAS = { | ||||||
|  |     'backups': 'backups', | ||||||
|  |     'backup_gigabytes': 'backup-gigabytes', | ||||||
|     'gigabytes': 'gigabytes', |     'gigabytes': 'gigabytes', | ||||||
|  |     'per_volume_gigabytes': 'per-volume-gigabytes', | ||||||
|     'snapshots': 'snapshots', |     'snapshots': 'snapshots', | ||||||
|     'volumes': 'volumes', |     'volumes': 'volumes', | ||||||
| } | } | ||||||
|  |  | ||||||
|  | IMPACT_VOLUME_TYPE_QUOTAS = [ | ||||||
|  |     'gigabytes', | ||||||
|  |     'snapshots', | ||||||
|  |     'volumes', | ||||||
|  | ] | ||||||
|  |  | ||||||
| NOVA_NETWORK_QUOTAS = { | NOVA_NETWORK_QUOTAS = { | ||||||
|     'floating_ips': 'floating-ips', |     'floating_ips': 'floating-ips', | ||||||
|     'security_group_rules': 'secgroup-rules', |     'security_group_rules': 'secgroup-rules', | ||||||
| @@ -128,7 +137,8 @@ class SetQuota(command.Command): | |||||||
|         for k, v in VOLUME_QUOTAS.items(): |         for k, v in VOLUME_QUOTAS.items(): | ||||||
|             value = getattr(parsed_args, k, None) |             value = getattr(parsed_args, k, None) | ||||||
|             if value is not None: |             if value is not None: | ||||||
|                 if parsed_args.volume_type: |                 if (parsed_args.volume_type and | ||||||
|  |                         k in IMPACT_VOLUME_TYPE_QUOTAS): | ||||||
|                     k = k + '_%s' % parsed_args.volume_type |                     k = k + '_%s' % parsed_args.volume_type | ||||||
|                 volume_kwargs[k] = value |                 volume_kwargs[k] = value | ||||||
|  |  | ||||||
|   | |||||||
| @@ -158,12 +158,20 @@ class TestQuotaSet(TestQuota): | |||||||
|             '--gigabytes', str(volume_fakes.QUOTA['gigabytes']), |             '--gigabytes', str(volume_fakes.QUOTA['gigabytes']), | ||||||
|             '--snapshots', str(volume_fakes.QUOTA['snapshots']), |             '--snapshots', str(volume_fakes.QUOTA['snapshots']), | ||||||
|             '--volumes', str(volume_fakes.QUOTA['volumes']), |             '--volumes', str(volume_fakes.QUOTA['volumes']), | ||||||
|  |             '--backups', str(volume_fakes.QUOTA['backups']), | ||||||
|  |             '--backup-gigabytes', str(volume_fakes.QUOTA['backup_gigabytes']), | ||||||
|  |             '--per-volume-gigabytes', | ||||||
|  |             str(volume_fakes.QUOTA['per_volume_gigabytes']), | ||||||
|             identity_fakes.project_name, |             identity_fakes.project_name, | ||||||
|         ] |         ] | ||||||
|         verifylist = [ |         verifylist = [ | ||||||
|             ('gigabytes', volume_fakes.QUOTA['gigabytes']), |             ('gigabytes', volume_fakes.QUOTA['gigabytes']), | ||||||
|             ('snapshots', volume_fakes.QUOTA['snapshots']), |             ('snapshots', volume_fakes.QUOTA['snapshots']), | ||||||
|             ('volumes', volume_fakes.QUOTA['volumes']), |             ('volumes', volume_fakes.QUOTA['volumes']), | ||||||
|  |             ('backups', volume_fakes.QUOTA['backups']), | ||||||
|  |             ('backup_gigabytes', volume_fakes.QUOTA['backup_gigabytes']), | ||||||
|  |             ('per_volume_gigabytes', | ||||||
|  |              volume_fakes.QUOTA['per_volume_gigabytes']), | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
|         parsed_args = self.check_parser(self.cmd, arglist, verifylist) |         parsed_args = self.check_parser(self.cmd, arglist, verifylist) | ||||||
| @@ -174,6 +182,9 @@ class TestQuotaSet(TestQuota): | |||||||
|             'gigabytes': volume_fakes.QUOTA['gigabytes'], |             'gigabytes': volume_fakes.QUOTA['gigabytes'], | ||||||
|             'snapshots': volume_fakes.QUOTA['snapshots'], |             'snapshots': volume_fakes.QUOTA['snapshots'], | ||||||
|             'volumes': volume_fakes.QUOTA['volumes'], |             'volumes': volume_fakes.QUOTA['volumes'], | ||||||
|  |             'backups': volume_fakes.QUOTA['backups'], | ||||||
|  |             'backup_gigabytes': volume_fakes.QUOTA['backup_gigabytes'], | ||||||
|  |             'per_volume_gigabytes': volume_fakes.QUOTA['per_volume_gigabytes'] | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         self.volume_quotas_mock.update.assert_called_once_with( |         self.volume_quotas_mock.update.assert_called_once_with( | ||||||
| @@ -188,6 +199,10 @@ class TestQuotaSet(TestQuota): | |||||||
|             '--gigabytes', str(volume_fakes.QUOTA['gigabytes']), |             '--gigabytes', str(volume_fakes.QUOTA['gigabytes']), | ||||||
|             '--snapshots', str(volume_fakes.QUOTA['snapshots']), |             '--snapshots', str(volume_fakes.QUOTA['snapshots']), | ||||||
|             '--volumes', str(volume_fakes.QUOTA['volumes']), |             '--volumes', str(volume_fakes.QUOTA['volumes']), | ||||||
|  |             '--backups', str(volume_fakes.QUOTA['backups']), | ||||||
|  |             '--backup-gigabytes', str(volume_fakes.QUOTA['backup_gigabytes']), | ||||||
|  |             '--per-volume-gigabytes', | ||||||
|  |             str(volume_fakes.QUOTA['per_volume_gigabytes']), | ||||||
|             '--volume-type', 'volume_type_backend', |             '--volume-type', 'volume_type_backend', | ||||||
|             identity_fakes.project_name, |             identity_fakes.project_name, | ||||||
|         ] |         ] | ||||||
| @@ -195,6 +210,10 @@ class TestQuotaSet(TestQuota): | |||||||
|             ('gigabytes', volume_fakes.QUOTA['gigabytes']), |             ('gigabytes', volume_fakes.QUOTA['gigabytes']), | ||||||
|             ('snapshots', volume_fakes.QUOTA['snapshots']), |             ('snapshots', volume_fakes.QUOTA['snapshots']), | ||||||
|             ('volumes', volume_fakes.QUOTA['volumes']), |             ('volumes', volume_fakes.QUOTA['volumes']), | ||||||
|  |             ('backups', volume_fakes.QUOTA['backups']), | ||||||
|  |             ('backup_gigabytes', volume_fakes.QUOTA['backup_gigabytes']), | ||||||
|  |             ('per_volume_gigabytes', | ||||||
|  |              volume_fakes.QUOTA['per_volume_gigabytes']), | ||||||
|             ('volume_type', 'volume_type_backend'), |             ('volume_type', 'volume_type_backend'), | ||||||
|         ] |         ] | ||||||
|  |  | ||||||
| @@ -206,6 +225,9 @@ class TestQuotaSet(TestQuota): | |||||||
|             'gigabytes_volume_type_backend': volume_fakes.QUOTA['gigabytes'], |             'gigabytes_volume_type_backend': volume_fakes.QUOTA['gigabytes'], | ||||||
|             'snapshots_volume_type_backend': volume_fakes.QUOTA['snapshots'], |             'snapshots_volume_type_backend': volume_fakes.QUOTA['snapshots'], | ||||||
|             'volumes_volume_type_backend': volume_fakes.QUOTA['volumes'], |             'volumes_volume_type_backend': volume_fakes.QUOTA['volumes'], | ||||||
|  |             'backups': volume_fakes.QUOTA['backups'], | ||||||
|  |             'backup_gigabytes': volume_fakes.QUOTA['backup_gigabytes'], | ||||||
|  |             'per_volume_gigabytes': volume_fakes.QUOTA['per_volume_gigabytes'] | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         self.volume_quotas_mock.update.assert_called_once_with( |         self.volume_quotas_mock.update.assert_called_once_with( | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								releasenotes/notes/bug-1609767-0602edc4408c2dc6.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								releasenotes/notes/bug-1609767-0602edc4408c2dc6.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | --- | ||||||
|  | features: | ||||||
|  |   - Support to update ``per_volume_gigabytes``, ``backup_gigabytes`` and | ||||||
|  |     ``backups`` quota in ``quota set`` command. | ||||||
|  |     [Bug `1609767 <https://bugs.launchpad.net/python-openstackclient/+bug/1609767>`_] | ||||||
		Reference in New Issue
	
	Block a user
	 Jenkins
					Jenkins