diff options
| author | Yolanda Robla <yolanda.robla-mota@hp.com> | 2015-11-17 09:26:03 +0100 |
|---|---|---|
| committer | Yolanda Robla <yolanda.robla-mota@hp.com> | 2015-11-18 10:48:46 +0100 |
| commit | a01c4c90ebb33be0afa363c3c62f49cb96f0cf86 (patch) | |
| tree | 33ac554f60c3a3059998bfb64d600b2a0d7dbce1 /ironic_python_agent/shell | |
| parent | 0ca90d8193172749d40e066e4879686dbc7bf6e1 (diff) | |
| download | ironic-python-agent-a01c4c90ebb33be0afa363c3c62f49cb96f0cf86.tar.gz | |
Create partition at max msdos limit for disks > 2TB
Currently there is a problem on partition creation for MBR
case. If disk exceeds 2TB, partition creation fails because
we are hitting max msdos limit. Detect total disk size, and if
it exceeds that limit, create the partition at the end of legal
limits.
Fixes-Bug: #1517077
Change-Id: I11dd3f11eaa6af764151b442768d10289ced6d3f
Diffstat (limited to 'ironic_python_agent/shell')
| -rwxr-xr-x | ironic_python_agent/shell/copy_configdrive_to_disk.sh | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/ironic_python_agent/shell/copy_configdrive_to_disk.sh b/ironic_python_agent/shell/copy_configdrive_to_disk.sh index 8b74e29d..ee4ed703 100755 --- a/ironic_python_agent/shell/copy_configdrive_to_disk.sh +++ b/ironic_python_agent/shell/copy_configdrive_to_disk.sh @@ -36,6 +36,7 @@ usage() { } MAX_DISK_PARTITIONS=128 +MAX_MBR_SIZE_MB=2097152 CONFIGDRIVE="$1" DEVICE="$2" @@ -86,9 +87,20 @@ else else log "Working on MBR only device $DEVICE" - # Create small partition at the end of the device + # get total disk size, to detect if that exceeds 2TB msdos limit + disksize_bytes=$(blockdev --getsize64 $DEVICE) + disksize_mb=$(( ${disksize_bytes%% *} / 1024 / 1024)) + + startlimit=-64MiB + endlimit=-0 + if [ "$disksize_mb" -gt "$MAX_MBR_SIZE_MB" ]; then + # Create small partition at 2TB limit + startlimit=$(($MAX_MBR_SIZE_MB - 65)) + endlimit=$(($MAX_MBR_SIZE_MB - 1)) + fi + log "Adding configdrive partition to $DEVICE" - parted -a optimal -s -- $DEVICE mkpart primary ext2 -64MiB -0 || fail "creating configdrive on ${DEVICE}" + parted -a optimal -s -- $DEVICE mkpart primary ext2 $startlimit $endlimit || fail "creating configdrive on ${DEVICE}" # Find partition we just created # Dump all partitions, ignore empty ones, then get the last partition ID |
