<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating LUNs from files in ONTAP Rest API Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441731#M452</link>
    <description>&lt;P&gt;Hi there! in the early days of Clustered ONTAP, one of our PS engineers wrote a script to do this for conversion from 7mode. I've reached out to him to find out if he has any suggestions, and I'll let you know what he says!&lt;/P&gt;</description>
    <pubDate>Fri, 17 Feb 2023 02:26:24 GMT</pubDate>
    <dc:creator>AlexDawson</dc:creator>
    <dc:date>2023-02-17T02:26:24Z</dc:date>
    <item>
      <title>Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441725#M451</link>
      <description>&lt;P&gt;Hello. Our company is preparing to transition from ZAPI to REST. One of the key features of our product involves creating a LUN backed by file that already exists on the NetApp device. This file is typically very large and represents a full disk image that was previously backed up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems the REST API does not support creating LUNs from a file. The documentation mentions something about creating a LUN and then writing data to that LUN, but I believe that would be extremely inefficient for us. I would venture the data transfer would involve sending data from the file to the node reading the file, then writing that data back to the LUN.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Is there any way to efficiently work around this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 09:52:41 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441725#M451</guid>
      <dc:creator>Shadari</dc:creator>
      <dc:date>2025-06-04T09:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441731#M452</link>
      <description>&lt;P&gt;Hi there! in the early days of Clustered ONTAP, one of our PS engineers wrote a script to do this for conversion from 7mode. I've reached out to him to find out if he has any suggestions, and I'll let you know what he says!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 02:26:24 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441731#M452</guid>
      <dc:creator>AlexDawson</dc:creator>
      <dc:date>2023-02-17T02:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441733#M453</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It does look like the REST API lun create doesn't let you specify a file to make it from. In this instance you probably want to use the CLI passthrough, as detailed at&amp;nbsp;&lt;A href="https://library.netapp.com/ecmdocs/ECMLP2884821/html/#/SAN/lun_create:~:text=Using%20the%20private%20CLI%20passthrough%20with%20the%20ONTAP%20REST%20API" target="_blank"&gt;https://library.netapp.com/ecmdocs/ECMLP2884821/html/#/SAN/lun_create:~:text=Using%20the%20private%20CLI%20passthrough%20with%20the%20ONTAP%20REST%20API&lt;/A&gt;&amp;nbsp;- as mentioned, this gets specially logged in Autosupport, and then we data mine to determine if new functionality should be added to the REST API in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 02:51:29 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441733#M453</guid>
      <dc:creator>AlexDawson</dc:creator>
      <dc:date>2023-02-17T02:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441735#M454</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As Alex mentioned, you can always resort to using ONTAP's private CLI via the REST API. Here is an "example" (you'd just have to modify the variables and command line to meet your requirements). This example is for creating a SnapMirror Relationship via the private CLI, you could easily modify this to create a LUN. Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Param(
   [Parameter(Mandatory = $True, HelpMessage = "The destination cluster name or IP Address")]
   [String]$Cluster,
   [Parameter(Mandatory = $True, HelpMessage = "The Source Vserver name")]
   [String]$SourceVserver,
   [Parameter(Mandatory = $True, HelpMessage = "The Source Volume name")]
   [String]$SourceVolume,
   [Parameter(Mandatory = $True, HelpMessage = "The destination Vserver name")]
   [String]$TargetVserver,
   [Parameter(Mandatory = $True, HelpMessage = "The destination Volume name")]
   [String]$TargetVolume,
   [Parameter(Mandatory = $True, HelpMessage = "The Schedule name")]
   [String]$ScheduleName,
   [Parameter(Mandatory = $True, HelpMessage = "The Policy name")]
   [String]$PolicyName,
   [Parameter(Mandatory = $True, HelpMessage = "The Credentials to authenticate to the destination cluster")]
   [System.Management.Automation.PSCredential]$Credential
)
#'------------------------------------------------------------------------------
#'Set the certificate policy and TLS version.
#'------------------------------------------------------------------------------
Add-Type @"
   using System.Net;
   using System.Security.Cryptography.X509Certificates;
   public class TrustAllCertsPolicy : ICertificatePolicy {
   public bool CheckValidationResult(
   ServicePoint srvPoint, X509Certificate certificate,
   WebRequest request, int certificateProblem) {
      return true;
   }
}
"@
[System.Net.ServicePointManager]::SecurityProtocol  = [System.Net.SecurityProtocolType]'Tls12'
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
#'------------------------------------------------------------------------------
Function Get-NcAuthorization{
   [Alias("Get-NcAuth")]
   [CmdletBinding()]
   Param(
      [Parameter(Mandatory = $True, HelpMessage = "The Credential to authenticate to the cluster")]
      [ValidateNotNullOrEmpty()]
      [System.Management.Automation.PSCredential]$Credential
   )
   #'---------------------------------------------------------------------------
   #'Set the authentication header to connect to the cluster.
   #'---------------------------------------------------------------------------
   $auth    = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Credential.UserName + ':' + $Credential.GetNetworkCredential().Password))
   $headers = @{
      "Authorization" = "Basic $auth"
      "Accept"        = "application/json"
      "Content-Type"  = "application/json"
   }
   Return $headers;
}#'End Function Get-NcAuthorization.
#'------------------------------------------------------------------------------
[String]$command = "snapmirror create -source-path '$SourceVserver`:$SourceVolume' -destination-path '$TargetVserver`:$TargetVolume' -schedule $ScheduleName -policy $PolicyName"
$headers = Get-NcAuth -Credential $Credential
$cli = @{};
$cli.Add("source-path", "$SourceVserver`:$SourceVolume")
$cli.Add("destination-path", "$TargetVserver`:$TargetVolume")
$cli.Add("schedule", $ScheduleName)
$cli.Add("policy", $PolicyName)
$body = $cli | ConvertTo-Json
#'------------------------------------------------------------------------------
#'Create the SnapMirror relationship and set the schedule.
#'------------------------------------------------------------------------------
[String]$uri = "https://$Cluster/api/private/cli/snapmirror"
Write-Host "Executing Command`: $command"
Try{
   $response = Invoke-RestMethod -Method Post -Body $body -Uri $uri -Headers $headers -ErrorAction Stop
}Catch{
   Write-Warning -Message $("Failed Creating SnapMirror relationship between ""$SourceVserver`:$SourceVolume"" and ""$TargetVserver`:$TargetVolume"" on cluster ""$Cluster"". Error " + $_.Exception.Message)
   Break;
}
If($Null -ne $response){
   If($response -Match "Operation succeeded"){
      Write-Host "Created SnapMirror relationship between ""$SourceVserver`:$SourceVolume"" and ""$TargetVserver`:$TargetVolume"" on cluster ""$Cluster"" on cluster ""$Cluster"""
   }Else{
      Write-Warning -Message "Failed Creating SnapMirror relationship between ""$SourceVserver`:$SourceVolume"" and ""$TargetVserver`:$TargetVolume"" on cluster ""$Cluster"""
      Break;
   }
}Else{
   Write-Warning -Message "Failed Creating SnapMirror relationship between ""$SourceVserver`:$SourceVolume"" and ""$TargetVserver`:$TargetVolume"" on cluster ""$Cluster"""
   Break;
}
#'------------------------------------------------------------------------------&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 04:42:53 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441735#M454</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2023-02-17T04:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441744#M455</link>
      <description>&lt;P&gt;Alex, mbeattie:&lt;BR /&gt;&lt;BR /&gt;Thanks so much for the quick response. I will definitely try the approach of using the&amp;nbsp;&lt;SPAN&gt;CLI via the REST API. It may take me a bit of time as I'm juggling a few issues at once and I'm also rather new to NetApp REST. But once I get some results, I'll let you folks know how it went. Thanks again!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 14:07:23 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441744#M455</guid>
      <dc:creator>Shadari</dc:creator>
      <dc:date>2023-02-17T14:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441745#M456</link>
      <description>&lt;P&gt;I do have a follow up question: Does anyone know if support for creating LUNs backed by files will be added to the REST API any time in the future. Greatly appreciate any information regarding this. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 15:24:48 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441745#M456</guid>
      <dc:creator>Shadari</dc:creator>
      <dc:date>2023-02-17T15:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441757#M457</link>
      <description>&lt;P&gt;I genuinely think the only reason it will be added in the future is if people use the CLI pass through and we see it on autosupport. It’s a very uncommon requirement. So I don’t think waiting will work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; shouldn’t take too long to add it in to your software &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Feb 2023 19:36:12 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441757#M457</guid>
      <dc:creator>AlexDawson</dc:creator>
      <dc:date>2023-02-17T19:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441788#M459</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's the exact command line process you are using? I'll check if there is any currently supported ZAPI for it. If so then it's likely to be included in ONTAP 9.13 as this release will be REST API only. If not then CLI pass through via the REST API is your best option&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 01:05:47 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441788#M459</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2023-02-20T01:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441796#M460</link>
      <description>&lt;P&gt;Hey Matt!&lt;BR /&gt;The API we use is 1)&amp;nbsp;lun-create-from-file and 2)&amp;nbsp;lun-create-from-snapshot. We use these "commands" in both C++ and Java. Please let me know what you find in the 9.13 API. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 15:05:13 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441796#M460</guid>
      <dc:creator>Shadari</dc:creator>
      <dc:date>2023-02-20T15:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441809#M461</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a look in the latest NMSDK. I can see there is a ZAPI for "lun-create-from-file"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;netapp  xmlns="http://www.netapp.com/filer/admin" version="1.160"&amp;gt;
  &amp;lt;lun-create-from-file&amp;gt;
    &amp;lt;class&amp;gt;&amp;lt;/class&amp;gt;
    &amp;lt;comment&amp;gt;&amp;lt;/comment&amp;gt;
    &amp;lt;file-name&amp;gt;&amp;lt;/file-name&amp;gt;
    &amp;lt;ostype&amp;gt;&amp;lt;/ostype&amp;gt;
    &amp;lt;path&amp;gt;&amp;lt;/path&amp;gt;
    &amp;lt;qos-adaptive-policy-group&amp;gt;&amp;lt;/qos-adaptive-policy-group&amp;gt;
    &amp;lt;qos-policy-group&amp;gt;&amp;lt;/qos-policy-group&amp;gt;
    &amp;lt;space-allocation-enabled&amp;gt;&amp;lt;/space-allocation-enabled&amp;gt;
    &amp;lt;space-reservation-enabled&amp;gt;&amp;lt;/space-reservation-enabled&amp;gt;
  &amp;lt;/lun-create-from-file&amp;gt;
