Пример #1
0
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)
Пример #2
0
def _find_ipgroup(cs, group):
    """Get an IP group by name or ID."""
    return utils.find_resource(cs.ipgroups, group)
Пример #3
0
def _find_image(cs, image):
    """Get an image by name or ID."""
    return utils.find_resource(cs.images, image)
Пример #4
0
 def test_find_by_int_name(self):
     output = utils.find_resource(self.manager, 9876)
     self.assertEqual(output, self.manager.resources['5678'])
Пример #5
0
def _find_server(cs, server):
    """Get a server by name or ID."""
    return utils.find_resource(cs.servers, server)
Пример #6
0
 def test_find_by_str_name(self):
     output = utils.find_resource(self.manager, 'entity_one')
     self.assertEqual(output, self.manager.resources['1234'])
Пример #7
0
 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])
Пример #8
0
 def test_find_by_str_id(self):
     output = utils.find_resource(self.manager, '1234')
     self.assertEqual(output, self.manager.resources['1234'])
Пример #9
0
def _find_volume_snapshot(cs, snapshot):
    """Get a volume snapshot by ID."""
    return utils.find_resource(cs.volume_snapshots, snapshot)
Пример #10
0
def _find_volume(cs, volume):
    """Get a volume by ID."""
    return utils.find_resource(cs.volumes, volume)