Hello, How would I go about finding out which zone owns a particular dataset from a script running in the global zone? We have some ZFS datasets that can "float" between zones on different servers in order to provide a manual application failover mechanism. I''ve got scripts that gather disk usage and i/o statistics per dataset, but I''d like to make those statistics available in the zone which owns the dataset, rather than the global zone (which is where the dtrace script has to run). So I''d like to be able to find out which zone owns the dataset in order to direct output into a directory within that zone. Is this possible? Thanks in advance, - Johnson jearls at responsys.com
On 07/14/10 05:45 PM, Johnson Earls wrote:> Hello, > > How would I go about finding out which zone owns a particular dataset from a script running in the global zone? >> We have some ZFS datasets that can "float" between zones on different servers in order to provide a manual application failover mechanism.I don''t know what you mean by datasets "floating" between zones. In order for a zone to access a dataset, the dataset must have been delegated to the zone, which requires some explicit action. But to answer your specific question, if you look at a mounted dataset''s entry in /etc/mnttab: rpool/z2-del /myz2 zfs rw,nodevices,setuid,nonbmand,exec,xattr,atime,zone=z2,dev=16d001c 1279296850 you''ll see a ''zone=<name>'' entry if the zone is delegated to the zone (assuming it''s mounted at all). Oddly, enough, the "zone=<zone>" string doesn''t appear for the zone root. I''m not sure if that''s intentional or an oversight. But in any case, it doesn''t appear that you''re looking for zone roots. You can also run through the zones, doing ''zoneconfig -z <zone> info'' commands to look for datasets delegated to each zone. Lori> I''ve got scripts that gather disk usage and i/o statistics per dataset, but I''d like to make those statistics available in the zone which owns the dataset, rather than the global zone (which is where the dtrace script has to run). So I''d like to be able to find out which zone owns the dataset in order to direct output into a directory within that zone. Is this possible? > > Thanks in advance, > - Johnson > jearls at responsys.com > > > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss >
Lori, Thanks for the reply. By "floating" I mean we have a set of scripts that will shut down a zone, export all the ZFS pools attached to that zone, modify the zone config to not have those datasets associated anymore, then, on another system, import the ZFS pools, modify the new zone''s config to include those datasets, and boot the zone. I''ll look at using the mount-option thing, thanks for that. - Johnson On 07/16/10 10:30 AM, Lori Alt wrote:> > On 07/14/10 05:45 PM, Johnson Earls wrote: > > Hello, > > > > How would I go about finding out which zone owns a particular dataset from a script running in the > global zone? > > > > > We have some ZFS datasets that can "float" between zones on different servers in order to provide > a manual application failover mechanism. > > I don''t know what you mean by datasets "floating" between zones. In > order for a zone to access a dataset, the dataset must have been > delegated to the zone, which requires some explicit action. > > But to answer your specific question, if you look at a mounted dataset''s > entry in /etc/mnttab: > > rpool/z2-del /myz2 zfs > rw,nodevices,setuid,nonbmand,exec,xattr,atime,zone=z2,dev=16d001c > 1279296850 > > you''ll see a ''zone=<name>'' entry if the zone is delegated to the zone > (assuming it''s mounted at all). > > Oddly, enough, the "zone=<zone>" string doesn''t appear for the zone > root. I''m not sure if that''s intentional or an oversight. But in any > case, it doesn''t appear that you''re looking for zone roots. > > You can also run through the zones, doing ''zoneconfig -z <zone> info'' > commands to look for datasets delegated to each zone. > > > Lori- Johnson jearls at responsys.com
On 7/16/10 4:33 PM -0700 Johnson Earls wrote:> On 07/16/10 10:30 AM, Lori Alt wrote: >> You can also run through the zones, doing ''zoneconfig -z <zone> info'' >> commands to look for datasets delegated to each zone.That''s not necessarily the current owner though, is it?