&amp;lt;/netapp&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but couldn't find "lun-create-from-snapshot". Which ONTAP version are you using? Given it's not listed i would think your best option is to use the CLI pass through in the REST API once ONTAP 9.13 is released and you've upgraded to that version. Note that 9.13 will NOT support ZAPI's (it's REST API only) so you will need to ensure all your automation processes are converted to REST &lt;EM&gt;&lt;STRONG&gt;&lt;U&gt;before&lt;/U&gt; &lt;/STRONG&gt;&lt;/EM&gt;you upgrade.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 00:29:50 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441809#M461</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2023-02-21T00:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441810#M462</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found the "lun-create-from-snapshot" in a really old version: &lt;STRONG&gt;ontapi 1.14&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;netapp  xmlns="http://www.netapp.com/filer/admin" version="1.14"&amp;gt;
  &amp;lt;lun-create-from-snapshot&amp;gt;
    &amp;lt;path&amp;gt;&amp;lt;/path&amp;gt;
    &amp;lt;snapshot-lun-path&amp;gt;&amp;lt;/snapshot-lun-path&amp;gt;
    &amp;lt;space-reservation-enabled&amp;gt;&amp;lt;/space-reservation-enabled&amp;gt;
    &amp;lt;type&amp;gt;&amp;lt;/type&amp;gt;
  &amp;lt;/lun-create-from-snapshot&amp;gt;
&amp;lt;/netapp&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that's a 7-Mode API. What ONTAP version are you running on that system?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 01:18:33 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441810#M462</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2023-02-21T01:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating LUNs from files</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441830#M463</link>
      <description>&lt;P&gt;Hi Matt, I would have to dig through the code to find which versions of ZAPI we support. Suffice it to say, we do support some older versions across 7-mode and CDOT. The important thing is that going forward we can create LUNs from (live) files as well as files contained in snapshots. It seems the CLI REST interface should allow us to do that. I'll have to try to get that to work. Thanks. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 15:55:17 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Creating-LUNs-from-files/m-p/441830#M463</guid>
      <dc:creator>Shadari</dc:creator>
      <dc:date>2023-02-21T15:55:17Z</dc:date>
    </item>
  </channel>
</rss>

