ironic_lib.disk_utils
Module¶ironic_lib.disk_utils.
block_uuid
(dev)[source]¶Get UUID of a block device.
Try to fetch the UUID, if that fails, try to fetch the PARTUUID.
ironic_lib.disk_utils.
convert_image
(source, dest, out_format, run_as_root=False)[source]¶Convert image to other format.
ironic_lib.disk_utils.
count_mbr_partitions
(device)[source]¶Count the number of primary and logical partitions on a MBR
Parameters: | device – The device path. |
---|---|
Returns: | A tuple with the number of primary partitions and logical partitions. |
Raise: | ValueError if the device does not have a valid MBR partition table. |
ironic_lib.disk_utils.
create_config_drive_partition
(node_uuid, device, configdrive)[source]¶Create a partition for config drive
Checks if the device is GPT or MBR partitioned and creates config drive partition accordingly.
Parameters: |
|
---|---|
Raises: | InstanceDeployFailure if config drive size exceeds maximum limit or if it fails to create config drive. |
ironic_lib.disk_utils.
destroy_disk_metadata
(dev, node_uuid)[source]¶Destroy metadata structures on node’s disk.
Ensure that node’s disk magic strings are wiped without zeroing the entire drive. To do this we use the wipefs tool from util-linux.
Parameters: |
|
---|
ironic_lib.disk_utils.
fix_gpt_partition
(device, node_uuid)[source]¶Fix GPT partition
Fix GPT table information when image is written to a disk which has a bigger extend (e.g. 30GB image written on a 60Gb physical disk).
Parameters: |
|
---|---|
Raises: | InstanceDeployFailure if exception is caught. |
ironic_lib.disk_utils.
get_disk_identifier
(dev)[source]¶Get the disk identifier from the disk being exposed by the ramdisk.
This disk identifier is appended to the pxe config which will then be used by chain.c32 to detect the correct disk to chainload. This is helpful in deployments to nodes with multiple disks.
http://www.syslinux.org/wiki/index.php/Comboot/chain.c32#mbr:
Parameters: | dev – Path for the already populated disk device. |
---|---|
Raises: | OSError – When the hexdump binary is unavailable. |
Returns: | The Disk Identifier. |
ironic_lib.disk_utils.
get_image_mb
(image_path, virtual_size=True)[source]¶Get size of an image in Megabyte.
ironic_lib.disk_utils.
is_iscsi_device
(dev, node_uuid)[source]¶check whether the device path belongs to an iscsi device.
ironic_lib.disk_utils.
list_partitions
(device)[source]¶Get partitions information from given device.
Parameters: | device – The device path. |
---|---|
Returns: | list of dictionaries (one per partition) with keys: number, start, end, size (in MiB), filesystem, partition_name, flags |
ironic_lib.disk_utils.
make_partitions
(dev, root_mb, swap_mb, ephemeral_mb, configdrive_mb, node_uuid, commit=True, boot_option='netboot', boot_mode='bios', disk_label=None, cpu_arch='')[source]¶Partition the disk device.
Create partitions for root, swap, ephemeral and configdrive on a disk device.
Parameters: |
|
---|---|
Returns: | A dictionary containing the partition type as Key and partition path as Value for the partitions created by this method. |
ironic_lib.disk_utils.
qemu_img_info
(path)[source]¶Return an object containing the parsed output from qemu-img info.
ironic_lib.disk_utils.
work_on_disk
(dev, root_mb, swap_mb, ephemeral_mb, ephemeral_format, image_path, node_uuid, preserve_ephemeral=False, configdrive=None, boot_option='netboot', boot_mode='bios', tempdir=None, disk_label=None, cpu_arch='')[source]¶Create partitions and copy an image to the root partition.
Parameters: |
|
---|---|
Returns: | a dictionary containing the following keys: ‘root uuid’: UUID of root partition ‘efi system partition uuid’: UUID of the uefi system partition (if boot mode is uefi). NOTE: If key exists but value is None, it means partition doesn’t exist. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.