Skip to content

Commit

Permalink
Merge pull request #431 from HewlettPackard/Snapshot_delete_fix
Browse files Browse the repository at this point in the history
Snapshot delete fix with correct etags
  • Loading branch information
nabhajit-ray committed Jun 4, 2020
2 parents e823050 + 41fdc4f commit 1795415
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This release extends support of the SDK to OneView REST API version 1600 (OneVie
#### Features supported
- Connection Template

#### Bug fixes & Enhancements
- [#432](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/432)Snapshot deletion will fail with mis match etags error

## v5.12.0

#### Notes
Expand Down
4 changes: 2 additions & 2 deletions lib/oneview-sdk/resource/api200/volume.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -123,7 +123,7 @@ def create_snapshot(snapshot, description = nil)
# @return [true] if snapshot was created successfully
def delete_snapshot(name)
result = get_snapshot(name)
response = @client.rest_delete(result['uri'], { 'If-Match' => @data['eTag'] }, @api_version)
response = @client.rest_delete(result['uri'], { 'If-Match' => result['eTag'] }, @api_version)
@client.response_handler(response)
true
end
Expand Down
3 changes: 2 additions & 1 deletion spec/unit/resource/api200/volume_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@
it 'Deletes a snapshot of the volume' do
@item['uri'] = '/rest/storage-volumes/fake'
@item['eTag'] = 'any_tag'
snapshot_options = { 'uri' => '/rest/fake', 'type' => 'Snapshot', 'name' => 'Vol1_Snapshot1', 'description' => 'New Snapshot' }
snapshot_options = { 'uri' => '/rest/fake', 'type' => 'Snapshot', 'name' => 'Vol1_Snapshot1', 'description' => 'New Snapshot',
'eTag' => 'any_tag' }
snapshots = [OneviewSDK::VolumeSnapshot.new(@client_200, snapshot_options)]
allow_any_instance_of(OneviewSDK::Client).to receive(:response_handler).and_return('members' => snapshots)
expect(@client_200).to receive(:rest_get).with("#{@item['uri']}/snapshots", {})
Expand Down

0 comments on commit 1795415

Please sign in to comment.