kdevops.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
To: kdevops@lists.linux.dev
Cc: jlayton@kernel.org
Subject: [PATCH] guestfs: Don't abort bringup if domain is already defined
Date: Thu,  4 Jan 2024 12:47:49 -0500	[thread overview]
Message-ID: <20240104174749.101272-1-smayhew@redhat.com> (raw)

If the domain is already defined, then just start it.  This is what the
Vagrant bringup script does.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 scripts/bringup_guestfs.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/bringup_guestfs.sh b/scripts/bringup_guestfs.sh
index d529ae41..93f7afa7 100755
--- a/scripts/bringup_guestfs.sh
+++ b/scripts/bringup_guestfs.sh
@@ -66,8 +66,9 @@ do
 	#
 	virsh domstate $name 1>/dev/null 2>&1
 	if [ $? -eq 0 ]; then
-		echo "Domain $name is already defined. Aborting!"
-		exit 1
+		echo "Domain $name is already defined."
+		virsh start $name
+		exit 0
 	fi
 
 	SSH_KEY_DIR="${GUESTFSDIR}/$name/ssh"
-- 
2.41.0


             reply	other threads:[~2024-01-04 17:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 17:47 Scott Mayhew [this message]
2024-01-04 18:23 ` [PATCH] guestfs: Don't abort bringup if domain is already defined Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240104174749.101272-1-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc=jlayton@kernel.org \
    --cc=kdevops@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).