Skip to content

Commit 6421893

Browse files
committed
E2E VM testing.
1 parent ca8768c commit 6421893

File tree

8 files changed

+95
-86
lines changed

8 files changed

+95
-86
lines changed

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/PSRecoveryServicesClient/PSRecoveryServicesPEClient.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,13 @@ public JobResponse StartAzureSiteRecoveryCommitFailover(
172172
/// </summary>
173173
/// <param name="protectionContainerId">Protection Container ID</param>
174174
/// <param name="protectionEntityId">Recovery Plan ID</param>
175+
/// <param name="request">Re-protect request.</param>
175176
/// <returns>Job response</returns>
176177
public JobResponse StartAzureSiteRecoveryReprotection(
177178
string protectionContainerId,
178-
string protectionEntityId)
179+
string protectionEntityId,
180+
ReprotectRequest request)
179181
{
180-
var request = new ReprotectRequest();
181182
return this.GetSiteRecoveryClient().ProtectionEntity.Reprotect(
182183
protectionContainerId,
183184
protectionEntityId,

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/SetAzureSiteRecoveryProtectionEntity.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ public override void ExecuteCmdlet()
208208

209209
input.ReplicationProviderInput = DataContractUtils.Serialize<AzureEnableProtectionInput>(azureInput);
210210
}
211+
else
212+
{
213+
input.ReplicationProviderInput = string.Empty;
214+
input.ProtectionProfileId = this.ProtectionProfile.ID;
215+
}
211216

212217
this.jobResponse =
213218
RecoveryServicesClient.EnableProtection(

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/StartAzureSiteRecoveryPlannedFailoverJob.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ private void StartPEPlannedFailover()
151151

152152
if (this.ProtectionEntity.ReplicationProvider == Constants.HyperVReplicaAzure)
153153
{
154-
request.ReplicationProvider = this.ProtectionEntity.ReplicationProvider;
155154
if (this.Direction == Constants.PrimaryToRecovery)
156155
{
157156
var blob = new AzureFailoverInput();
@@ -166,8 +165,14 @@ private void StartPEPlannedFailover()
166165
request.ReplicationProviderSettings = DataContractUtils.Serialize<AzureFailbackInput>(blob);
167166
}
168167
}
168+
else
169+
{
170+
request.ReplicationProviderSettings = string.Empty;
171+
}
169172

173+
request.ReplicationProvider = this.ProtectionEntity.ReplicationProvider;
170174
request.FailoverDirection = this.Direction;
175+
171176
this.jobResponse =
172177
RecoveryServicesClient.StartAzureSiteRecoveryPlannedFailover(
173178
this.ProtectionContainerId,
@@ -199,7 +204,6 @@ private void StartRpPlannedFailover()
199204

200205
if (this.RecoveryPlan.ReplicationProvider == Constants.HyperVReplicaAzure)
201206
{
202-
request.ReplicationProvider = this.RecoveryPlan.ReplicationProvider;
203207
if (this.Direction == Constants.PrimaryToRecovery)
204208
{
205209
var blob = new AzureFailoverInput();
@@ -215,6 +219,7 @@ private void StartRpPlannedFailover()
215219
}
216220
}
217221

222+
request.ReplicationProvider = this.RecoveryPlan.ReplicationProvider;
218223
request.FailoverDirection = this.Direction;
219224

220225
this.jobResponse = RecoveryServicesClient.StartAzureSiteRecoveryPlannedFailover(

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/StartAzureSiteRecoveryTestFailoverJob.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ private void StartRpTestFailover()
203203

204204
if (this.RecoveryPlan.ReplicationProvider == Constants.HyperVReplicaAzure)
205205
{
206-
request.ReplicationProvider = this.RecoveryPlan.ReplicationProvider;
207206
if (this.Direction == Constants.PrimaryToRecovery)
208207
{
209208
var blob = new AzureFailoverInput();
@@ -212,6 +211,7 @@ private void StartRpTestFailover()
212211
}
213212
}
214213

214+
request.ReplicationProvider = this.RecoveryPlan.ReplicationProvider;
215215
request.FailoverDirection = this.Direction;
216216

217217
if (this.Network != null)
@@ -257,7 +257,6 @@ private void StartPETestFailover()
257257

258258
if (this.ProtectionEntity.ReplicationProvider == Constants.HyperVReplicaAzure)
259259
{
260-
request.ReplicationProvider = this.ProtectionEntity.ReplicationProvider;
261260
if (this.Direction == Constants.PrimaryToRecovery)
262261
{
263262
var blob = new AzureFailoverInput();
@@ -266,6 +265,7 @@ private void StartPETestFailover()
266265
}
267266
}
268267

268+
request.ReplicationProvider = this.ProtectionEntity.ReplicationProvider;
269269
request.FailoverDirection = this.Direction;
270270

271271
if (this.Network != null)

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/StartAzureSiteRecoveryUnPlannedFailoverJob.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ private void StartPEUnplannedFailover()
152152
this.ValidateUsageById(this.ProtectionEntity.ReplicationProvider);
153153
}
154154

155+
request.ReplicationProviderSettings = string.Empty;
156+
155157
if (this.ProtectionEntity.ReplicationProvider == Constants.HyperVReplicaAzure)
156158
{
157159
request.ReplicationProvider = this.ProtectionEntity.ReplicationProvider;
@@ -163,6 +165,7 @@ private void StartPEUnplannedFailover()
163165
}
164166
}
165167

168+
request.ReplicationProvider = this.ProtectionEntity.ReplicationProvider;
166169
request.FailoverDirection = this.Direction;
167170
request.SourceSiteOperations = this.PerformSourceSiteOperations;
168171
this.jobResponse =
@@ -194,6 +197,8 @@ private void StartRpUnPlannedFailover()
194197
this.ValidateUsageById(this.RecoveryPlan.ReplicationProvider);
195198
}
196199

200+
request.ReplicationProviderSettings = string.Empty;
201+
197202
if (this.RecoveryPlan.ReplicationProvider == Constants.HyperVReplicaAzure)
198203
{
199204
request.ReplicationProvider = this.RecoveryPlan.ReplicationProvider;
@@ -205,6 +210,7 @@ private void StartRpUnPlannedFailover()
205210
}
206211
}
207212

