The nova.objects.image_meta Module

class ImageMeta(context=None, **kwargs)

Bases: nova.objects.base.NovaObject

VERSION = '1.8'
checksum
container_format
created_at
direct_url
disk_format
fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'min_disk': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'virtual_size': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'tags': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'properties': Object(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'owner': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'visibility': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'disk_format': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'direct_url': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'min_ram': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'id': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'checksum': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'status': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'protected': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'container_format': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'size': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}
classmethod from_dict(image_meta)

Create instance from image metadata dict

Parameters:image_meta – image metadata dictionary

Creates a new object instance, initializing from the properties associated with the image metadata instance

Returns:an ImageMeta instance
classmethod from_image_ref(context, image_api, image_ref)

Create instance from glance image

Parameters:
  • context – the request context
  • image_api – the glance client API
  • image_ref – the glance image identifier

Creates a new object instance, initializing from the properties associated with a glance image

Returns:an ImageMeta instance
classmethod from_instance(instance)

Create instance from instance system metadata

Parameters:instance – Instance object

Creates a new object instance, initializing from the system metadata “image_*” properties associated with instance

Returns:an ImageMeta instance
id
min_disk
min_ram
name
owner
properties
protected
size
status
tags
updated_at
virtual_size
visibility
class ImageMetaProps(context=None, **kwargs)

Bases: nova.objects.base.NovaObject

