aboutsummaryrefslogtreecommitdiffstats
path: root/qemu
diff options
context:
space:
mode:
authorAsbjørn Sloth Tønnesen <ast@2e8.dk>2024-12-07 23:13:44 +0000
committerAsbjørn Sloth Tønnesen <ast@2e8.dk>2024-12-07 23:36:48 +0000
commitbe37ac1a83aabe85ccd09b7540c884a0a8e85802 (patch)
tree95e8ca69e76c2f0212379cf23b16b7a3f198e2fd /qemu
parent29d431a36f3be34e81775c688ca71db297aa8c4e (diff)
downloadlibvirt-routed-subnet-master.tar.gz
libvirt-routed-subnet-master.tar.xz
libvirt-routed-subnet-master.zip
Exit nicely, even if a VM doesn't have <routed-subnet>HEADmaster
If there is no '<routed-subnet xmlns="...">' tag, then the xmllint call will fail, and since we are running with `set -e`, then it will terminate the script. Before a VM not using routed-subnet would cause the following error: error: Hook script execution failed: internal error: \ Child process (LC_ALL=C PATH=<...> /etc/libvirt/hooks/qemu <vm> \ prepare begin -) unexpected exit status 10 Signed-off-by: Asbjørn Sloth Tønnesen <ast@2e8.dk>
Diffstat (limited to 'qemu')
-rwxr-xr-xqemu5
1 files changed, 4 insertions, 1 deletions
diff --git a/qemu b/qemu
index b4272dd..9324f63 100755
--- a/qemu
+++ b/qemu
@@ -53,7 +53,10 @@ get_config(){
local ns='https://2e8.dk/libvirt-routed-subnet'
local query = "//*[local-name()='$tag' and namespace-uri()='$ns']"
fullxml="$(cat "$configfile")"
- routingxml="$(xpath "$query" "$fullxml")"
+ routingxml="$(xpath "$query" "$fullxml" || true)"
+ if [ -z "$routingxml" ] ; then
+ exit 0
+ fi
}
get_device(){