summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/brand/lx/zone/lx_boot_zone_ubuntu.ksh15
-rw-r--r--usr/src/lib/brand/lx/zone/lx_install.ksh10
-rw-r--r--usr/src/uts/common/brand/lx/procfs/lx_prvnops.c86
3 files changed, 91 insertions, 20 deletions
diff --git a/usr/src/lib/brand/lx/zone/lx_boot_zone_ubuntu.ksh b/usr/src/lib/brand/lx/zone/lx_boot_zone_ubuntu.ksh
index e79b8d7a26..2d664be89d 100644
--- a/usr/src/lib/brand/lx/zone/lx_boot_zone_ubuntu.ksh
+++ b/usr/src/lib/brand/lx/zone/lx_boot_zone_ubuntu.ksh
@@ -11,7 +11,7 @@
#
#
-# Copyright 2015 Joyent, Inc.
+# Copyright 2016 Joyent, Inc.
#
#
@@ -29,6 +29,13 @@ safe_dir /etc/network
safe_dir /etc/network/interfaces.d
safe_dir /etc/network/interfaces.d/smartos
+ZPOOL=`df $ZONEROOT | awk -F '[()]' '{split($2, field, "/"); print field[1]; }'`
+if [ -z "$ZPOOL" ]; then
+ ROOTDEV="/"
+else
+ ROOTDEV="/dev/$ZPOOL"
+fi
+
# Populate resolve.conf setup files
zonecfg -z $ZONENAME info attr name=resolvers | awk '
BEGIN {
@@ -99,8 +106,8 @@ fi
# XXX need to add real mounting into this svc definition
fnm=$ZONEROOT/etc/init/mountall.override
-if [[ ! -f $fnm && ! -h $fnm ]] then
- cat <<'DONE' > $fnm
+if [[ ! -h $fnm ]] then
+ cat <<DONE > $fnm
description "Mount filesystems on boot"
start on startup
@@ -115,7 +122,7 @@ emits filesystem
emits mounted
script
- echo "/ / zfs rw 0 0" > /etc/mtab
+ echo "$ROOTDEV / zfs rw 0 0" > /etc/mtab
echo "proc /proc proc rw,noexec,nosuid,nodev 0 0" >> /etc/mtab
/sbin/initctl emit --no-wait virtual-filesystems
diff --git a/usr/src/lib/brand/lx/zone/lx_install.ksh b/usr/src/lib/brand/lx/zone/lx_install.ksh
index c51c4fa008..c31b8355ac 100644
--- a/usr/src/lib/brand/lx/zone/lx_install.ksh
+++ b/usr/src/lib/brand/lx/zone/lx_install.ksh
@@ -9,7 +9,7 @@
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
-# Copyright 2015 Joyent, Inc. All rights reserved.
+# Copyright 2016 Joyent, Inc. All rights reserved.
#
#
@@ -80,6 +80,12 @@ zonename="$1"
zoneroot="$2"
install_src="3"
install_root="$zoneroot/root"
+ZPOOL=`df $ZONEROOT | awk -F '[()]' '{split($2, field, "/"); print field[1]; }'`
+if [ -z "$ZPOOL" ]; then
+ ROOTDEV="none"
+else
+ ROOTDEV="/dev/$ZPOOL"
+fi
if [[ ! -f "$install_src" ]]; then
echo "$install_src: file not found\n"
@@ -151,7 +157,7 @@ fi
mv -f etc/fstab etc/fstab.$tag 2>/dev/null
cat > etc/fstab <<- EOF
- none / zfs defaults 1 1
+ $ROOTDEV / zfs defaults 1 1
proc /proc proc defaults 0 0
EOF
diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
index f4e5c857ba..7648bf1ecb 100644
--- a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
+++ b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
@@ -115,6 +115,8 @@ static int lxpr_realvp(vnode_t *, vnode_t **, caller_context_t *);
static int lxpr_sync(void);
static void lxpr_inactive(vnode_t *, cred_t *, caller_context_t *);
+static char *lxpr_zv_basename(char *);
+
static vnode_t *lxpr_lookup_procdir(vnode_t *, char *);
static vnode_t *lxpr_lookup_piddir(vnode_t *, char *);
static vnode_t *lxpr_lookup_not_a_dir(vnode_t *, char *);
@@ -1604,18 +1606,44 @@ lxpr_read_pid_mountinfo(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
if (vfslist == NULL || strcmp(refstr_value(vfsp->vfs_mntpt),
zone->zone_rootpath) != 0) {
struct vfs *tvfsp;
+ char *rootdev = NULL;
+ lx_zone_data_t *lxzdata;
+ lxd_zfs_dev_t *zv;
+ char zdev[MAXPATHLEN];
+
/*
* The root of the zone is not a mount point. The vfs
* we want to report is that of the zone's root vnode.
*/
tvfsp = zone->zone_rootvp->v_vfsp;
+ lxzdata = ztolxzd(curproc->p_zone);
+ ASSERT(lxzdata != NULL);
+ ASSERT(lxzdata->lxzd_vdisks != NULL);
+
+ zv = list_head(lxzdata->lxzd_vdisks);
+ while (zv != NULL) {
+ if (zv->lzd_type == LXD_ZFS_DEV_POOL) {
+ (void) snprintf(zdev, sizeof (zdev),
+ "/dev/%s",
+ lxpr_zv_basename(zv->lzd_name));
+ rootdev = zdev;
+ break;
+ }
+
+ zv = list_next(lxzdata->lxzd_vdisks, zv);
+ }
+
+ if (rootdev == NULL)
+ rootdev = "/";
+
lxpr_uiobuf_printf(uiobuf,
- "%d 1 %d:%d / / %s - %s / %s\n",
+ "%d 1 %d:%d / / %s - %s %s %s\n",
root_id,
major(tvfsp->vfs_dev), minor(vfsp->vfs_dev),
tvfsp->vfs_flag & VFS_RDONLY ? "ro" : "rw",
vfssw[tvfsp->vfs_fstype].vsw_name,
+ rootdev,
tvfsp->vfs_flag & VFS_RDONLY ? "ro" : "rw");
}
@@ -1732,8 +1760,9 @@ nextp:
mnt_id++;
}
- /* Add a single dummy entry for /native */
- lxpr_uiobuf_printf(uiobuf, "%d %d 0:1 / /native ro - zfs /native ro\n",
+ /* Add a single dummy entry for /native/usr */
+ lxpr_uiobuf_printf(uiobuf,
+ "%d %d 0:1 / /native/usr ro - zfs /native/usr ro\n",
mnt_id, root_id);
}
@@ -3474,14 +3503,40 @@ lxpr_read_mounts(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
if (vfslist == NULL || strcmp(refstr_value(vfsp->vfs_mntpt),
zone->zone_rootpath) != 0) {
struct vfs *tvfsp;
+ char *rootdev = NULL;
+ lx_zone_data_t *lxzdata;
+ lxd_zfs_dev_t *zv;
+ char zdev[MAXPATHLEN];
+
/*
* The root of the zone is not a mount point. The vfs
* we want to report is that of the zone's root vnode.
*/
tvfsp = zone->zone_rootvp->v_vfsp;
+ lxzdata = ztolxzd(curproc->p_zone);
+ ASSERT(lxzdata != NULL);
+ ASSERT(lxzdata->lxzd_vdisks != NULL);
+
+ zv = list_head(lxzdata->lxzd_vdisks);
+ while (zv != NULL) {
+ if (zv->lzd_type == LXD_ZFS_DEV_POOL) {
+ (void) snprintf(zdev, sizeof (zdev),
+ "/dev/%s",
+ lxpr_zv_basename(zv->lzd_name));
+ rootdev = zdev;
+ break;
+ }
+
+ zv = list_next(lxzdata->lxzd_vdisks, zv);
+ }
+
+ if (rootdev == NULL)
+ rootdev = "/";
+
lxpr_uiobuf_printf(uiobuf,
- "/ / %s %s 0 0\n",
+ "%s / %s %s 0 0\n",
+ rootdev,
vfssw[tvfsp->vfs_fstype].vsw_name,
tvfsp->vfs_flag & VFS_RDONLY ? "ro" : "rw");
@@ -3586,8 +3641,8 @@ nextp:
}
- /* Add a single dummy entry for /native */
- lxpr_uiobuf_printf(uiobuf, "/native /native zfs ro 0 0\n");
+ /* Add a single dummy entry for /native/usr */
+ lxpr_uiobuf_printf(uiobuf, "/native/usr /native/usr zfs ro 0 0\n");
}
/* zvol basename to flatten namespace */
@@ -3665,7 +3720,7 @@ lxpr_read_diskstats(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
{
kstat_t kn;
int num;
- int zv_min = 0;
+ int zv_min = 1;
zone_vfs_kstat_t *kip;
int major, minor;
size_t size;
@@ -3697,6 +3752,15 @@ lxpr_read_diskstats(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
}
/*
+ * We make all of the zfs devices look like they are in the unused
+ * range (see /etc/sysstat/sysstat.ioconf on a Linux distro) so that
+ * utilities like iostat will simply report our "device" name instead
+ * of one of the well-known disk types listed in the sysstat.ioconf
+ * file.
+ */
+ major = 203;
+
+ /*
* Because the zone vfs stats are tracked at the zone level we use
* the same kstat for the zone's virtual disk (the zpool) and any
* zvols that might also visible within the zone.
@@ -3743,18 +3807,12 @@ lxpr_read_diskstats(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
*/
if (zv->lzd_type == LXD_ZFS_DEV_POOL) {
- /* map zfs pools to md[0-9]+ (software RAID) */
- major = 9;
minor = 0;
} else {
/*
- * The zvols are in the unused range (see
- * /etc/sysstat/sysstat.ioconf on a Linux distro).
* Use a counter for the fabricated minor number since
- * Linux only supports 20 bits for minor numbers, which
- * allows for 65k zvols if we want scale by partition.
+ * Linux only supports 20 bits for minor numbers.
*/
- major = 203;
minor = zv_min++;
}