213+
request.ReplicationProvider = this.RecoveryPlan.ReplicationProvider;
208214
request.FailoverDirection = this.Direction;
209215
request.PrimaryAction = this.PrimaryAction;
210216

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/Service/UpdateAzureSiteRecoveryProtectionDirection.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,15 @@ private void SetRpReprotect()
137137
/// </summary>
138138
private void SetPEReprotect()
139139
{
140-
// Until RR is done active location remains same from where FO was initiated.
141140
if ((this.Direction == Constants.PrimaryToRecovery &&
142-
this.ProtectionEntity.ActiveLocation != Constants.RecoveryLocation) ||
141+
this.ProtectionEntity.ActiveLocation == Constants.RecoveryLocation) ||
143142
(this.Direction == Constants.RecoveryToPrimary &&
144-
this.ProtectionEntity.ActiveLocation != Constants.PrimaryLocation))
143+
this.ProtectionEntity.ActiveLocation == Constants.PrimaryLocation))
145144
{
146145
throw new ArgumentException("Parameter value is not correct.", "Direction");
147146
}
148147

149-
var request = new PlannedFailoverRequest();
148+
var request = new ReprotectRequest();
150149

151150
if (this.ProtectionEntity == null)
152151
{
@@ -158,9 +157,10 @@ private void SetPEReprotect()
158157
this.ValidateUsageById(this.ProtectionEntity.ReplicationProvider);
159158
}
160159

160+
request.ReplicationProviderSettings = string.Empty;
161+
161162
if (this.ProtectionEntity.ReplicationProvider == Constants.HyperVReplicaAzure)
162163
{
163-
request.ReplicationProvider = this.ProtectionEntity.ReplicationProvider;
164164
if (this.Direction == Constants.PrimaryToRecovery)
165165
{
166166
var blob = new AzureReProtectionInput();
@@ -174,11 +174,13 @@ private void SetPEReprotect()
174174
}
175175
}
176176

177+
request.ReplicationProvider = this.ProtectionEntity.ReplicationProvider;
177178
request.FailoverDirection = this.Direction;
178179

