Skip to content

Commit

Permalink
Corrected issue with Get-XIOEvent 0.44.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dmuegge committed Dec 5, 2015
1 parent cfad4c3 commit 7eb17bb
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 14 deletions.
15 changes: 7 additions & 8 deletions MTSXtremIO.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2794,32 +2794,33 @@ param ( [Parameter(Mandatory=$true,
# .ExternalHelp MTSXtremIO.psm1-Help.xml
function Get-XIOEvent{
[CmdletBinding(DefaultParameterSetName='AllEvents')]
param ( [Parameter(Mandatory=$true,
param ( [Parameter(Mandatory=$false,
ParameterSetName='EventsByDateTime')]
[ValidateNotNull()]
[Alias('f')]
[Alias('From')]
[datetime]$FromDateTime,
[Parameter(Mandatory=$true,
[Parameter(Mandatory=$false,
ParameterSetName='EventsByDateTime')]
[ValidateNotNull()]
[Alias('t')]
[Alias('To')]
[datetime]$ToDateTime
)

$UriString = 'events/'
$UriString = 'events'
# Return events by from date and time
if($FromDateTime){
$UriString += ('from-date-time="' + ($FromDateTime.ToString('u').Replace('Z',[string]::Empty)) + '"')
$UriString += ('?from-date-time=' + (($FromDateTime.ToString('u').Replace('Z',[string]::Empty)).Replace(' ','%20')))

if($ToDateTime){
$UriString += ('?to-date-time="' + ($ToDateTime.ToString('u').Replace('Z',[string]::Empty)) + '"')
$UriString += ('&to-date-time=' + (($ToDateTime.ToString('u').Replace('Z',[string]::Empty)).Replace(' ','%20')))
}
}
else{
# Return events by to date and time
if($ToDateTime){
$UriString += ('to-date-time="' + ($ToDateTime.ToString('u').Replace('Z',[string]::Empty)) + '"')
$UriString += ('?to-date-time=' + (($ToDateTime.ToString('u').Replace('Z',[string]::Empty)).Replace(' ','%20')))
}
}
# No parameters passed return details of all events
Expand All @@ -2829,8 +2830,6 @@ param ( [Parameter(Mandatory=$true,
else{
(Invoke-RestMethod -Method Get -Uri ($Global:XIOAPIBaseUri + $UriString) -Headers $Global:XIOAPIHeaders).events
}

# TODO - Need to revist this after feedback from EMC on from and to behavior. From does not seem to work and all requests appear to retrieve 504 records

} # Get-XIOEvent

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ Version

- 0.42.0 2015-11-22 - Add Multi-Cluster support to Get-XIOBrick, Get-XIOEnvs, Get-XIOStorageController, Get-XIOStorageControllerPSU, Get-XIODataProtectionGroup, Get-XIOTag, Get-XIOTagObject, Get-XIOVolume, Get-XIOSnapshotSet, Get-XIOScheduler, Get-XIOInitiator. Added ability to do adhoc authentication with Set-XIOAPIConnectionInfo. Corrected implementation of cmdlet aliases. Updated help.

- 0.43.0 2015-11-30 - Add Multi-Cluster support to remaining applicable Get functions and updated corresponding help documentation. Re-factored some code to reduce repetition. Added other help information. Added multi-cluster support and supports should process to all new,set,and remove cmdlets.
- 0.43.0 2015-11-30 - Add Multi-Cluster support to remaining applicable Get functions and updated corresponding help documentation. Re-factored some code to reduce repetition. Added other help information. Added multi-cluster support and supports should process to all new,set,and remove cmdlets.

- 0.44.0 2015-12-04 - Corrected issue with Get-XIOEvent


Notes
Expand Down
52 changes: 47 additions & 5 deletions Tests/MTSXtremIO_SmokeTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ $Volumes | ForEach-Object{Set-XIOVolume -Name $_ -SmallIOAlerts enable}


Get-XIOVolume -Name $Volumes[0] -Cluster 1
Get-XIOVolume | Select-Object Name,index,lb-size,vol-size,logical-space-in-use | FT -AutoSize
Get-XIOVolume | Select-Object Name,index,lb-size,vol-size,logical-space-in-use | Where Name -Like 'DAM*' | FT -AutoSize
Get-XIOVolume -ID 64 | Select Name
$Volumes | Get-XIOVolume | Select-object Name,index,lb-size,vol-size,logical-space-in-use | FT -AutoSize

Expand Down Expand Up @@ -345,9 +345,26 @@ New-XIOSnapshot -TagList @('/Volume/DAM01','/Volume/DAM02') -SnapSuffix '.Snap00
New-XIOSnapshot -TagList @('/Volume/DAM01','/Volume/DAM02') -SnapSuffix ('{0}{1}' -f '.Snap_',(Get-Date -Format yyyyMMdd-HHmmss)) -SnapSetName 'DAM01_Set0010'


(Get-XIOConsistencyGroup -Name 'DAMTest01').index

New-XIOSnapshot -CGID ((Get-XIOConsistencyGroup -Name 'DAMTest01').index) -SnapSuffix 'CG_Test001'


Get-XIOSnapshot | Where Name -like 'DAM*' | Select Name,index | FT -AutoSize


Update-XIOSnapshot -SourceVol 'DAM01' -DestVol 'DAM01.snap.0001' -NoBackup
Update-XIOSnapshot -SourceSnapSet 'SQLDATA01' -DestSnapSet 'SQLDATA02'



Get-XIOConsistencyGroup


Update-XIOSnapshot -SourceCG 'DAMTest01'



Get-XIOSnapshot | Where Name -match 'DAM[0-9]{2}.Snap_.*' | Select-Object Name,@{Name="AncestorValumeName";Expression={$_."ancestor-vol-id"[1]}},creation-time,vol-size,logical-space-in-use | ft -AutoSize
Get-XIOSnapshot | Where Name -match 'DAM[0-9]{2}.Snap_.*' | Remove-XIOSnapshot
Remove-XIOSnapshot -Name 'DAM04.Snap_20150920-100827.snapshot.1442758483'
Expand Down Expand Up @@ -790,17 +807,42 @@ Get-XIOSlot


#region Event (Get)
Get-XIOEvent
Get-XIOEvent -ToDateTime ([System.convert]::ToDateTime('4/19/2015'))
Get-XIOEvent -FromDateTime ([System.convert]::ToDateTime('7/16/2015')) -ToDateTime ([System.convert]::ToDateTime('7/17/2015'))
# Apparent issues with this API object waiting on EMC feedback
$Events = Get-XIOEvent
$Events | Select timestamp,id,event_code -First 1 | FT
$Events | Select timestamp,id,event_code -Last 1 | FT
$Events.count

$Events = Get-XIOEvent -FromDateTime ([System.convert]::ToDateTime('12/01/2015'))
$Events | Select timestamp,id,event_code -First 1 | FT
$Events | Select timestamp,id,event_code -Last 1 | FT
$Events.count

$Events = Get-XIOEvent -ToDateTime ([System.convert]::ToDateTime('12/03/2015'))
$Events | Select timestamp,id,event_code -First 1 | FT
$Events | Select timestamp,id,event_code -Last 1 | FT
$Events.count


$Events = Get-XIOEvent -FromDateTime ([System.convert]::ToDateTime('11/15/2015')) -ToDateTime ([System.convert]::ToDateTime('11/17/2015'))
$Events | Select timestamp,id,event_code -First 1 | FT
$Events | Select timestamp,id,event_code -Last 1 | FT
$Events.count

# Apparent issues with this API object waiting on EMC feedback
[System.Web.HttpUtility]::UrlEncode(([System.convert]::ToDateTime('4/19/2015')))

Get-XIOEvent -FromDateTime ([System.convert]::ToDateTime('7/16/2015')) -ToDateTime ([System.convert]::ToDateTime('7/17/2015'))
Get-XIOEvent -FromDateTime ([System.convert]::ToDateTime('8/20/2015'))
Get-XIOEvent -ToDateTime ([System.convert]::ToDateTime('7/19/2015'))


https://192.168.1.59/api/json/v2/types/events/from-date-time=2015-10-01%2000:00:00?to-date-time=2015-11-17%2000:00:00

((Invoke-RestMethod -Method Get -Uri 'https://192.168.1.59/api/json/types/events/from-date-time="2015-07-01 05:00:00"?to-date-time="2015-08-31 05:00:00"' -Headers $Global:XIOAPIHeaders).events | Select timestamp,id,event_code | FT).Count
((Invoke-RestMethod -Method Get -Uri 'https://192.168.1.59/api/json/types/events?from-date-time="2015-07-01 05:00:00"&to-date-time="2015-08-31 05:00:00"' -Headers $Global:XIOAPIHeaders).events | Select timestamp,id,event_code | FT).Count
((Invoke-RestMethod -Method Get -Uri 'https://192.168.1.59/api/json/types/events?from-date-time=2015-07-01%2005:00:00' -Headers $Global:XIOAPIHeaders).events | Select timestamp,id,event_code | FT).Count


<#
((Invoke-RestMethod -Method Get -Uri 'https://192.168.1.59/api/json/types/events/from-date-time="2015-07-01 05:00:00"?to-date-time="2015-08-31 05:00:00"' -Headers $Global:XIOAPIHeaders).events | Select timestamp,id,event_code | FT).Count
(Invoke-RestMethod -Method Get -Uri 'https://192.168.1.59/api/json/types/events/from-date-time="2015-07-01 05:00:00"?to-date-time="2015-08-31 05:00:00"' -Headers $Global:XIOAPIHeaders).events | Select timestamp,id,event_code | Select -First 1 -Last 1| FT
Expand Down

0 comments on commit 7eb17bb

Please sign in to comment.