def _find_flavor(cs, flavor): """Get a flavor by name, ID, or RAM size.""" try: return utils.find_resource(cs.flavors, flavor) except exceptions.NotFound: return cs.flavors.find(ram=flavor)
def _find_ipgroup(cs, group): """Get an IP group by name or ID.""" return utils.find_resource(cs.ipgroups, group)
def _find_image(cs, image): """Get an image by name or ID.""" return utils.find_resource(cs.images, image)
def test_find_by_int_name(self): output = utils.find_resource(self.manager, 9876) self.assertEqual(output, self.manager.resources['5678'])
def _find_server(cs, server): """Get a server by name or ID.""" return utils.find_resource(cs.servers, server)
def test_find_by_str_name(self): output = utils.find_resource(self.manager, 'entity_one') self.assertEqual(output, self.manager.resources['1234'])
def test_find_by_uuid(self): uuid = '8e8ec658-c7b0-4243-bdf8-6f7f2952c0d0' output = utils.find_resource(self.manager, uuid) self.assertEqual(output, self.manager.resources[uuid])
def test_find_by_str_id(self): output = utils.find_resource(self.manager, '1234') self.assertEqual(output, self.manager.resources['1234'])
def _find_volume_snapshot(cs, snapshot): """Get a volume snapshot by ID.""" return utils.find_resource(cs.volume_snapshots, snapshot)
def _find_volume(cs, volume): """Get a volume by ID.""" return utils.find_resource(cs.volumes, volume)