Merge "Address comments from original inventory patch"
This commit is contained in:
commit
4a0aa464fd
|
@ -57,13 +57,13 @@ INVENTORY_FIELDS = {
|
|||
},
|
||||
'total': {
|
||||
'type': int,
|
||||
'required': False,
|
||||
'required': True,
|
||||
'help': ('The actual amount of the resource that the provider '
|
||||
'can accommodate.')
|
||||
}
|
||||
}
|
||||
FIELDS = tuple(INVENTORY_FIELDS.keys())
|
||||
RC_HELP = ('<resource_class> is entity that indicates standard or '
|
||||
RC_HELP = ('<resource_class> is an entity that indicates standard or '
|
||||
'deployer-specific resources that can be provided by a resource '
|
||||
'provider. For example, VCPU, MEMORY_MB, DISK_GB.')
|
||||
|
||||
|
@ -94,6 +94,14 @@ class SetInventory(command.Lister):
|
|||
|
||||
"""Replaces the set of inventory records for the resource provider.
|
||||
|
||||
Note that this is a full replacement of the existing inventory. If you
|
||||
want to retain the existing inventory and add a new resource class
|
||||
inventory, you must specify all resource class inventory, old and new.
|
||||
|
||||
If a specific inventory field is not specified for a given resource class,
|
||||
it is assumed to be the total, i.e. --resource VCPU=16 is equivalent to
|
||||
--resource VCPU:total=16.
|
||||
|
||||
Example: openstack resource provider inventory set <uuid> \
|
||||
--resource VCPU=16 \
|
||||
--resource MEMORY_MB=2048 \
|
||||
|
|
|
@ -174,8 +174,15 @@ class TestSetInventory(base.BaseTestCase):
|
|||
subprocess.CalledProcessError,
|
||||
self.openstack,
|
||||
('resource provider inventory class set '
|
||||
'fake_uuid fake_class --totals 5'))
|
||||
'fake_uuid fake_class --total 5 --unknown 1'))
|
||||
self.assertIn('unrecognized arguments', exc.output.decode('utf-8'))
|
||||
# Valid RP UUID and resource class, but no inventory field.
|
||||
rp = self.resource_provider_create()
|
||||
exc = self.assertRaises(
|
||||
subprocess.CalledProcessError, self.openstack,
|
||||
'resource provider inventory class set %s VCPU' % rp['uuid'])
|
||||
self.assertIn('argument --total is required',
|
||||
exc.output.decode('utf-8'))
|
||||
|
||||
def test_set_inventory_for_resource_class(self):
|
||||
rp = self.resource_provider_create()
|
||||
|
|
Loading…
Reference in New Issue