NUMA_NODES_MAX = 128
VERSION = '1.12'
fields = {'img_hv_requested_version': VersionPredicate(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_auto_disk_config': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'os_type': OSType(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('linux', 'windows')), 'img_bittorrent': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_signature_hash_method': ImageSignatureHashType(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('SHA-224', 'SHA-256', 'SHA-384', 'SHA-512')), 'hw_cpu_max_threads': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_serial_port_count': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_cpu_threads': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_vm_mode': VMMode(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=['hvm', 'xen', 'uml', 'exe']), 'img_cache_in_nova': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_video_ram': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_bdm_v2': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_cpu_realtime_mask': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_disk_type': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_rng_model': RNGModel(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('virtio',)), 'img_root_device_name': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_numa_mem': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_cpu_thread_policy': CPUThreadAllocationPolicy(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('prefer', 'isolate', 'require')), 'hw_cpu_max_sockets': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_video_model': VideoModel(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('cirrus', 'qxl', 'vga', 'vmvga', 'xen')), 'hw_disk_bus': DiskBus(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('fdc', 'ide', 'sata', 'scsi', 'usb', 'virtio', 'xen', 'lxc', 'uml')), 'hw_numa_nodes': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_block_device_mapping': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_watchdog_action': WatchdogAction(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('none', 'pause', 'poweroff', 'reset')), 'hw_firmware_type': FirmwareType(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('uefi', 'bios')), 'hw_numa_cpus': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_cdrom_bus': DiskBus(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('fdc', 'ide', 'sata', 'scsi', 'usb', 'virtio', 'xen', 'lxc', 'uml')), 'img_use_agent': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_scsi_model': SCSIModel(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('buslogic', 'ibmvscsi', 'lsilogic', 'lsisas1068', 'lsisas1078', 'virtio-scsi', 'vmpvscsi')), 'hw_mem_page_size': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_qemu_guest_agent': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_cpu_cores': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_machine_type': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_hv_type': HVType(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('baremetal', 'bhyve', 'docker', 'fake', 'hyperv', 'ironic', 'kqemu', 'kvm', 'lxc', 'lxd', 'openvz', 'parallels', 'phyp', 'qemu', 'test', 'uml', 'vbox', 'vz', 'vmware', 'xen', 'zvm')), 'os_skip_agent_inject_ssh': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_device_id': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_version': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_compression_level': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'os_require_quiesce': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'os_admin_user': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_vif_multiqueue_enabled': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_cpu_sockets': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_config_drive': ConfigDrivePolicy(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('optional', 'mandatory')), 'hw_boot_menu': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_owner_id': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_signature_key_type': ImageSignatureKeyType(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('DSA', 'ECC_SECT571K1', 'ECC_SECT409K1', 'ECC_SECT571R1', 'ECC_SECT409R1', 'ECC_SECP521R1', 'ECC_SECP384R1', 'RSA-PSS')), 'img_signature_certificate_uuid': UUID(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_linked_clone': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_architecture': Architecture(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=['alpha', 'armv6', 'armv7l', 'armv7b', 'aarch64', 'cris', 'i686', 'ia64', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mipsel', 'mips64', 'mips64el', 'openrisc', 'parisc', 'parisc64', 'ppc', 'ppcle', 'ppc64', 'ppc64le', 'ppcemb', 's390', 's390x', 'sh4', 'sh4eb', 'sparc', 'sparc64', 'unicore32', 'x86_64', 'xtensa', 'xtensaeb']), 'hw_vif_model': VIFModel(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('virtio', 'ne2k_pci', 'pcnet', 'rtl8139', 'e1000', 'e1000e', 'netfront', 'spapr-vlan', 'sriov', 'vmxnet', 'vmxnet3')), 'os_skip_agent_inject_files_at_boot': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_floppy_bus': DiskBus(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('fdc', 'ide', 'sata', 'scsi', 'usb', 'virtio', 'xen', 'lxc', 'uml')), 'hw_ipxe_boot': FlexibleBoolean(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_mappings': List(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'hw_cpu_policy': CPUAllocationPolicy(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False,valid_values=('dedicated', 'shared')), 'hw_cpu_max_cores': Integer(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'img_signature': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'os_distro': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'os_command_line': String(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False)}
classmethod from_dict(image_props)

Create instance from image properties dict

Parameters:image_props – dictionary of image metdata properties

Creates a new object instance, initializing from a dictionary of image metadata properties

Returns:an ImageMetaProps instance
get(name, defvalue=None)

Get the value of an attribute :param name: the attribute to request :param defvalue: the default value if not set

This returns the value of an attribute if it is currently set, otherwise it will return None.

This differs from accessing props.attrname, because that will raise an exception if the attribute has no value set.

So instead of

if image_meta.properties.obj_attr_is_set(“some_attr”):
val = image_meta.properties.some_attr
else
val = None

Callers can rely on unconditional access

val = image_meta.properties.get(“some_attr”)
Returns:the attribute value or None
hw_architecture
hw_auto_disk_config
hw_boot_menu
hw_cdrom_bus
hw_cpu_cores
hw_cpu_max_cores
hw_cpu_max_sockets
hw_cpu_max_threads
hw_cpu_policy
hw_cpu_realtime_mask
hw_cpu_sockets
hw_cpu_thread_policy
hw_cpu_threads
hw_device_id
hw_disk_bus
hw_disk_type
hw_firmware_type
hw_floppy_bus
hw_ipxe_boot
hw_machine_type
hw_mem_page_size
hw_numa_cpus
hw_numa_mem
hw_numa_nodes
hw_qemu_guest_agent
hw_rng_model
hw_scsi_model
hw_serial_port_count
hw_video_model
hw_video_ram
hw_vif_model
hw_vif_multiqueue_enabled
hw_vm_mode
hw_watchdog_action
img_bdm_v2
img_bittorrent
img_block_device_mapping
img_cache_in_nova
img_compression_level
img_config_drive
img_hv_requested_version
img_hv_type
img_linked_clone
img_mappings
img_owner_id
img_root_device_name
img_signature
img_signature_certificate_uuid
img_signature_hash_method
img_signature_key_type
img_use_agent
img_version
obj_make_compatible(primitive, target_version)
os_admin_user
os_command_line
os_distro
os_require_quiesce
os_skip_agent_inject_files_at_boot
os_skip_agent_inject_ssh
os_type

Previous topic

The nova.objects.hv_spec Module

Next topic

The nova.objects.instance Module

Project Source

This Page