PowerShell script exchange
Post Reply
marc.rousseau
Enthusiast
Posts: 26
Liked: 11 times
Joined: May 01, 2014 9:48 am
Full Name: marc.rousseau
Contact:

Backup job "Netapp Snapshot" create issue

Post by marc.rousseau »

Hello,

I try to automate backup job creation for "NetApp SnapShot" only (no repository local veeam)

Here is the code

Code: Select all

$datastores="NFS018_XXX"

foreach ($datastore in $datastores) {
write-host ======================================  $datastore ================================== -foreground white -background red


$job_name=$datastore+"_snapnetapp_nosnapvm"

$crm = Find-VBRViEntity -DatastoresAndVMs -Name $datastore | Where-Object {$_.Path -like 'vcentername*'}
$repository = Get-VBRBackupRepository -Name "NetApp SnapShot"
Add-VBRViBackupJob -Name $job_name -Entity $crm -BackupRepository $repository -Description "$datastore snap netapp - no snap VM (pour les maintenances monthly)"
$Job = Get-VBRJob -Name $job_name


$JobOptions = Get-VBRJobOptions $Job
$JobOptions.SanIntegrationOptions.SanSnapshotSourceEnabled = $true
##on en garde que 3 car ces backups sont utilsés pour les maintenances mensuelles
$JobOptions.SanIntegrationOptions.SanSnapshotSourceRetention = 3
$Job | Set-VBRJobOptions -Options $JobOptions

Set-VBRJobVssOptions -Job $job_name -Credentials (Get-VBRCredentials -Name "DOMAIN\user")

}
The job is created but when I try to start it manually, Veeam job failed with this error:

Code: Select all

4/13/2017 10:22:50 AM :: Error: Failed to call RPC function 'FcCreateDir': Invalid folder path: [NetApp Storage]. Cannot create folder. Folder path: [NetApp Storage]. Cannot create folder. Folder path: [NetApp Storage\XXXXXX_snapnetapp_nosnapvm].  
After investigating, I found the difference between a job created manually and the job created using powershell above. When you look at job properties with powershell, there's a difference in "TargetType" property :

- Job created manually, TargetType is "SanSnapshot"
- Job created with powershell, TargetType is "Other"

Code: Select all

(...)
JobType                      : Backup
SourceType                   : VDDK
JobTargetType                : Backup
TargetType                   : Other                       <<---------- this property
TypeToString                 : VMware Backup
Description                  : xxxxx
Name                         : xxxxxx
BackupPlatform               : EVmware
TargetHostId                 : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
TargetDir                    : NetApp Storage
TargetFile                   : xxxxxxx
Options                      : Veeam.Backup.Model.CJobOptions
(...)
Problem is : there's no way to modify this property after the job is created (ReadOnly Property), neither to pass an argument at the job creation with "Add-VBRViBackupJob" command :(

Code: Select all

Add-PSSnapin VeeamPSSnapIn
$Job = Get-VBRJob -Name JOB_NAME
$job.TargetType = "SanSnapshot"

'TargetType' is a ReadOnly property.
At C:\Users\sa_rousse0m\Desktop\Untitled1.ps1:4 char:1
(....)
Someone has an idea how to change this property or how to create a netapp snapshot job properly ?

Thank you
Marc
marc.rousseau
Enthusiast
Posts: 26
Liked: 11 times
Joined: May 01, 2014 9:48 am
Full Name: marc.rousseau
Contact:

Re: Backup job "Netapp Snapshot" create issue

Post by marc.rousseau »

I try a lot of things, copy joboptions from a GUI created job to a powershell job, it doesn't works
My conclusion, when a create a job with powershell with a "Netapp snapshot" repository, job is not created properly

Case 02128980
marc.rousseau
Enthusiast
Posts: 26
Liked: 11 times
Joined: May 01, 2014 9:48 am
Full Name: marc.rousseau
Contact:

Re: Backup job "Netapp Snapshot" create issue

Post by marc.rousseau »

Ok after investigating, I found the problem and the solution.
When created manually the target_type is 3 (SanSnapshot) in veeam database "dbo.BJobs", when created with powerhshell target_type is 0 (Other)

I simply changed target_type from 0 to 3 and now my job with "netapp primary snapshot repository" works fine

Image
marc.rousseau
Enthusiast
Posts: 26
Liked: 11 times
Joined: May 01, 2014 9:48 am
Full Name: marc.rousseau
Contact:

Re: Backup job "Netapp Snapshot" create issue

Post by marc.rousseau »

Bug confirmed by support. Will be fixed in 9.5U3
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup job "Netapp Snapshot" create issue

Post by veremin »

Thank you for confirming initial thought and updating the topic with the latest information; appreciated.
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests