Print this page
OS-192 zone_create() warning on headnode

@@ -21,10 +21,11 @@
 
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2011, Joyent Inc. All rights reserved.
  */
 
 /*
  * zoneadmd manages zones; one zoneadmd process is launched for each
  * non-global zone on the system.  This daemon juggles four jobs:

@@ -115,10 +116,11 @@
 boolean_t zone_isnative;
 boolean_t zone_iscluster;
 boolean_t zone_islabeled;
 boolean_t shutdown_in_progress;
 static zoneid_t zone_id;
+static zoneid_t zone_did = 0;
 dladm_handle_t dld_handle = NULL;
 
 static char pre_statechg_hook[2 * MAXPATHLEN];
 static char post_statechg_hook[2 * MAXPATHLEN];
 char query_hook[2 * MAXPATHLEN];

@@ -545,11 +547,14 @@
                 zerror(zlogp, B_FALSE, "unable to create snapshot: %s",
                     zonecfg_strerror(err));
                 goto bad;
         }
 
-        if ((zone_id = vplat_create(zlogp, mount_cmd)) == -1) {
+        if (zone_did == 0)
+                zone_did = zone_get_did(zone_name);
+
+        if ((zone_id = vplat_create(zlogp, mount_cmd, zone_did)) == -1) {
                 if ((err = zonecfg_destroy_snapshot(zone_name)) != Z_OK)
                         zerror(zlogp, B_FALSE, "destroying snapshot: %s",
                             zonecfg_strerror(err));
                 goto bad;
         }

@@ -1353,12 +1358,12 @@
                                 eventstream_write(Z_EVT_ZONE_READIED);
                         break;
                 case Z_BOOT:
                 case Z_FORCEBOOT:
                         eventstream_write(Z_EVT_ZONE_BOOTING);
-                        if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate))
-                            == 0) {
+                        if ((rval = zone_ready(zlogp, Z_MNT_BOOT,
+                            zstate)) == 0) {
                                 rval = zone_bootup(zlogp, zargp->bootbuf,
                                     zstate);
                         }
                         audit_put_record(zlogp, uc, rval, "boot");
                         if (rval != 0) {

@@ -1542,11 +1547,12 @@
                 switch (cmd) {
                 case Z_READY:
                         if ((rval = zone_halt(zlogp, B_FALSE, B_TRUE, zstate))
                             != 0)
                                 break;
-                        if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate)) == 0)
+                        if ((rval = zone_ready(zlogp, Z_MNT_BOOT, zstate))
+                            == 0)
                                 eventstream_write(Z_EVT_ZONE_READIED);
                         else
                                 eventstream_write(Z_EVT_ZONE_HALTED);
                         break;
                 case Z_BOOT: