diff options
author | Asbjørn Sloth Tønnesen <ast@2e8.dk> | 2024-12-07 23:13:44 +0000 |
---|---|---|
committer | Asbjørn Sloth Tønnesen <ast@2e8.dk> | 2024-12-07 23:36:48 +0000 |
commit | be37ac1a83aabe85ccd09b7540c884a0a8e85802 (patch) | |
tree | 95e8ca69e76c2f0212379cf23b16b7a3f198e2fd /qemu | |
parent | 29d431a36f3be34e81775c688ca71db297aa8c4e (diff) | |
download | libvirt-routed-subnet-master.tar.gz libvirt-routed-subnet-master.tar.xz libvirt-routed-subnet-master.zip |
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-x | qemu | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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(){ |