Print this page
2447 beadm should be more descriptive about some errors
*** 121,145 ****
(void) fprintf(stderr, _("usage:\n"
"\tbeadm subcommand cmd_options\n"
"\n"
"\tsubcommands:\n"
"\n"
! "\tbeadm activate beName\n"
! "\tbeadm create [-d BE_desc]\n"
"\t\t[-o property=value] ... [-p zpool] \n"
! "\t\t[-e nonActiveBe | beName@snapshot] beName\n"
"\tbeadm create [-d BE_desc]\n"
! "\t\t[-o property=value] ... [-p zpool] beName@snapshot\n"
! "\tbeadm destroy [-Ffs] beName \n"
! "\tbeadm destroy [-F] beName@snapshot \n"
! "\tbeadm list [[-a] | [-d] [-s]] [-H] [beName]\n"
! "\tbeadm mount [-s ro|rw] beName [mountpoint]\n"
! "\tbeadm unmount [-f] beName | mountpoint\n"
! "\tbeadm umount [-f] beName | mountpoint\n"
! "\tbeadm rename origBeName newBeName\n"
! "\tbeadm rollback beName snapshot\n"
! "\tbeadm rollback beName@snapshot\n"));
}
static int
run_be_cmd(const char *cmdname, int argc, char **argv)
{
--- 121,145 ----
(void) fprintf(stderr, _("usage:\n"
"\tbeadm subcommand cmd_options\n"
"\n"
"\tsubcommands:\n"
"\n"
! "\tbeadm activate [-v] beName\n"
! "\tbeadm create [-a] [-d BE_desc]\n"
"\t\t[-o property=value] ... [-p zpool] \n"
! "\t\t[-e nonActiveBe | beName@snapshot] [-v] beName\n"
"\tbeadm create [-d BE_desc]\n"
! "\t\t[-o property=value] ... [-p zpool] [-v] beName@snapshot\n"
! "\tbeadm destroy [-Ffsv] beName \n"
! "\tbeadm destroy [-Fv] beName@snapshot \n"
! "\tbeadm list [[-a] | [-d] [-s]] [-H] [-v] [beName]\n"
! "\tbeadm mount [-s ro|rw] [-v] beName [mountpoint]\n"
! "\tbeadm unmount [-fv] beName | mountpoint\n"
! "\tbeadm umount [-fv] beName | mountpoint\n"
! "\tbeadm rename [-v] origBeName newBeName\n"
! "\tbeadm rollback [-v] beName snapshot\n"
! "\tbeadm rollback [-v] beName@snapshot\n"));
}
static int
run_be_cmd(const char *cmdname, int argc, char **argv)
{
*** 662,673 ****
--- 662,685 ----
static int
be_do_activate(int argc, char **argv)
{
nvlist_t *be_attrs;
int err = 1;
+ int c;
char *obe_name;
+ while ((c = getopt(argc, argv, "v")) != -1) {
+ switch (c) {
+ case 'v':
+ libbe_print_errors(B_TRUE);
+ break;
+ default:
+ usage();
+ return (1);
+ }
+ }
+
argc -= optind;
argv += optind;
if (argc != 1) {
usage();
*** 726,736 ****
char *nbe_desc = NULL;
char *propname = NULL;
char *propval = NULL;
char *strval = NULL;
! while ((c = getopt(argc, argv, "ad:e:io:p:")) != -1) {
switch (c) {
case 'a':
activate = B_TRUE;
break;
case 'd':
--- 738,748 ----
char *nbe_desc = NULL;
char *propname = NULL;
char *propval = NULL;
char *strval = NULL;
! while ((c = getopt(argc, argv, "ad:e:io:p:v")) != -1) {
switch (c) {
case 'a':
activate = B_TRUE;
break;
case 'd':
*** 764,773 ****
--- 776,788 ----
break;
case 'p':
nbe_zpool = optarg;
break;
+ case 'v':
+ libbe_print_errors(B_TRUE);
+ break;
default:
usage();
goto out2;
}
}
*** 937,954 ****
int c;
int destroy_flags = 0;
char *snap_name;
char *be_name;
! while ((c = getopt(argc, argv, "fFs")) != -1) {
switch (c) {
case 'f':
destroy_flags |= BE_DESTROY_FLAG_FORCE_UNMOUNT;
break;
case 's':
destroy_flags |= BE_DESTROY_FLAG_SNAPSHOTS;
break;
case 'F':
suppress_prompt = B_TRUE;
break;
default:
usage();
--- 952,972 ----
int c;
int destroy_flags = 0;
char *snap_name;
char *be_name;
! while ((c = getopt(argc, argv, "fFsv")) != -1) {
switch (c) {
case 'f':
destroy_flags |= BE_DESTROY_FLAG_FORCE_UNMOUNT;
break;
case 's':
destroy_flags |= BE_DESTROY_FLAG_SNAPSHOTS;
break;
+ case 'v':
+ libbe_print_errors(B_TRUE);
+ break;
case 'F':
suppress_prompt = B_TRUE;
break;
default:
usage();
*** 1059,1069 ****
boolean_t parsable = B_FALSE;
int err = 1;
int c = 0;
char *be_name = NULL;
! while ((c = getopt(argc, argv, "nadsH")) != -1) {
switch (c) {
case 'a':
all = B_TRUE;
break;
case 'd':
--- 1077,1087 ----
boolean_t parsable = B_FALSE;
int err = 1;
int c = 0;
char *be_name = NULL;
! while ((c = getopt(argc, argv, "adsvH")) != -1) {
switch (c) {
case 'a':
all = B_TRUE;
break;
case 'd':
*** 1070,1079 ****
--- 1088,1100 ----
dsets = B_TRUE;
break;
case 's':
snaps = B_TRUE;
break;
+ case 'v':
+ libbe_print_errors(B_TRUE);
+ break;
case 'H':
parsable = B_TRUE;
break;
default:
usage();
*** 1143,1153 ****
int mount_flags = 0;
char *obe_name;
char *mountpoint;
char *tmp_mp = NULL;
! while ((c = getopt(argc, argv, "s:")) != -1) {
switch (c) {
case 's':
shared_fs = B_TRUE;
mount_flags |= BE_MOUNT_FLAG_SHARED_FS;
--- 1164,1174 ----
int mount_flags = 0;
char *obe_name;
char *mountpoint;
char *tmp_mp = NULL;
! while ((c = getopt(argc, argv, "s:v")) != -1) {
switch (c) {
case 's':
shared_fs = B_TRUE;
mount_flags |= BE_MOUNT_FLAG_SHARED_FS;
*** 1160,1169 ****
--- 1181,1193 ----
usage();
return (1);
}
break;
+ case 'v':
+ libbe_print_errors(B_TRUE);
+ break;
default:
usage();
return (1);
}
}
*** 1221,1231 ****
switch (err) {
case BE_SUCCESS:
(void) printf(_("Mounted successfully on: '%s'\n"), mountpoint);
break;
case BE_ERR_BE_NOENT:
- err = 1;
(void) fprintf(stderr, _("%s does not exist or appear "
"to be a valid BE.\nPlease check that the name of "
"the BE provided is correct.\n"), obe_name);
break;
case BE_ERR_MOUNTED:
--- 1245,1254 ----
*** 1233,1249 ****
"Please unmount the BE before mounting it again.\n"),
obe_name);
break;
case BE_ERR_PERM:
case BE_ERR_ACCESS:
- err = 1;
(void) fprintf(stderr, _("Unable to mount %s.\n"), obe_name);
(void) fprintf(stderr, _("You have insufficient privileges to "
"execute this command.\n"));
break;
default:
- err = 1;
(void) fprintf(stderr, _("Unable to mount %s.\n"), obe_name);
(void) fprintf(stderr, "%s\n", be_err_to_str(err));
}
out:
--- 1256,1270 ----
*** 1260,1274 ****
char *obe_name;
int err = 1;
int c;
int unmount_flags = 0;
! while ((c = getopt(argc, argv, "f")) != -1) {
switch (c) {
case 'f':
unmount_flags |= BE_UNMOUNT_FLAG_FORCE;
break;
default:
usage();
return (1);
}
}
--- 1281,1298 ----
char *obe_name;
int err = 1;
int c;
int unmount_flags = 0;
! while ((c = getopt(argc, argv, "fv")) != -1) {
switch (c) {
case 'f':
unmount_flags |= BE_UNMOUNT_FLAG_FORCE;
break;
+ case 'v':
+ libbe_print_errors(B_TRUE);
+ break;
default:
usage();
return (1);
}
}
*** 1335,1345 ****
--- 1359,1381 ----
{
nvlist_t *be_attrs;
char *obe_name;
char *nbe_name;
int err = 1;
+ int c;
+ while ((c = getopt(argc, argv, "v")) != -1) {
+ switch (c) {
+ case 'v':
+ libbe_print_errors(B_TRUE);
+ break;
+ default:
+ usage();
+ return (1);
+ }
+ }
+
argc -= optind;
argv += optind;
if (argc != 2) {
usage();
*** 1392,1402 ****
--- 1428,1450 ----
{
nvlist_t *be_attrs;
char *obe_name;
char *snap_name;
int err = 1;
+ int c;
+ while ((c = getopt(argc, argv, "v")) != -1) {
+ switch (c) {
+ case 'v':
+ libbe_print_errors(B_TRUE);
+ break;
+ default:
+ usage();
+ return (1);
+ }
+ }
+
argc -= optind;
argv += optind;
if (argc < 1 || argc > 2) {
usage();