Using The List Function - Oracle ZFS Storage Appliance Administration Manual

Hide thumbs Also See for ZFS Storage Appliance:
Table of Contents

Advertisement

The message about pseudo-terminal allocation is due to the ssh client; the issue that this
message refers to can be dealt with by specifying the "-T" option to ssh.

Using the List Function

In a context with dynamic children, it can be very useful to iterate over those children
programmatically. This can be done by using the list function, which returns an array of
dynamic children.
1.
The following example script iterates over every share in every project, printing
out the amount of space consumed and space available:
script
run('shares');
projects = list();
for (i = 0; i < projects.length; i++) {
run('select ' + projects[i]);
shares = list();
for (j = 0; j < shares.length; j++) {
}
run('cd ..');
}
Here is the output of running the script, assuming it were saved to a file named
2.
"space.aksh":
% ssh root@koi < space.aksh
Password:
admin/accounts 18432 266617007104
admin/exports 18432 266617007104
admin/primary 18432 266617007104
admin/traffic 18432 266617007104
admin/workflow 18432 266617007104
aleventhal/hw_eng 18432 266617007104
bcantrill/analytx 1073964032 266617007104
bgregg/dashbd 18432 266617007104
bgregg/filesys01 26112 107374156288
run('select ' + shares[j]);
printf("%s/%s %1.64g %1.64g\n", projects[i], shares[j],
get('space_data'), get('space_available'));
run('cd ..');
Using the List Function
About the Oracle ZFS Storage Appliance
47

Advertisement

Table of Contents
loading

Table of Contents