Exemplo n.º 1
0
 def test_set_base_image_properties_not_empty(self):
     properties = {'disk_format': 'vmdk', 'container_format': 'bare'}
     script_utils.set_base_image_properties(properties)
     self.assertIn('disk_format', properties)
     self.assertIn('container_format', properties)
     self.assertEqual('vmdk', properties.get('disk_format'))
     self.assertEqual('bare', properties.get('container_format'))
Exemplo n.º 2
0
 def test_set_base_image_properties_not_empty(self):
     properties = {'disk_format': 'vmdk', 'container_format': 'bare'}
     script_utils.set_base_image_properties(properties)
     self.assertIn('disk_format', properties)
     self.assertIn('container_format', properties)
     self.assertEqual('vmdk', properties.get('disk_format'))
     self.assertEqual('bare', properties.get('container_format'))
Exemplo n.º 3
0
 def test_set_base_image_properties(self):
     properties = {}
     script_utils.set_base_image_properties(properties)
     self.assertIn('disk_format', properties)
     self.assertIn('container_format', properties)
     self.assertEqual('qcow2', properties['disk_format'])
     self.assertEqual('bare', properties['container_format'])
Exemplo n.º 4
0
 def test_set_base_image_properties(self):
     properties = {}
     script_utils.set_base_image_properties(properties)
     self.assertIn('disk_format', properties)
     self.assertIn('container_format', properties)
     self.assertEqual('qcow2', properties['disk_format'])
     self.assertEqual('bare', properties['container_format'])
Exemplo n.º 5
0
def create_image(image_repo, image_factory, image_properties, task_id):
    _base_properties = []
    for k, v in v2_api.get_base_properties().items():
        _base_properties.append(k)

    properties = {}
    # NOTE: get the base properties
    for key in _base_properties:
        try:
            properties[key] = image_properties.pop(key)
        except KeyError:
            msg = ("Task ID %(task_id)s: Ignoring property %(k)s for setting "
                   "base properties while creating "
                   "Image.") % {
                       'task_id': task_id,
                       'k': key
                   }
            LOG.debug(msg)

    # NOTE: get the rest of the properties and pass them as
    # extra_properties for Image to be created with them.
    properties['extra_properties'] = image_properties
    script_utils.set_base_image_properties(properties=properties)

    image = image_factory.new_image(**properties)
    image_repo.add(image)
    return image
Exemplo n.º 6
0
Arquivo: main.py Projeto: mahak/glance
def create_image(image_repo, image_factory, image_properties, task_id):
    properties = {}
    # NOTE: get the base properties
    for key in v2_api.get_base_properties():
        try:
            properties[key] = image_properties.pop(key)
        except KeyError:
            LOG.debug("Task ID %(task_id)s: Ignoring property %(k)s for "
                      "setting base properties while creating "
                      "Image.", {'task_id': task_id, 'k': key})

    # NOTE: get the rest of the properties and pass them as
    # extra_properties for Image to be created with them.
    properties['extra_properties'] = image_properties
    script_utils.set_base_image_properties(properties=properties)

    image = image_factory.new_image(**properties)
    image_repo.add(image)
    return image
Exemplo n.º 7
0
def create_image(image_repo, image_factory, image_properties, task_id):
    _base_properties = []
    for k, v in v2_api.get_base_properties().items():
        _base_properties.append(k)

    properties = {}
    # NOTE: get the base properties
    for key in _base_properties:
        try:
            properties[key] = image_properties.pop(key)
        except KeyError:
            msg = (
                "Task ID %(task_id)s: Ignoring property %(k)s for setting " "base properties while creating " "Image."
            ) % {"task_id": task_id, "k": key}
            LOG.debug(msg)

    # NOTE: get the rest of the properties and pass them as
    # extra_properties for Image to be created with them.
    properties["extra_properties"] = image_properties
    script_utils.set_base_image_properties(properties=properties)

    image = image_factory.new_image(**properties)
    image_repo.add(image)
    return image
Exemplo n.º 8
0
 def test_set_base_image_properties_none(self):
     properties = None
     script_utils.set_base_image_properties(properties)
     self.assertIsNone(properties)
Exemplo n.º 9
0
 def test_set_base_image_properties_none(self):
     properties = None
     script_utils.set_base_image_properties(properties)
     self.assertIsNone(properties)
 def test_set_base_image_properties(self):
     properties = {}
     script_utils.set_base_image_properties(properties)
     self.assertIn('disk_format', properties)
     self.assertIn('container_format', properties)
Exemplo n.º 11
0
 def test_set_base_image_properties(self):
     properties = {}
     script_utils.set_base_image_properties(properties)
     self.assertIn('disk_format', properties)
     self.assertIn('container_format', properties)