From 2b6d825d3c17ead3ca7dca0d6e8a34d8c1cadfd7 Mon Sep 17 00:00:00 2001 From: Liran Rotenberg Date: Thu, 7 Dec 2023 17:52:24 +0200 Subject: [PATCH] Virt-v2v: read LUKS keys This patch will read the given LUKS key provided to the container and add them as arguments to the virt-v2v command. Since virt-v2v supports this feature only since 2.2, it applies only for cold migrations. Signed-off-by: Liran Rotenberg --- virt-v2v/cold/entrypoint | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/virt-v2v/cold/entrypoint b/virt-v2v/cold/entrypoint index 3792fe2bf..5d9160a2a 100755 --- a/virt-v2v/cold/entrypoint +++ b/virt-v2v/cold/entrypoint @@ -71,6 +71,14 @@ for disk in /dev/block[0-9]* ; do ln -s "$disk" "$DIR/$V2V_vmName-sd$(gen_name "$((num+1))")" done +# Adds LUKS keys, if existing. +if [ -d "/etc/luks" ]; then + IFS=$'\n' + for line in $(cat /etc/luks/luks); do + args+=(--key "$line") + done +fi + if [ "$V2V_source" == "vCenter" ] ; then # Store password to file echo -n "$V2V_secretKey" > "$DIR/vmware.pw"