Software Development Kit (SDK) and API Discussions

making sure snapshot-create snapshots are usable

fdenis
5,167 Views

Hello all,

 

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?

 

Kind regards.

6 REPLIES 6

asulliva
5,139 Views

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.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

fdenis
5,132 Views

Hello assuliva,

 

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.

 

Kind regards.

robinpeter
5,112 Views

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

 

Robin.

fdenis
5,109 Views

Hello robinpeter,

 

I saw these in the documentation :

 

      The state of the snapshot. Possible values:
      • 'valid' ... The snapshot is complete and consistent
      • 'invalid' ... The namespace constituent snapshot is missing
      • 'partial' ... One or more data constituent snapshots are missing
      Only a snapshot on an Infinite Volume can have a state of partial or invalid.

The default value is valid.

 

Isn't the state attribute value only relevant for Infinite Volumes? (that was my assumption so far)

 

Kind regards.

 

robinpeter
5,100 Views

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.

 

Robin.

 

fdenis
5,090 Views

Thanks Robin,

 

I'll give these ideas a try, thanks a lot for the help!

 

Kind regards.

Public