Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Is this (powershell) possible in c# with the ManageOntap API?
2015-02-12
06:06 AM
2,950 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
foreach ($controller in $controllers){ $FAS=connect-nacontroller $controller -credential $cred -HTTPS $vols = get-navol | where {($_.Name -like "*_VOL_D01") -and ($_.Dedupe -eq "True")} foreach ($vol in $vols){ $options=get-navoloption -Name $vol.Name |where {$_.Name -eq "nosnapdir"} "$($vol) $($options.Value)" } }
I have the above working in Powershell to check if the snapshot directory is hidden or visable, is this possible do do with the api sdk? ie looking for equivilents for get-navoloption in c#?
Thanks
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
think i have found the longest way possible to do it?
try { s = new NaServer(Server, 1, 3); s.Style = NaServer.AUTH_STYLE.LOGIN_PASSWORD; s.SetAdminUser(user, pwd); xi = new NaElement("volume-list-info"); xo = s.InvokeElem(xi); ArrayList vols = new ArrayList(); System.Collections.IList volList = xo.GetChildByName("volumes").GetChildren(); System.Collections.IEnumerator volIter = volList.GetEnumerator(); while (volIter.MoveNext()) { NaElement volInfo = (NaElement)volIter.Current; vols.Add(volInfo.GetChildContent("name")); } foreach (string i in vols) { xi = new NaElement("volume-options-list-info"); xi.AddNewChild("volume", i); xo = s.InvokeElem(xi); System.Collections.IList optionList = xo.GetChildByName("options").GetChildren(); System.Collections.IEnumerator optionIter = optionList.GetEnumerator(); while (optionIter.MoveNext()) { NaElement volInfo = (NaElement)optionIter.Current; if (volInfo.GetChildContent("name") == "nosnapdir") { Console.WriteLine("---------------------------------"); Console.Write("Volume\t\t: "); Console.WriteLine(i); Console.Write("Name\t\t: "); Console.WriteLine(volInfo.GetChildContent("name")); Console.Write("Value\t\t: "); Console.WriteLine(volInfo.GetChildContent("value")); Console.WriteLine("---------------------------------"); } } } } catch (Exception e) { Console.Error.WriteLine(e.Message); }
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How would you set the volume option ( nosnapdir ) via the SDK?
