Community

Subscribe
Highlighted

Find flexclone snapshot parent

Hi all

We have just starting using the PS toolkit and loving it, but we are struggling to query a value.

When we create a flexclone we are able to present it and use it no problem. We then remove it when we are done with it no problem. However we can't seem to find how to remove the auto-created snapshot that was created when we created flexclone. We'd like to clean up after ourselves so we thought we could have queried for the parent snapshot of the flexclone, but not sure how to query that value - it's there in filerview, but just looking for syntax....

Any help appreciated!

cheers,

Alistair

Re: Find flexclone snapshot parent

Hello Alistair,

You can query the name of the FlexClone backing snapshot using Get-NaVol.  For example, if the name of your clone is testvol_clone, you can issue the following commands:

PS C:\> $clone = Get-NaVol testvol_clone

PS C:\> $snapshot = $clone.CloneParent.Get(0).ParentSnapshotName

PS C:\> $snapshot

clone_testvol_clone.1

We can now see that the backing snapshot for testvol_clone is "clone_testvol_clone.1" and can proceed to offline the clone volume, destroy the clone volume, then delete the snapshot from the parent volume.

Hope that helps,

Steven

Re: Find flexclone snapshot parent

Is there documentation on the .NET objects used e.g. what .NET object is returned by Get-NaVol

Re: Find flexclone snapshot parent

Just use Get-Member.  The types the Toolkit returns should be stable over time.

PS C:\Software\Toolkit> Get-NaVol | Get-Member

   TypeName: DataONTAP.Types.Volume.VolumeInfo

Re: Find flexclone snapshot parent

Thanks Clinton, I should have been clearer. Yes, I am using that command currently but was wondering if there was any API ref that contained all the objects/types etc. The current ref just seems to have the cmdlets and the API names. basically, what I'm planning on doing is building a little cmdlet to display the tree of volumes and flexclones hanging off those volumes (I'm not aware of any tool that does that so it would be quite useful!)

Re: Find flexclone snapshot parent

You shouldn't need to write your own cmdlet.  You can use the API cmdlets to grab this info

Look at get-navol and look at clonechildren property.  Should be all done for you..

Re: Find flexclone snapshot parent

Yes, but for my env. where we have developers with maybe 200+ flexclones, I want to create a cmdlet that does the following against a target aggregate:

  1. Create a html tree view of the aggregate and all volumes
  2. Add to that tree link relationships between parents snapshots and flexclones
  3. List all space metrics for all

Particular to my environment but will save much hassle

Re: Find flexclone snapshot parent

The cmdlet man pages list the output types, but AFAIK there isn't a simple programmatic reference for that info.  That might be a possible addition to Get-NaHelp and Get-NcHelp.  You could always parse the cmdlet MAML files yourself, which is what those two cmdlets do.