예제 #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_server(cs, server):
    """Get a server by name or ID."""
    return utils.find_resource(cs.servers, server)
예제 #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_str_name(self):
     output = utils.find_resource(self.manager, 'entity_one')
     self.assertEqual(output, self.manager.get('1234'))
예제 #5
0
 def test_find_by_str_displayname(self):
     output = utils.find_resource(self.manager, 'entity_three')
     self.assertEqual(output, self.manager.get('4242'))
예제 #6
0
def _find_image(cs, image):
    """Get an image by name or ID."""
    return utils.find_resource(cs.images, image)
예제 #7
0
 def test_find_by_uuid(self):
     output = utils.find_resource(self.manager, UUID)
     self.assertEqual(output, self.manager.get(UUID))
예제 #8
0
 def test_find_by_str_name(self):
     output = utils.find_resource(self.manager, 'entity_one')
     self.assertEqual(output, self.manager.get('1234'))
예제 #9
0
 def test_find_by_str_displayname(self):
     output = utils.find_resource(self.manager, 'entity_three')
     self.assertEqual(output, self.manager.get('4242'))
예제 #10
0
 def test_find_by_integer_id(self):
     output = utils.find_resource(self.manager, 1234)
     self.assertEqual(output, self.manager.get('1234'))
예제 #11
0
 def test_find_by_uuid(self):
     output = utils.find_resource(self.manager, UUID)
     self.assertEqual(output, self.manager.get(UUID))
예제 #12
0
def _find_volume_snapshot(cs, snapshot):
    """Get a volume snapshot by ID."""
    return utils.find_resource(cs.volume_snapshots, snapshot)
예제 #13
0
def _find_volume(cs, volume):
    """Get a volume by ID."""
    return utils.find_resource(cs.volumes, volume)
예제 #14
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)
예제 #15
0
def _find_volume(cs, volume):
    """Get a volume by ID."""
    return utils.find_resource(cs.volumes, volume)
예제 #16
0
 def test_find_by_integer_id(self):
     output = utils.find_resource(self.manager, 1234)
     self.assertEqual(output, self.manager.get('1234'))
예제 #17
0
def _find_volume_snapshot(cs, snapshot):
    """Get a volume snapshot by ID."""
    return utils.find_resource(cs.volume_snapshots, snapshot)
예제 #18
0
def _find_server(cs, server):
    """Get a server by name or ID."""
    return utils.find_resource(cs.servers, server)