From 934c48b062948d5ff6db814d7b219029102b3033 Mon Sep 17 00:00:00 2001 From: Russell Bunch Date: Tue, 16 Jan 2024 12:27:29 -0600 Subject: [PATCH 1/2] MTL-2367 Define management-vm The management-vm is created as a transient domain, this prevents it from persisting when shutdown. In order to autostart the domain, we need to define it (make it persistent instead of transient). --- crucible/scripts/management-vm.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crucible/scripts/management-vm.sh b/crucible/scripts/management-vm.sh index 942b09b..bdbaeaa 100755 --- a/crucible/scripts/management-vm.sh +++ b/crucible/scripts/management-vm.sh @@ -214,7 +214,9 @@ xorriso -as genisoimage \ "${MGMTCLOUD}/network-config" yq --xml-attribute-prefix='+@' -o xml -i -p xml eval '(.domain.devices.disk.[] | select(.source."+@file" == "*cloud-init.iso").source) |= {"+@file": "'"${MGMTCLOUD}/cloud-init.iso"'"}' "${BOOTSTRAP}/domain.xml" yq --xml-attribute-prefix='+@' -o xml -i -p xml eval '(.domain.devices.filesystem | select(.target."+@dir" == "assets").source) |= {"+@dir": "/vms/store0/assets"}' "${BOOTSTRAP}/domain.xml" -virsh create "${BOOTSTRAP}/domain.xml" +virsh define "${BOOTSTRAP}/domain.xml" +virsh autostart "${BOOTSTRAP}/domain.xml" +virsh start "${BOOTSTRAP}/domain.xml" echo -en 'Management VM created ... observe startup with:\n\n' echo -en '\tvirsh console management-vm\n\n' From 1aebc2a9f0acb7955a7e827312ea0cd636c65f05 Mon Sep 17 00:00:00 2001 From: Russell Bunch Date: Tue, 16 Jan 2024 13:17:06 -0600 Subject: [PATCH 2/2] Safety first --- crucible/scripts/management-vm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crucible/scripts/management-vm.sh b/crucible/scripts/management-vm.sh index bdbaeaa..9c2312f 100755 --- a/crucible/scripts/management-vm.sh +++ b/crucible/scripts/management-vm.sh @@ -214,8 +214,8 @@ xorriso -as genisoimage \ "${MGMTCLOUD}/network-config" yq --xml-attribute-prefix='+@' -o xml -i -p xml eval '(.domain.devices.disk.[] | select(.source."+@file" == "*cloud-init.iso").source) |= {"+@file": "'"${MGMTCLOUD}/cloud-init.iso"'"}' "${BOOTSTRAP}/domain.xml" yq --xml-attribute-prefix='+@' -o xml -i -p xml eval '(.domain.devices.filesystem | select(.target."+@dir" == "assets").source) |= {"+@dir": "/vms/store0/assets"}' "${BOOTSTRAP}/domain.xml" -virsh define "${BOOTSTRAP}/domain.xml" -virsh autostart "${BOOTSTRAP}/domain.xml" +virsh define "${BOOTSTRAP}/domain.xml" || echo "Domain already defined" +virsh autostart "${BOOTSTRAP}/domain.xml" || echo "Autostart already enabled" virsh start "${BOOTSTRAP}/domain.xml" echo -en 'Management VM created ... observe startup with:\n\n'