aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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