diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs
index d31e8dc854a2..e870ec872a31 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceDetails/SetAzureStorSimpleDevice.cs
@@ -71,7 +71,7 @@ public class SetAzureStorSimpleDevice : StorSimpleCmdletBase
///
/// A collection of network configs for interfaces on the device.
///
- [Parameter(Mandatory = false, Position = 4, HelpMessage = StorSimpleCmdletHelpMessage.StorSimpleNetworkConfig)]
+ [Parameter(Mandatory = false, Position = 4, HelpMessage = StorSimpleCmdletHelpMessage.StorSimpleNetworkConfig, ValueFromPipeline=true)]
[ValidateNotNullOrEmpty]
public NetworkConfig[] StorSimpleNetworkConfig { get; set; }
diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/GetAzureStorSimpleJob.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/GetAzureStorSimpleJob.cs
index 22c5eee939c5..319f2c56e14e 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/GetAzureStorSimpleJob.cs
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/GetAzureStorSimpleJob.cs
@@ -38,6 +38,7 @@ public class GetAzureStorSimpleJob : StorSimpleCmdletBase
///
[Parameter(Mandatory = true, Position = 0, ParameterSetName = StorSimpleCmdletParameterSet.IdentifyByDeviceName,
HelpMessage=StorSimpleCmdletHelpMessage.DeviceName)]
+ [ValidateNotNullOrEmpty]
public string DeviceName { get; set; }
@@ -46,7 +47,8 @@ public class GetAzureStorSimpleJob : StorSimpleCmdletBase
///
[Parameter(Mandatory=true, Position = 0, ParameterSetName = StorSimpleCmdletParameterSet.IdentifyById,
HelpMessage = StorSimpleCmdletHelpMessage.DeviceJobId)]
- public string JobId { get; set; }
+ [ValidateNotNullOrEmpty]
+ public string InstanceId { get; set; }
///
/// Filter jobs by their status.
@@ -107,13 +109,13 @@ public override void ExecuteCmdlet()
}
// Make call to get device jobs.
- var response = StorSimpleClient.GetDeviceJobs(deviceId, Type, Status, JobId, fromDateTimeIsoString, toDateTimeIsoString, (int)Skip, (int)First);
+ var response = StorSimpleClient.GetDeviceJobs(deviceId, Type, Status, InstanceId, fromDateTimeIsoString, toDateTimeIsoString, (int)Skip, (int)First);
if (ParameterSetName == StorSimpleCmdletParameterSet.IdentifyById)
{
if (response == null || response.DeviceJobList.Count < 1)
{
- WriteVerbose(string.Format(Resources.NoDeviceJobFoundWithGivenIdMessage, JobId));
+ WriteVerbose(string.Format(Resources.NoDeviceJobFoundWithGivenIdMessage, InstanceId));
WriteObject(null);
return;
}
@@ -122,7 +124,7 @@ public override void ExecuteCmdlet()
}
else
{
- WriteObject(response.DeviceJobList);
+ WriteObject(response.DeviceJobList, true);
WriteVerbose(string.Format(Resources.DeviceJobsReturnedCount, response.DeviceJobList.Count,
response.DeviceJobList.Count > 1 ? "s" : string.Empty));
if (response.NextPageUri != null
diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/StopAzureStorSimpleJob.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/StopAzureStorSimpleJob.cs
index 1669d96dc5e7..e5edd2fba4ae 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/StopAzureStorSimpleJob.cs
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Cmdlets/DeviceJobs/StopAzureStorSimpleJob.cs
@@ -32,9 +32,9 @@ public class StopAzureStorSimpleJob : StorSimpleCmdletBase
///
/// Device job id of the job to stop.
///
- [Parameter(Mandatory = true, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.DeviceJobId)]
- [ValidateNotNullOrEmptyAttribute]
- public string JobId { get; set; }
+ [Parameter(Mandatory = true, Position = 0, HelpMessage = StorSimpleCmdletHelpMessage.DeviceJobId, ValueFromPipelineByPropertyName = true)]
+ [ValidateNotNullOrEmpty]
+ public string InstanceId { get; set; }
///
/// Wheter to prompt for permission or not.
@@ -48,23 +48,31 @@ public override void ExecuteCmdlet()
{
ConfirmAction(
Force.IsPresent,
- string.Format(Resources.StopAzureStorSimpleJobWarningMessage, JobId),
- string.Format(Resources.StopAzureStorSimpleJobMessage, JobId),
- JobId,
+ string.Format(Resources.StopAzureStorSimpleJobWarningMessage, InstanceId),
+ string.Format(Resources.StopAzureStorSimpleJobMessage, InstanceId),
+ InstanceId,
() =>
{
// Get details of the job being cancelled.
- var deviceJobDetails = StorSimpleClient.GetDeviceJobById(JobId);
+ var deviceJobDetails = StorSimpleClient.GetDeviceJobById(InstanceId);
if (deviceJobDetails == null)
{
- WriteVerbose(string.Format(Resources.NoDeviceJobFoundWithGivenIdMessage, JobId));
+ WriteVerbose(string.Format(Resources.NoDeviceJobFoundWithGivenIdMessage, InstanceId));
+ WriteObject(null);
+ return;
+ }
+
+ // Make sure the job is running and cancellable, else fail.
+ if (!(deviceJobDetails.IsJobCancellable && deviceJobDetails.Status == "Running"))
+ {
+ WriteVerbose(string.Format(Resources.JobNotRunningOrCancellable, InstanceId));
WriteObject(null);
return;
}
// issue call to cancel the job.
- WriteVerbose(string.Format(Resources.StoppingDeviceJob,JobId));
- var taskStatusInfo = StorSimpleClient.StopDeviceJob(deviceJobDetails.Device.InstanceId, JobId);
+ WriteVerbose(string.Format(Resources.StoppingDeviceJob,InstanceId));
+ var taskStatusInfo = StorSimpleClient.StopDeviceJob(deviceJobDetails.Device.InstanceId, InstanceId);
HandleSyncTaskResponse(taskStatusInfo, "stop");
if (taskStatusInfo.AsyncTaskAggregatedResult == AsyncTaskAggregatedResult.Succeeded)
{
diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs
index f2453067ef21..ee2461c9f3c8 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.Designer.cs
@@ -214,7 +214,7 @@ internal static string DeviceGet_StatusMessage {
}
///
- /// Looks up a localized string similar to More jobs are available for your query. To access the next page of your result use \"-First {0} -Skip {1}\" in your commandlet.
+ /// Looks up a localized string similar to More jobs are available for your query. To access the next page of your result use -First {0} -Skip {1} in your commandlet.
///
internal static string DeviceJobsNextPageFormatMessage {
get {
@@ -223,7 +223,7 @@ internal static string DeviceJobsNextPageFormatMessage {
}
///
- /// Looks up a localized string similar to More jobs are available in the subsequent pages for your query. To access the next page use \"-Skip {0}\" in your commandlet.
+ /// Looks up a localized string similar to More jobs are available in the subsequent pages for your query. To access the next page use -Skip {0} in your commandlet.
///
internal static string DeviceJobsNextPagewithNoFirstMessage {
get {
@@ -483,6 +483,15 @@ internal static string IscsiConnectionGet_StatusMessage {
}
}
+ ///
+ /// Looks up a localized string similar to Cannot stop job with id {0}. It is not a running cancellable job..
+ ///
+ internal static string JobNotRunningOrCancellable {
+ get {
+ return ResourceManager.GetString("JobNotRunningOrCancellable", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Data0 configuration with Controller0 and Controller1 IP Addresses along with TimeZone and Primary DNS Server information is mandatory when configuring the device for the first time.
///
@@ -1177,7 +1186,7 @@ internal static string SuccessMessageSetResourceContext {
}
///
- /// Looks up a localized string similar to The {0} job is triggered successfully. Please use the command Get-AzureStorSimpleJob -JobId {1} for tracking the job's status.
+ /// Looks up a localized string similar to The {0} job is triggered successfully. Please use the command Get-AzureStorSimpleJob -InstanceId {1} for tracking the job's status.
///
internal static string SuccessMessageSubmitDeviceJob {
get {
diff --git a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx
index af5e3e837f78..95205bafe388 100644
--- a/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx
+++ b/src/ServiceManagement/StorSimple/Commands.StorSimple/Properties/Resources.resx
@@ -430,10 +430,10 @@
Data0 configuration with Controller0 and Controller1 IP Addresses along with TimeZone and Primary DNS Server information is mandatory when configuring the device for the first time
- More jobs are available for your query. To access the next page of your result use \"-First {0} -Skip {1}\" in your commandlet
+ More jobs are available for your query. To access the next page of your result use -First {0} -Skip {1} in your commandlet
- More jobs are available in the subsequent pages for your query. To access the next page use \"-Skip {0}\" in your commandlet
+ More jobs are available in the subsequent pages for your query. To access the next page use -Skip {0} in your commandlet
No more jobs are present for your query!
@@ -490,7 +490,7 @@
Volume Container Group \"{0}\" is not eligible for failover due to the reason: {1}
- The {0} job is triggered successfully. Please use the command Get-AzureStorSimpleJob -JobId {1} for tracking the job's status
+ The {0} job is triggered successfully. Please use the command Get-AzureStorSimpleJob -InstanceId {1} for tracking the job's status
Cloning backup with backupId {0}...
@@ -504,4 +504,7 @@
Source and Target device in a failover operation can not be the same.
+
+ Cannot stop job with id {0}. It is not a running cancellable job.
+
\ No newline at end of file