aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@libreoffice.org>2016-10-19 13:06:18 +0200
committerGuilhem Moulin <guilhem@libreoffice.org>2016-10-19 13:06:21 +0200
commita458bbcdeb06686bd34826fa8bcb1c4f4d2a4888 (patch)
tree8c67f6db7726c108eccde35a89be7360accc7ea7
parent323a5cd2fef055b8cf72708ad9bd34403d9ee185 (diff)
virsh, virt-install: explicitly pass connect URI "qemu:///system"
-rwxr-xr-xtdfvm-install13
1 files changed, 7 insertions, 6 deletions
diff --git a/tdfvm-install b/tdfvm-install
index ed02fba..859d913 100755
--- a/tdfvm-install
+++ b/tdfvm-install
@@ -14,6 +14,7 @@ usage() {
}
+LIBVIRT_URI=qemu:///system
ARCH=$(dpkg-architecture -qDEB_TARGET_ARCH)
unset ISO
USER_NAME=root
@@ -219,11 +220,11 @@ grep -q '^kvm\s' /proc/modules || echo 'WARN: KVM not available!' >&2
[ ! ${OUTPUT+x} ] || mkdir -p "$OUTPUT"
if [ "$FORCE" = y ]; then
- virsh destroy "$VM_NAME" >/dev/null 2>&1 || true
- virsh undefine "$VM_NAME" >/dev/null 2>&1 || true
+ virsh -c "$LIBVIRT_URI" destroy "$VM_NAME" >/dev/null 2>&1 || true
+ virsh -c "$LIBVIRT_URI" undefine "$VM_NAME" >/dev/null 2>&1 || true
fi
-virt-install -q \
+virt-install -q --connect "$LIBVIRT_URI" \
--name "$VM_NAME" \
--os-variant "debianwheezy" \
--arch "$(dpkg-architecture -A"$ARCH" -qDEB_TARGET_GNU_CPU)" \
@@ -241,13 +242,13 @@ virt-install -q \
(
vmdef="$(mktemp --tmpdir)"
trap 'rm -f "$vmdef"' EXIT TERM INT
- virsh dumpxml "$VM_NAME" >"$vmdef"
+ virsh -c "$LIBVIRT_URI" dumpxml "$VM_NAME" >"$vmdef"
for xpath in \
"/domain/devices/filesystem[source/@dir=\"$VMTMPDIR/virtfs\"][target/@dir='virtfs']" \
"/domain/devices/disk[@type='file'][@device='cdrom']"; do
if [ -z "$TRANSIENT" ]; then
- virsh --quiet detach-device --config "$VM_NAME" \
+ virsh -c "$LIBVIRT_URI" --quiet detach-device --config "$VM_NAME" \
<(xmlstarlet select --template --copy-of "$xpath" <"$vmdef")
elif [ ${OUTPUT+x} ]; then
xmlstarlet edit --inplace --delete "$xpath" "$vmdef"
@@ -257,7 +258,7 @@ virt-install -q \
)
# wait until the VM terminates (there is actually a race condition here,
# but the XML massaging above should be faster than any install)
-virsh console "$VM_NAME" --safe >/dev/null
+virsh -c "$LIBVIRT_URI" console "$VM_NAME" --safe >/dev/null
(
if [ -f "$VMTMPDIR/virtfs/minion.pub" ]; then