I am using to manage the NFS export permissions on 7-mode filers, mostly 8.2.x from a perl client.
To do this we include NaElements of type "export-hostsname-info" with a string of 'all-hosts' => 'true', or "name" => "hostname or netgroup".
for my $host (@{$args{read_only}}) {
my $read_only_host = NetAppApi::NaElement->new("exports-hostname-info");
if ($host eq 'all-hosts') {
$read_only_host->child_add_string("all-hosts", 'true');
} else {
$read_only_host->child_add_string("name", $host);
}
$read_only_rule->child_add($read_only_host);
}
This works well for setting a new value for root=, rw= and ro=, unless I want to undefine root, rw or ro. For example, I have a requirement to make an export RO for a data migration. That is to change this:
/vol/myvol/myqtree -sec=sys,ro=fpolicy,rw,root=fpolicy,anon=6001
to:
/vol/myvol/myqtree -sec=sys,ro,root=fpolicy,anon=6001
updating RO to 'all-hosts' => 'true' is simple. But what do I use to remove the existing rw? all-hosts is descibed as a boolean, but sending 'all-hosts' => 'false' raises an error.
The current read-write returned by fetching the security rule-info-2 for the export shows this for read-write:
bless( {
'content' => '',
'name' => 'read-write',
'children' => [
bless( {
'content' => '',
'name' => 'exports-hostname-info',
'children' => [
bless( {
'content' => 'true',
'name' => 'all-hosts',
'children' => [],
'attrvals' => [],
'attrkeys' => []
}, 'NetAppApi::NaElement' )
],
But if I send this as an update I get an error:
bless( {
'content' => '',
'name' => 'read-write',
'children' => [
bless( {
'content' => '',
'name' => 'exports-hostname-info',
'children' => [
bless( {
'content' => 'false',
'name' => 'all-hosts',
'children' => [],
'attrvals' => [],
'attrkeys' => []
}, 'NetAppApi::NaElement' )
],
Debug: Response $VAR1 = bless( {
'content' => '',
'name' => 'results',
'children' => [],
'attrvals' => [
'failed',
'13114',
'Error no valid name found with exports-hostname-info. '
],
which in my code would be something like:
} elsif ($host eq 'no-hosts') {
$read_write_host->child_add_string("all-hosts", 'false')
I have confirmed that setting read-write => 'somethingthatdoesnotexit' is a workaround for my RO use case, but it results in an export entry of:
/vol/myvol/myqtree -sec=sys,ro,rw=somethingthatdoesnotexit,root=fpolicy,anon=6001
rather than the format that I would like:
/vol/myvol/myqtree -sec=sys,ro,root=fpolicy,anon=6001
(and introduces an issue if someone ever made ahost of that name!).
any advice on how to remove rw,ro or root with this method?
Thanks,
Chris