diff options
-rwxr-xr-x | tdfvm-install | 18 | ||||
-rwxr-xr-x | virsh-ga | 4 |
2 files changed, 14 insertions, 8 deletions
diff --git a/tdfvm-install b/tdfvm-install index e1091fb..10e83b3 100755 --- a/tdfvm-install +++ b/tdfvm-install @@ -304,20 +304,24 @@ xmlstarlet edit --omit-decl --inplace \ [ "$TRANSIENT" = y ] || virsh -c "$LIBVIRT_URI" define "$VMDIR/$VM_NAME.xml" # wait until the guest starts its QEMU Agent at the end of the installation -while :; do - ./virsh-ga -c "$LIBVIRT_URI" "$VM_NAME" ping && break || rv=$? - [ $rv -eq 128 ] || exit $rv - sleep 1 -done +guest_agent() { + local rv + while :; do + ./virsh-ga -c "$LIBVIRT_URI" "$VM_NAME" "$@" && break || rv=$? + [ $rv -eq 128 ] || exit $rv + sleep 1 + done +} +guest_agent ping # then copy the public key material for path in /etc/ssh/ssh_host_rsa_key.pub \ /etc/ssh/ssh_host_ed25519_key.pub \ /etc/salt/pki/minion/minion.pub; do - ./virsh-ga -c "$LIBVIRT_URI" "$VM_NAME" cat "$path" >"$VMDIR/${path##*/}" + guest_agent cat "$path" >"$VMDIR/${path##*/}" done -./virsh-ga -c "$LIBVIRT_URI" "$VM_NAME" touch /tmp/tdf-install-continue +guest_agent touch /tmp/tdf-install-continue virsh -c "$LIBVIRT_URI" console "$VM_NAME" --safe >/dev/null # wait until shutdown ( @@ -52,7 +52,9 @@ sub ga_send(@) { my $h = JSON->new->utf8->allow_nonref->decode($str{$out}); return $h->{return}; } - elsif ($str{$err} eq "error: Guest agent is not responding: QEMU guest agent is not connected\n") { + elsif ($str{$err} eq "error: Guest agent is not responding: QEMU guest agent is not connected\n" + or $str{$err} eq "error: Guest agent is not responding: Guest agent not available for now\n" + or $str{$err} =~ /\Aerror: internal error: Guest agent returned ID: \d+ instead of \d+\n\z/) { exit 128; } else { die $str{$err}; |