Print this page
7711 SMF: Finish implementing support for degraded state

@@ -23,10 +23,11 @@
  * Use is subject to license terms.
  */
 
 /*
  * Copyright 2015, Joyent, Inc. All rights reserved.
+ * Copyright 2017 RackTop Systems.
  */
 
 /*
  * svcadm - request adminstrative actions for service instances
  */

@@ -1929,10 +1930,17 @@
                 uu_warn(gettext("Instance \"%s\" is not online.\n"), wip->fmri);
                 exit_status = 1;
                 return (0);
         }
 
+        if ((flags & MARK_TEMPORARY) == 0) {
+                uu_warn(gettext("Instance \"%s\" cannot be degraded "
+                    "permantently.\n"), wip->fmri);
+                exit_status = 1;
+                return (0);
+        }
+
         set_inst_action(wip->fmri, wip->inst, (flags & MARK_IMMEDIATE) ?
             SCF_PROPERTY_DEGRADE_IMMEDIATE : SCF_PROPERTY_DEGRADED);
 
         return (0);
 }

@@ -2505,15 +2513,11 @@
 
                 if (argc - optind < 2)
                         usage();
 
                 if (strcmp(argv[optind], "degraded") == 0) {
-                        if (flags & MARK_TEMPORARY)
-                                uu_xdie(UU_EXIT_USAGE, gettext("-t may not be "
-                                    "used with degraded.\n"));
                         callback = force_degraded;
-
                 } else if (strcmp(argv[optind], "maintenance") == 0) {
                         callback = force_maintenance;
                 } else {
                         usage();
                 }

@@ -2527,11 +2531,11 @@
 
                 if (argc > 0 && svcsearch)
                         usage();
 
                 if ((err = scf_walk_fmri(h, argc, argv, WALK_FLAGS, callback,
-                    NULL, &exit_status, pr_warn)) != 0) {
+                    (void *)flags, &exit_status, pr_warn)) != 0) {
                         pr_warn(gettext("failed to iterate over "
                             "instances: %s\n"),
                             scf_strerror(err));
                         exit_status = UU_EXIT_FATAL;
                 }