Use labels for virtual media dev in agent ramdisk

This commit changes agent deploy ramdisk to find out
the virtual media device by using labels instead of
looking at the model of block device.  This helps in
finding out the device irrespective of the hardware.

Corresponding Ironic change is
If5b78d9af7048f2631d050ee5ce01ab7a67e2354.

Closes-Bug: 1429340
Change-Id: Ib6cc226dc4fb341d913f707737493c31a3f77152
This commit is contained in:
Ramakrishnan G
2015-03-12 04:14:11 +00:00
parent 1fc7136235
commit d0d319d65f
2 changed files with 60 additions and 14 deletions
ironic_python_agent

@ -92,12 +92,19 @@ def _get_vmedia_params():
vmedia_mount_point = "/vmedia_mnt"
parameters_file = "parameters.txt"
vmedia_device = _get_vmedia_device()
if not vmedia_device:
msg = "Unable to find virtual media device"
raise errors.VirtualMediaBootError(msg)
vmedia_device_file = "/dev/disk/by-label/ir-vfd-dev"
if not os.path.exists(vmedia_device_file):
# TODO(rameshg87): This block of code is there only for compatibility
# reasons (so that newer agent can work with older Ironic). Remove
# this after Liberty release.
vmedia_device = _get_vmedia_device()
if not vmedia_device:
msg = "Unable to find virtual media device"
raise errors.VirtualMediaBootError(msg)
vmedia_device_file = os.path.join("/dev", vmedia_device)
vmedia_device_file = os.path.join("/dev", vmedia_device)
os.mkdir(vmedia_mount_point)
try: