Print this page
OS-406
OS-249

@@ -18,10 +18,11 @@
  *
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
  */
 
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>

@@ -537,31 +538,39 @@
         if (status != DLADM_STATUS_OK)
                 goto done;
         vnic_created = B_TRUE;
 
         /* Save vnic configuration and its properties */
-        if (!(flags & DLADM_OPT_PERSIST))
-                goto done;
-
+        if (flags & DLADM_OPT_PERSIST) {
         status = dladm_vnic_persist_conf(handle, name, &attr, class);
-        if (status != DLADM_STATUS_OK)
-                goto done;
+                if (status == DLADM_STATUS_OK)
         conf_set = B_TRUE;
+        }
 
-        if (proplist != NULL) {
+done:
+        if (status == DLADM_STATUS_OK && proplist != NULL) {
+                uint32_t flg;
+
+                flg = (flags & DLADM_OPT_PERSIST) ?
+                    DLADM_OPT_PERSIST : DLADM_OPT_ACTIVE;
+
                 for (i = 0; i < proplist->al_count; i++) {
                         dladm_arg_info_t        *aip = &proplist->al_info[i];
 
+                        if (strcmp(aip->ai_name, "zone") == 0 &&
+                            flags & DLADM_OPT_TRANSIENT)
+                                flg |= DLADM_OPT_TRANSIENT;
+                        else
+                                flg &= ~DLADM_OPT_TRANSIENT;
+
                         status = dladm_set_linkprop(handle, vnic_id,
-                            aip->ai_name, aip->ai_val, aip->ai_count,
-                            DLADM_OPT_PERSIST);
+                            aip->ai_name, aip->ai_val, aip->ai_count, flg);
                         if (status != DLADM_STATUS_OK)
                                 break;
                 }
         }
 
-done:
         if (status != DLADM_STATUS_OK) {
                 if (conf_set)
                         (void) dladm_remove_conf(handle, vnic_id);
                 if (vnic_created)
                         (void) i_dladm_vnic_delete_sys(handle, vnic_id);