
On Wed, Mar 31, 2021 at 11:43:14AM +0800, Liu Shaofei wrote:
On Wed, Mar 31, 2021 at 11:09:58AM +0800, Xu Xijian wrote:
[why] If a HW machine has no physical volume or volume group for logical volume, we should support to create them by job param, this param named as pv_device(default empty and do nothing). If a usable $pv_device is given, dracut will check the device and ensure pv and vg. Usage: submit job.yaml ... pv_device=/dev/sda
Signed-off-by: Xu Xijian <hdxuxijian@163.com> --- .../dracut-initrd/bin/set-local-sysroot.sh | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/container/dracut-initrd/bin/set-local-sysroot.sh b/container/dracut-initrd/bin/set-local-sysroot.sh index 835bdd2..2a07270 100644 --- a/container/dracut-initrd/bin/set-local-sysroot.sh +++ b/container/dracut-initrd/bin/set-local-sysroot.sh @@ -14,9 +14,36 @@ analyse_kernel_cmdline_params() {
sync_src_lv() { local src_lv="$1" + local vg_name="os"
[ -e "$src_lv" ] && return
+ # need create volume group, usually in first use of this machine. $pv_device e.g. /dev/sda + pv_device="$(getarg pv_device=)" + [ -n "$pv_device" ] && {
you should avoid to nested "if condition", perhaps [ -z "$pv_device" ] && return [ ... ] || { }
Thanks, Liushaofei
The logic is only if $pv_device is given, it will do some create operation, if not, it will skip and go on instead of return. Thanks, Xijian