getfattr --only-values -n $xattr_key $img 2> /dev/null
}
+
+function _rt_xattr_vm_resources_set
+{
+ local img="$1"
+ local cpus="$2"
+ local mem="$3"
+ local xattr_key="user.rapido.vm_resources"
+ local re='^[0-9]+$'
+
+ [ -n "$img" ] || _fail "img parameter is manditory"
+ [ -f "$img" ] || _fail "no image at $img"
+ [[ $cpus =~ $re ]] || _fail "num CPUs must be numeric"
+ re='^[0-9]+[MGmg]?$'
+ [[ $mem =~ $re ]] || _fail "invalid memory string: $mem"
+
+ setfattr -n "$xattr_key" -v "-smp cpus=${cpus} -m $mem" $img \
+ || _fail "failed to set xattr on $img"
+}
+
+function _rt_xattr_vm_resources_get
+{
+ local img="$1"
+ local xattr_key="user.rapido.vm_resources"
+
+ [ -n "$img" ] || _fail "img parameter is manditory"
+ [ -f "$img" ] || _fail "no image at $img"
+
+ getfattr --only-values -n $xattr_key $img 2> /dev/null
+}
local qemu_cut_args="$(_rt_xattr_qemu_args_get ${DRACUT_OUT})"
local qemu_more_args="$qemu_netdev $QEMU_EXTRA_ARGS $qemu_cut_args"
+ local vm_resources="$(_rt_xattr_vm_resources_get ${DRACUT_OUT})"
+ [ -n "$vm_resources" ] || vm_resources="-smp cpus=2 -m 512"
+
[ -f "$kernel_img" ] \
|| _fail "no kernel image present at ${kernel_img}. Build needed?"
$QEMU_KVM_BIN \
- -smp cpus=2 -m 512 \
+ $vm_resources \
-kernel "$kernel_img" \
-initrd "$DRACUT_OUT" \
-append "ip=${kern_ip_addr} rd.systemd.unit=emergency \