Software RAID: Check if install partition exists
The deployment on top of a software RAID goes to the first partition of the md device. Raise an exception if that partition does not exist. Follow-up to Ieb2c95ff130b5cc1e643fcde500066d9458ddbec Change-Id: I2b4c835d57d3888e3325aee40e8319ef8683cd27
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
import os
|
import os
|
||||||
import shlex
|
import shlex
|
||||||
import shutil
|
import shutil
|
||||||
|
import stat
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from oslo_concurrency import processutils
|
from oslo_concurrency import processutils
|
||||||
@@ -54,6 +55,13 @@ def _get_partition(device, uuid):
|
|||||||
# UUID and use the "normal" discovery instead?
|
# UUID and use the "normal" discovery instead?
|
||||||
if hardware.is_md_device(device):
|
if hardware.is_md_device(device):
|
||||||
md_partition = device + 'p1'
|
md_partition = device + 'p1'
|
||||||
|
if (not os.path.exists(md_partition) or
|
||||||
|
not stat.S_ISBLK(os.stat(md_partition).st_mode)):
|
||||||
|
error_msg = ("Could not find partition %(part)s on md "
|
||||||
|
"device %(dev)s" % {'part': md_partition,
|
||||||
|
'dev': device})
|
||||||
|
LOG.error(error_msg)
|
||||||
|
raise errors.DeviceNotFound(error_msg)
|
||||||
LOG.debug("Found md device with partition %s", md_partition)
|
LOG.debug("Found md device with partition %s", md_partition)
|
||||||
return md_partition
|
return md_partition
|
||||||
|
|
||||||
@@ -114,12 +122,11 @@ def _install_grub2(device, root_uuid, efi_system_part_uuid=None,
|
|||||||
# If the root device is an md device (or partition), restart the device
|
# If the root device is an md device (or partition), restart the device
|
||||||
# (to help grub finding it) and identify the underlying holder disks
|
# (to help grub finding it) and identify the underlying holder disks
|
||||||
# to install grub.
|
# to install grub.
|
||||||
disks = []
|
|
||||||
if hardware.is_md_device(device):
|
if hardware.is_md_device(device):
|
||||||
hardware.md_restart(device)
|
hardware.md_restart(device)
|
||||||
disks = hardware.get_holder_disks(device)
|
disks = hardware.get_holder_disks(device)
|
||||||
else:
|
else:
|
||||||
disks.append(device)
|
disks = [device]
|
||||||
|
|
||||||
utils.execute('mount', root_partition, path)
|
utils.execute('mount', root_partition, path)
|
||||||
for fs in BIND_MOUNTS:
|
for fs in BIND_MOUNTS:
|
||||||
|
Reference in New Issue
Block a user