Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151941128
D54092.id167961.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54092.id167961.diff
View Options
diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c
--- a/usr.sbin/bhyvectl/bhyvectl.c
+++ b/usr.sbin/bhyvectl/bhyvectl.c
@@ -326,7 +326,7 @@
main(int argc, char *argv[])
{
char *vmname;
- int error, ch, vcpuid;
+ int action_opts, error, ch, vcpuid;
struct vm_run vmrun;
struct vmctx *ctx;
struct vcpu *vcpu;
@@ -338,6 +338,7 @@
opts = setup_options();
+ action_opts = 0;
vcpuid = 0;
vmname = NULL;
progname = basename(argv[0]);
@@ -388,6 +389,14 @@
if (vmname == NULL)
usage(opts);
+ action_opts = create + destroy + force_reset + force_poweroff;
+ if (checkpoint_file)
+ action_opts++;
+
+ if (action_opts > 1) {
+ fprintf(stderr, "mutually exclusive actions specified\n");
+ exit(1);
+ }
ctx = vm_openf(vmname, create ? VMMAPI_OPEN_CREATE : 0);
if (ctx == NULL) {
@@ -508,17 +517,17 @@
if (!error && force_poweroff)
error = vm_suspend(ctx, VM_SUSPEND_POWEROFF);
+#ifdef BHYVE_SNAPSHOT
+ if (!error && checkpoint_file)
+ error = snapshot_request(vmname, checkpoint_file, vm_suspend_opt);
+#endif
+
if (error)
printf("errno = %d\n", errno);
if (!error && destroy)
vm_destroy(ctx);
-#ifdef BHYVE_SNAPSHOT
- if (!error && checkpoint_file)
- error = snapshot_request(vmname, checkpoint_file, vm_suspend_opt);
-#endif
-
free(opts);
exit(error);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 12, 4:03 PM (9 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31357558
Default Alt Text
D54092.id167961.diff (1 KB)
Attached To
Mode
D54092: bhyvectl: improve options error handling
Attached
Detach File
Event Timeline
Log In to Comment