From nobody Mon Mar 06 13:05:33 2023 X-Original-To: dev-commits-src-all@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 4PVf2P4HRcz3wsPx; Mon, 6 Mar 2023 13:05:33 +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 4PVf2P1zr6z3HJC; Mon, 6 Mar 2023 13:05:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678107933; 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=Kevvjpd411uQIzgyDvjoZXjw1zk20uWZbR6HyO3p4J0=; b=kgy+sVDfpJQNzLIr0WPLV8wM0iFjlJ0NBaXUnzroE0i/KUVM5oHMl/ZqJ0huqYEiXdwOy8 rThL6iLEE3USJj0sJWOgeJFq0SPKKLv5p8OKLgiIUw+hC+b+b05/+Mrb9io8vKH5kUsdRN bkxOV6oKfnQ5eYomGUZVjMBrSc1zdxVHv1cOu322HOUHgP1vA6P9FMeISsgGHvG8Kq/PbO qBA4gq0JX35KXOgHJxx1El/P2t0OqqBlg2J8UnDvlchIOsH49oEgyDohR7lALWMirEJnJM s6KHBPKPiEFODc5DC4Dwb+ijje5cEOaQEA+iK1FPtVe90ymK6Hx0WU0v0ZUNZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678107933; 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=Kevvjpd411uQIzgyDvjoZXjw1zk20uWZbR6HyO3p4J0=; b=qXtc/UW09clMUPuBNdDGrtHO+COR9D6r914HOE2/Y/xJ4dtT95uPa+mU7hJCLeWLgld1NS cmxTJPo3IuM3X9O3IxBmiMyMocBOdbQ234tnN/JZpUw8I3oioiehsFIN7MYKI2HlVvEN78 o/1oY5paE9waxi5UV5YmlKqauozr5erxjX+kfATWmr1N06ZAmHyhb4MgrMwHerqFqSb6Bx m+w/OYGGJsveK4mIvYcBdpY54q+g4cc56KCOBfJLrIt5F8T+VboOizlLSPuIx5B0HTfzJI nvc3dXxQVoph8fDLq077mR39YT1syUsEFl6gxIbYqDVKPNEi/S/1pmwvEDeu5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678107933; a=rsa-sha256; cv=none; b=leSqm9bUggGs6fTcOAG6kK11RB8ECypYpvbo9nyFSP8l07HeBYytVwV9pSx4Zty4Dixxvp PfjtZWA1nhTkSJeFHQxN5Zm3IN/oyZzMOxxKEHrJDQeIJI6IqRwI51gWyUlETwGTMLpyEa FVG/sAujhHKxbFm6VTEVVt4as3gnKEtre6OIjqoFj9RhiPM+Phq5+46LJz39RJAPgC2MAt or02PSC99iVr6IufB4N5ddqyLo0HQvRwLC2eHzdqgqO/eaWZWE93iNg2CxxA0p1WzOtyJo Ro4ZwqQ02wIcT9CDQDlH2ojiFmHKb9xyL570r1lo8VH7H3s3Uv0t5/27QiNPbw== 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 4PVf2P12Wcz13D2; Mon, 6 Mar 2023 13:05:33 +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 326D5X46079551; Mon, 6 Mar 2023 13:05:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 326D5XPh079550; Mon, 6 Mar 2023 13:05:33 GMT (envelope-from git) Date: Mon, 6 Mar 2023 13:05:33 GMT Message-Id: <202303061305.326D5XPh079550@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: 062f2818c1ad - main - bhyvectl: don't permit using --suspend and --checkpoint at same time List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 062f2818c1ad35bdc3d520c7572e3cefda657770 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=062f2818c1ad35bdc3d520c7572e3cefda657770 commit 062f2818c1ad35bdc3d520c7572e3cefda657770 Author: Vitaliy Gusev AuthorDate: 2023-03-06 12:42:15 +0000 Commit: Corvin Köhne CommitDate: 2023-03-06 13:04:26 +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 --- 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);