2017-06-29 01:45 AM
In a special use case, one of our customer needs that snapshots created with snapshot-create API call are usable to create a CIFS share in the snapshot namespace.
However, from time to time (right after snapshot creation), the share creation fails with the error :
The specified path "/vol/xxxxxxx/.snapshot/testsharertv/xxxxxx/yyyy/zzzzzz" does not exist in the namespace belonging to Vserver "xxxxxxx".
The snapshot-create API call has the value 'async' set to false, but the share creation fails when issued right after the snapshot creation, and 1-2 retries later (1-2 secs apart) eventually passes.
I've tried to check the state of the created snapshots using snapshot-list-info/snapshot-get-iter, but there's no information returned by the API that would match the output of the diag snap status command (creating/complete/deleting status).
Is there some way to make sure a newly created snapshot can be used as a path for a CIFS share?
2017-06-29 06:48 AM
Does the share created from the snapshot have to be available immediately, or is 3-5 seconds of delay acceptable? If it is acceptable, then why not just put a brief sleep into the script? Or, use a try/catch statement to test the operation until it succeeds or exceeds some threshold.
2017-06-29 06:55 AM
In fact, this is the solution I've come to, but my customer isn't happy with this as the ckeck/retry code is associated with the creation of the share and not with the snapshot creation itself.
They argue that the snapshot creation could be used for other purposes and would like to ensure created snapshots are indeed usable even if a share is not created for it.
That's the reason why I'm looking for some way to ensure a snapshot is created and complete independantly of share creation.
2017-06-29 09:39 AM
I haven't tried this.. but i believe this shuld work.. aleast in theory.
After creating the snpshot can't you do a "snpshot-get-ltr" and
look for the snapshot *state" (which is inside snapshot-info)
If the state is 'valid' ... The snapshot is complete and consistent.
Then proceed with share creation, otherwise wait..
Here are the three different state you might find.. (according to API Doc)
'valid' ... The snapshot is complete and consistent
'invalid' ... The namespace constituent snapshot is missing
'partial' ... One or more data constituent snapshots are missing
2017-06-29 09:48 AM
I saw these in the documentation :
The default value is valid.
Isn't the state attribute value only relevant for Infinite Volumes? (that was my assumption so far)
2017-06-29 10:08 AM
I don't think the "state" attribute is only for Infinite Volumes. Might worth checking.
I'll be surpriced if its only for Infinite Volumes.
If that didn't work.. it may worth trying to look in to the value of percentage-of-used-blocks or percentage-of-total-blocks (in snapshot-info)
In the assumption.. of Snapshot creation should complete to return these values.