Mercurial > illumos > illumos-gate
diff usr/src/uts/common/fs/zfs/spa.c @ 8662:18153249ee93
PSARC/2008/647 Configurable Hostids for Non-Global Zones
6580939 RFE: provide unique hostid for each non-global zone
author | jv227347 <Jordan.Vaughan@Sun.com> |
---|---|
date | Fri, 30 Jan 2009 12:25:48 -0800 |
parents | e0e0e525d0f8 |
children | 5c308a17eb7c |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/spa.c Fri Jan 30 11:54:57 2009 -0800 +++ b/usr/src/uts/common/fs/zfs/spa.c Fri Jan 30 12:25:48 2009 -0800 @@ -60,6 +60,10 @@ #include <sys/sunddi.h> #include <sys/spa_boot.h> +#ifdef _KERNEL +#include <sys/zone.h> +#endif /* _KERNEL */ + #include "zfs_prop.h" #include "zfs_comutil.h" @@ -1222,9 +1226,17 @@ VERIFY(nvlist_lookup_string(newconfig, ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); +#ifdef _KERNEL + myhostid = zone_get_hostid(NULL); +#else /* _KERNEL */ + /* + * We're emulating the system's hostid in userland, so + * we can't use zone_get_hostid(). + */ (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid); +#endif /* _KERNEL */ if (hostid != 0 && myhostid != 0 && - (unsigned long)hostid != myhostid) { + hostid != myhostid) { cmn_err(CE_WARN, "pool '%s' could not be " "loaded as it was last accessed by " "another system (host: %s hostid: 0x%lx). "