From nobody Fri Mar 17 10:29:35 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PdL3N0ngHz3y9rL; Fri, 17 Mar 2023 10:29:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PdL3N0GVnz3HNZ; Fri, 17 Mar 2023 10:29:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679048976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tOEO1ibatqtV8Wwvi9ZoXm9UQpeDjF034e+WJjGc2J4=; b=GyCajnxuux8VtrpVdbIrl8Tp7zp64wyfUPicvxJtKZBlpkb6gVuyKUHenTynOijnJqwND/ 8BYN/wm8WHxk5L8991oo+pAoOXwvzMQ3fc4qKan4CErjQmwz8nULQUB18J9cenm7apRKjG 1kL6L4jSmUw65IrnN21bbpuNUmB42VcIUdlwP6Hki+ZR3t42QgYDEKywlxVdf6deYkBXb5 RR9xZtyHrNrnaTRUZCNsiloSbuQTKFzGKi+UspLJ4kZf1uTFfp0fpj8pW4sPjVkp34+pz4 YJuvwSybu35pBA2j/0Wy0CjBu+H2d4pK2RbqGLR+IVsuZYV2x/N4p1ZVXXyDwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679048976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tOEO1ibatqtV8Wwvi9ZoXm9UQpeDjF034e+WJjGc2J4=; b=LbgMdmr+lCQVxv/I5T9mcV7YlZK7tqrmqj+FwKjFM1sA93sy0hARd0IL1i0x2RX869mini q0U8pBIXYd31Cm7nr1eu4aSnMeFquD+MOso3Fow2VBjtchAcElP1eM9geB2Ro/Kqd++1FI fmM4qg9VyuHd9lUokhH3ZUj5tNGcdT47nNWOU0Bndqwj7L4lbaj1k4UvdowcuCMaxqIMLn XQRwQmRZGg3ew+3swKl0aaFIXZ1BvGzR8l58Xei2NAT7BpuqbnsHeVEJeJvKnn+s8zMhO8 ztV4k0Yni7TlK4IpW/lKHKD5fttP5gKjupHXjEm/bnmxj73zruPZrQAFVw+GvQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679048976; a=rsa-sha256; cv=none; b=IEcfYx/qIc4ZQHwKbkcuTD91QB+Ge9gAt7JZ1Nm/ynmUQYS25BNajTlCoMz2uK/YdfY3VM sZWNnfL6njCqZ38pezgRsLXnGLW5NewoQfdjbFv4poWjDVimZaObFAYbv3kWmc+hDmLweN zbMezh2riq5mypJeagigeiCwYFnMoO6RPYt1FfnOVYtEcT3MtuVmlwwAW5bu1QzqV9ivRH HM1h1oRYfGWmAddS1Cmow4eIMhN/GXK+HSb7e1Wlv/2Wbt94uwgyx28yWgoPR8QdQuBQLL k0pbMymd/oqQT7hDggebmtThHoLEp3m9CikD4hdcdQWwfWx2HXpOP++8/Kq5Mw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PdL3M62VgzMpb; Fri, 17 Mar 2023 10:29:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32HATZeO067591; Fri, 17 Mar 2023 10:29:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32HATZlE067590; Fri, 17 Mar 2023 10:29:35 GMT (envelope-from git) Date: Fri, 17 Mar 2023 10:29:35 GMT Message-Id: <202303171029.32HATZlE067590@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 4e10f8056b24 - stable/13 - bhyvectl: don't permit using --suspend and --checkpoint at same time List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: corvink X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e10f8056b24df320fdc0c2d520461e3155597d3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=4e10f8056b24df320fdc0c2d520461e3155597d3 commit 4e10f8056b24df320fdc0c2d520461e3155597d3 Author: Vitaliy Gusev AuthorDate: 2023-03-06 12:42:15 +0000 Commit: Corvin Köhne CommitDate: 2023-03-17 10:26:35 +0000 bhyvectl: don't permit using --suspend and --checkpoint at same time When using the --suspend and --checkpoint parameter, bhyvectl will produce two checkpoint images and the exits. This is slightly ambiguous. So, permit only one of theses parameters at the same time. Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38887 (cherry picked from commit 062f2818c1ad35bdc3d520c7572e3cefda657770) --- usr.sbin/bhyvectl/bhyvectl.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index 4aa235e00489..e5789eaf30e8 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -86,8 +86,7 @@ usage(bool cpu_intel) " [--create]\n" " [--destroy]\n" #ifdef BHYVE_SNAPSHOT - " [--checkpoint=]\n" - " [--suspend=]\n" + " [--checkpoint= | --suspend=]\n" #endif " [--get-all]\n" " [--get-stats]\n" @@ -299,7 +298,6 @@ static int unassign_pptdev, bus, slot, func; static int run; static int get_cpu_topology; #ifdef BHYVE_SNAPSHOT -static int vm_checkpoint_opt; static int vm_suspend_opt; #endif @@ -1743,7 +1741,7 @@ main(int argc, char *argv[]) struct tm tm; struct option *opts; #ifdef BHYVE_SNAPSHOT - char *checkpoint_file, *suspend_file; + char *checkpoint_file = NULL; #endif cpu_intel = cpu_vendor_intel(); @@ -1905,12 +1903,12 @@ main(int argc, char *argv[]) break; #ifdef BHYVE_SNAPSHOT case SET_CHECKPOINT_FILE: - vm_checkpoint_opt = 1; - checkpoint_file = optarg; - break; case SET_SUSPEND_FILE: - vm_suspend_opt = 1; - suspend_file = optarg; + if (checkpoint_file != NULL) + usage(cpu_intel); + + checkpoint_file = optarg; + vm_suspend_opt = (ch == SET_SUSPEND_FILE); break; #endif default: @@ -2385,11 +2383,8 @@ main(int argc, char *argv[]) vm_destroy(ctx); #ifdef BHYVE_SNAPSHOT - if (!error && vm_checkpoint_opt) - error = snapshot_request(vmname, checkpoint_file, false); - - if (!error && vm_suspend_opt) - error = snapshot_request(vmname, suspend_file, true); + if (!error && checkpoint_file) + error = snapshot_request(vmname, checkpoint_file, vm_suspend_opt); #endif free (opts);