179180
this.jobResponse = RecoveryServicesClient.StartAzureSiteRecoveryReprotection(
180181
this.ProtectionContainerId,
181-
this.ProtectionEntityId);
182+
this.ProtectionEntityId,
183+
request);
182184

183185
this.WriteJob(this.jobResponse.Job);
184186

src/ServiceManagement/RecoveryServices/Commands.RecoveryServices/lib/PSContracts.cs

Lines changed: 48 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -608,136 +608,124 @@ public class HyperVReplicaAzureProtectionProfileInput
608608
}
609609

610610
/// <summary>
611-
/// Hyper-V Replica specific protection profile details.
611+
/// Hyper-V Replica Azure specific protection profile details.
612612
/// </summary>
613613
[DataContract(Namespace = "http://schemas.microsoft.com/windowsazure")]
614-
public class HyperVReplicaProtectionProfileDetails
614+
public class HyperVReplicaAzureProtectionProfileDetails
615615
{
616616
/// <summary>
617-
/// Gets or sets a value indicating the number of recovery points.
618-
/// </summary>
619-
[DataMember]
620-
public int NosOfRps { get; set; }
621-
622-
/// <summary>
623-
/// Gets or sets a value indicating the application consistent frequency.
624-
/// </summary>
625-
[DataMember]
626-
public int AppConsistencyFreq { get; set; }
627-
628-
/// <summary>
629-
/// Gets or sets a value indicating whether compression has to be enabled.
617+
/// Gets or sets the duration (in hours) to which point the recovery history needs to be
618+
/// maintained.
630619
/// </summary>
631620
[DataMember]
632-
public bool IsCompressionEnabled { get; set; }
621+
public int RecoveryPointHistoryDuration { get; set; }
633622

634623
/// <summary>
635-
/// Gets or sets a value indicating whether IR is online.
624+
/// Gets or sets the interval (in hours) at which Hyper-V Replica should create an
625+
/// application consistent snapshot within the VM.
636626
/// </summary>
637627
[DataMember]
638-
public bool IsOnlineIr { get; set; }
628+
public int ApplicationConsistentSnapshotFrequencyInHours { get; set; }
639629

640630
/// <summary>
641-
/// Gets or sets a value indicating the online IR start time.
631+
/// Gets or sets the replication interval.
642632
/// </summary>
643633
[DataMember]
644-
public TimeSpan? OnlineIrStartTime { get; set; }
634+
public int ReplicationInterval { get; set; }
645635

646636
/// <summary>
647-
/// Gets or sets a value indicating the offline IR import path.
637+
/// Gets or sets the scheduled start time for the initial replication. If this parameter
638+
/// is Null, the initial replication starts immediately.
648639
/// </summary>
649640
[DataMember]
650-
public string OfflineIrImportPath { get; set; }
641+
public TimeSpan? OnlineReplicationStartTime { get; set; }
651642

652643
/// <summary>
653-
/// Gets or sets a value indicating the offline IR export path.
644+
/// Gets or sets a value indicating whether encryption is enabled for virtual machines
645+
/// in this cloud.
654646
/// </summary>
655647
[DataMember]
656-
public string OfflineIrExportPath { get; set; }
648+
public bool EncryptionEnabled { get; set; }
657649

658650
/// <summary>
659-
/// Gets or sets a value indicating the primary HTTP port.
651+
/// Gets or sets the active storage accounts details.
660652
/// </summary>
661653
[DataMember]
662-
public ushort PrimaryHttpPort { get; set; }
654+
public CustomerStorageAccount ActiveStorageAccount { get; set; }
655+
}
663656

