PowerShell script exchange
Post Reply
signal
Enthusiast
Posts: 65
Liked: 4 times
Joined: Oct 06, 2016 1:19 pm
Contact:

Create 3PAR snapshot only "backup" job with powershell

Post by signal »

I'm trying to create 3PAR snapshot jobs using powershell, but they are not working as expected.

The jobs are created, but when run there are no storage snapshots created. If I edit a job in the GUI it will start working, even though I have not edited any settings.

The code used to create a job is something like this:

Code: Select all

$SnapRepo = Get-VBRBackupRepository -Name "HPE 3PAR Snapshot"
$vCluster = Find-VBRViEntity -Name "cluster1"
$DatastoreClusters = Find-VBRViDatastoreCluster -Server $vCluster
foreach ($DatastoreCluster in $DatastoreClusters) {
  $SnapJob = Add-VBRViBackupJob -Entity $DatastoreCluster -Name "Snap Job" -BackupRepository $SnapRepo
  $SnapJob | Set-VBRJobSchedule -Daily -At "10:00" -DailyKind Everyday
  $SnapJob | Set-VBRJobAdvancedViOptions -VmAttributeName "Notes" -SetResultsToVmAttribute $true -VMToolsQuiesce $true
  $SnapJob | Set-VBRJobAdvancedNotificationOptions -SnmpNotification $false -EmailNotification $true -EmailNotificationAddress "someone@corp.tld"
  $SnapJobOpts = Get-VBRJobOptions -Job $SnapJob
  $SnapJobOpts.BackupStorageOptions.RetainCycles = 7
  $SnapJobOpts.ViSourceOptions.BackupTemplates = $false
  $SnapJobOpts.ViSourceOptions.BackupTemplatesOnce = $false
  $SnapJob | Set-VBRJobOptions -Options $SnapJobOpts
  $SnapJob | Enable-VBRJobSchedule
}#foreach
This code has not been copied, but rewritten as it is being developed in a closed network. Any typo errors are just mistypes. The jobs are created and look like they are working fine, only no store snapshots are created.

EDIT One more thing to note:
When I compare the options (Get-VBRJobOptions) for a job created using powershell and one where I have edited it in the GUI I see some extra value son the one edited in the GUI:

Code: Select all

SanStorageRepositoryOptions         : SanStorageRepositoryOptions
SourceProxyAutoDetect               : True
TargetProxyAutoDetect               : True
CheckRetention                      : True
SanSnapshotTransferEnabled          : False
SanSnapshotTransferRetention        : 14
SanSnapshotBackupBackupSource       : False
SanSnapshotReplicaTransferEnabled   : False
SanSnapshotReplicaTransferRetention : 14
SanSnapshotReplicaBackupSource      : False
NibleSnapshotTransferEnabled        : False
NibleSnapshotTransferRetention      : 14
NibleSnapshotTransferAsBackupSource : False
HpPersistentPeerEnabled             : False
HpPersistentPeerBackupSource        : False
BackupIsAttached                    : False
Is the solution to try and add these manually on the options object, or are there commands that may set these to get the job working as intended?
signal
Enthusiast
Posts: 65
Liked: 4 times
Joined: Oct 06, 2016 1:19 pm
Contact:

Re: Create 3PAR snapshot only "backup" job with powershell

Post by signal »

I've not come any closer to a solution on this, and would appreciate any feedback.
signal
Enthusiast
Posts: 65
Liked: 4 times
Joined: Oct 06, 2016 1:19 pm
Contact:

Re: Create 3PAR snapshot only "backup" job with powershell

Post by signal »

Any feedback on this?
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Create 3PAR snapshot only "backup" job with powershell

Post by veremin »

I don't have 3PAR lab at hand to test your script, but since you already have at least on working job, wouldn't it be easier to clone this via PS and change only those settings that you want, instead of creating a job from the scratch? Thanks.
signal
Enthusiast
Posts: 65
Liked: 4 times
Joined: Oct 06, 2016 1:19 pm
Contact:

Re: Create 3PAR snapshot only "backup" job with powershell

Post by signal »

v.Eremin wrote:I don't have 3PAR lab at hand to test your script, but since you already have at least on working job, wouldn't it be easier to clone this via PS and change only those settings that you want, instead of creating a job from the scratch? Thanks.
I'm creating a deployment script to set up an entire environment. Is there a way to extract a job made in a development environment and create a similar job later?
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Create 3PAR snapshot only "backup" job with powershell

Post by veremin »

Establish connection to development environment, get the settings of required job, assign them to a variable, pass the variable to local environment and apply the settings stored in the variable to newly-created job. Thanks.
signal
Enthusiast
Posts: 65
Liked: 4 times
Joined: Oct 06, 2016 1:19 pm
Contact:

Re: Create 3PAR snapshot only "backup" job with powershell

Post by signal »

v.Eremin wrote:Establish connection to development environment, get the settings of required job, assign them to a variable, pass the variable to local environment and apply the settings stored in the variable to newly-created job. Thanks.
This is a project to deliver an automatic setup of the backup environment. I only have development and test environments, not the production. It may be reused several times, so I have scripts to configure as much as possible.

In the job options I see the .Options.RootNode.SanStorageRepositoryOptions.SanStorageRepositoryItem has RepoId, InnerXml, InnerText and OuterXml containing an identifying string (8-4-4-4-12 chars each 1-9 + a-f). I'm thinking this identifies which 3PAR system is holding the datastore(s).
Can you check with the developers how this is done in the GUI? If not, is there sone kind of proxy/capture solution I can run between the GUI and the service, like the VMware Project Onyx?
signal
Enthusiast
Posts: 65
Liked: 4 times
Joined: Oct 06, 2016 1:19 pm
Contact:

Re: Create 3PAR snapshot only "backup" job with powershell

Post by signal »

Any progress on this?
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests