#REST API new volume creation questions

1 messages · Page 1 of 1 (latest)

twin stone
#

I am creating a flexvol volume on a filer as such:

                vol.name = self.req['volume_name']
                vol.size = f"{self.req['size_value']}{self.req['size_unit']}"
                vol.comment = self.req['property']
                vol.aggregates = [{'name': self.req['aggr']}]
                vol.svm = {'name': self.req['vserver']}
                vol.type = self.req['volume_type']
                vol.snapshot_policy = self.req['snap_policy']
                vol.encryption = {'enabled': True, 'type': 'volume'}
                vol.state = 'online'
                vol.nas = {'export_policy': {'name': exppol_name},
                           'uid': 0,  # root
                           'gid': 1,
                           'security_style': 'unix',
                           'unix_permissions': 755,
                           'path': f"/{self.req['volume_name']}", }
                vol.guarantee = {'honored': True, 'type': 'volume'}
                vol.space = {'snapshot': {'autodelete_enabled': True,
                             'reserve_percent': snap_reserve, }}
                vol.post(hydrate=True)```
1.  The snapshot policy of the volume is not being correctly set.  I have tried setting the policy to 'none' as well as another policy i created, and the resultant volume is always set to 'default'.  Is it possible to set this field as part of the create a new volume POST?
2.  The autodelete policy is not enabled after POSTing.  Is it possible to set this field as part of the create a new volume POST?
#

I figured out the answer to number 1 - needed vol.snapshot_policy = {'name': self.req['snap_policy']} (oops), but still curious on 2

burnt carbon
#

It is in 9.13.1