657+
/// <summary>
658+
/// Hyper-V Replica specific protection profile details.
659+
/// </summary>
660+
[DataContract(Namespace = "http://schemas.microsoft.com/windowsazure")]
661+
public class HyperVReplicaProtectionProfileDetails
662+
{
664663
/// <summary>
665-
/// Gets or sets a value indicating the primary HTTPS port.
664+
/// Gets or sets a value indicating the number of recovery points.
666665
/// </summary>
667666
[DataMember]
668-
public ushort PrimaryHttpsPort { get; set; }
667+
public int RecoveryPoints { get; set; }
669668

670669
/// <summary>
671-
/// Gets or sets a value indicating the recovery HTTP port.
670+
/// Gets or sets a value indicating the application consistent frequency.
672671
/// </summary>
673672
[DataMember]
674-
public ushort RecoveryHttpPort { get; set; }
673+
public int ApplicationConsistentSnapshotFrequencyInHours { get; set; }
675674

676675
/// <summary>
677-
/// Gets or sets a value indicating the recovery HTTPS port.
676+
/// Gets or sets a value indicating whether compression has to be enabled.
678677
/// </summary>
679678
[DataMember]
680-
public ushort RecoveryHttpsPort { get; set; }
679+
public bool CompressionEnabled { get; set; }
681680

682681
/// <summary>
683-
/// Gets or sets a value indicating the authentication type.
682+
/// Gets or sets a value indicating whether IR is online.
684683
/// </summary>
685684
[DataMember]
686-
public ushort AllowedAuthenticationType { get; set; }
685+
public bool OnlineReplicationMethod { get; set; }
687686

688687
/// <summary>
689-
/// Gets or sets a value indicating whether the VM has to be auto deleted.
690-
/// Supported Values: String.Empty, None, OnRecoveryCloud
688+
/// Gets or sets a value indicating the online IR start time.
691689
/// </summary>
692690
[DataMember]
693-
public string VmAutoDeleteOption { get; set; }
694-
}
691+
public TimeSpan? OnlineReplicationStartTime { get; set; }
695692

696-
/// <summary>
697-
/// Hyper-V Replica Azure specific protection profile details.
698-
/// </summary>
699-
[DataContract(Namespace = "http://schemas.microsoft.com/windowsazure")]
700-
public class HyperVReplicaAzureProtectionProfileDetails
701-
{
702693
/// <summary>
703-
/// Gets or sets the duration (in hours) to which point the recovery history needs to be
704-
/// maintained.
694+
/// Gets or sets a value indicating the offline IR import path.
705695
/// </summary>
706696
[DataMember]
707-
public int RecoveryPointHistoryDuration { get; set; }
697+
public string OfflineReplicationImportPath { get; set; }
708698

709699
/// <summary>
710-
/// Gets or sets the interval (in hours) at which Hyper-V Replica should create an
711-
/// application consistent snapshot within the VM.
700+
/// Gets or sets a value indicating the offline IR export path.
712701
/// </summary>
713702
[DataMember]
714-
public int AppConsistencyFreq { get; set; }
703+
public string OfflineReplicationExportPath { get; set; }
715704

716705
/// <summary>
717-
/// Gets or sets the replication interval.
706+
/// Gets or sets a value indicating the recovery HTTPS port.
718707
/// </summary>
719708
[DataMember]
720-
public int ReplicationInterval { get; set; }
709+
public ushort ReplicationPort { get; set; }
721710

722711
/// <summary>
723-
/// Gets or sets the scheduled start time for the initial replication. If this parameter
724-
/// is Null, the initial replication starts immediately.
712+
/// Gets or sets a value indicating the authentication type.
725713
/// </summary>
726714
[DataMember]
727-
public TimeSpan? OnlineIrStartTime { get; set; }
715+
public ushort AllowedAuthenticationType { get; set; }
728716

729717
/// <summary>
730-
/// Gets or sets a value indicating whether encryption is enabled for virtual machines
731-
/// in this cloud.
718+
/// Gets or sets a value indicating whether the VM has to be auto deleted.
719+
/// Supported Values: String.Empty, None, OnRecoveryCloud
732720
/// </summary>
733721
[DataMember]
734-
public bool IsEncryptionEnabled { get; set; }
722+
public string ReplicaDeletionOption { get; set; }
735723

736724
/// <summary>
737-
/// Gets or sets the active storage accounts details.
725+
/// Gets or sets a value indicating the replication interval.
738726
/// </summary>
739727
[DataMember]
740-
public CustomerStorageAccount ActiveStorageAccount { get; set; }
728+
public ushort ReplicationFrequencyInSeconds { get; set; }
741729
}
742730

743731
/// <summary>

0 commit comments

Comments
 (0)