add rd.kiwi.oem.maxdisk= boot parameter
this limits the disks considered for oem deployment to a given size
This commit is contained in:
parent
fcc3a74db1
commit
36e9a14134
@ -875,6 +875,16 @@ the available kernel boot parameters for this modules:
|
||||
Note that options starting with `rd.kiwi` are not passed on to avoid
|
||||
side effects.
|
||||
|
||||
``rd.kiwi.oem.maxdisk=size[KMGT]``
|
||||
This variable configures the maximum disk size an unattended oem
|
||||
installation should consider for image deployment. Unattended oem
|
||||
deployments default to deploying on /dev/sda (more exactly, the first
|
||||
device not filtered out by `oem-device-filter`). With RAID
|
||||
controllers, it can happen that your buch of big JBOD disks is for
|
||||
example `/dev/sda` to `/dev/sdi` and the 480G RAID1 configured for
|
||||
OS deployment is `/dev/sdj`. With `rd.kiwi.oem.maxdisk=500G` the
|
||||
deployment will land on that RAID disk.
|
||||
|
||||
``rd.live.overlay.persistent``
|
||||
This variable tells a live iso image to prepare a persistent
|
||||
write partition.
|
||||
|
||||
@ -45,10 +45,17 @@ function get_disk_list {
|
||||
local disk_device_by_id
|
||||
local disk_meta
|
||||
local list_items
|
||||
local max_disk
|
||||
local kiwi_oem_maxdisk
|
||||
local blk_opts="-p -n -r -o NAME,SIZE,TYPE"
|
||||
if [ -n "${kiwi_devicepersistency}" ];then
|
||||
disk_id=${kiwi_devicepersistency}
|
||||
fi
|
||||
max_disk=0
|
||||
kiwi_oem_maxdisk=$(getarg rd.kiwi.oem.maxdisk=)
|
||||
if [ -n "${kiwi_oem_maxdisk}" ]; then
|
||||
max_disk=$(binsize_to_bytesize "${kiwi_oem_maxdisk}") || max_disk=0
|
||||
fi
|
||||
if getargbool 0 rd.kiwi.ramdisk; then
|
||||
# target should be a ramdisk on request. Thus actively
|
||||
# load the ramdisk block driver and support custom sizes
|
||||
@ -77,6 +84,14 @@ function get_disk_list {
|
||||
continue
|
||||
fi
|
||||
disk_size=$(echo "${disk_meta}" | cut -f2 -d:)
|
||||
if [ ${max_disk} -gt 0 ]; then
|
||||
local disk_size_bytes
|
||||
disk_size_bytes=$(binsize_to_bytesize "${disk_size}") || disk_size_bytes=0
|
||||
if [ "${disk_size_bytes}" -gt "${max_disk}" ]; then
|
||||
info "${disk_device} filtered out by rd.kiwi.oem.maxdisk=${kiwi_oem_maxdisk} (is ${disk_size})" >&2
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
disk_device_by_id=$(
|
||||
get_persistent_device_from_unix_node "${disk_device}" "${disk_id}"
|
||||
)
|
||||
|
||||
@ -113,3 +113,20 @@ function import_file {
|
||||
eval "export ${key}" &>/dev/null
|
||||
done < ${source_format}
|
||||
}
|
||||
|
||||
function binsize_to_bytesize {
|
||||
# """
|
||||
# converts binary sizes (1024k, 2.4G) to bytes
|
||||
# uses awk to handle floating point numbers
|
||||
# """
|
||||
local sz="$1"
|
||||
local bs=${sz:0:-1}
|
||||
case ${sz} in
|
||||
*K|*k) mult=1024 ;;
|
||||
*M) mult=$((1024*1024)) ;;
|
||||
*G) mult=$((1024*1024*1024)) ;;
|
||||
*T) mult=$((1024*1024*1024*1024)) ;;
|
||||
*) bs=${sz}; mult=1 ;;
|
||||
esac
|
||||
awk "BEGIN {print int(${bs}*${mult})}"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user