diff --git a/CHANGELOG.md b/CHANGELOG.md index 39cc82d..90f6c3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ rightscale_volume Cookbook CHANGELOG This file is used to list changes made in each version of the rightscale_volume cookbook. +v1.2.9 +------ + +- Verify from OS perspective that volume has been attached. + v1.2.8 ------ diff --git a/libraries/provider_rightscale_volume.rb b/libraries/provider_rightscale_volume.rb index 9d8920d..733caf2 100644 --- a/libraries/provider_rightscale_volume.rb +++ b/libraries/provider_rightscale_volume.rb @@ -556,7 +556,15 @@ def attach_volume(volume_id, device) scan_for_attachments if node['virtualization']['system'] == 'vmware' # Determine the actual device name - (Set.new(get_current_devices) - current_devices).first + added_device = nil + Timeout::timeout(60) do + begin + sleep(1) + Chef::Log.info "Checking for added device." + added_device = (Set.new(get_current_devices) - current_devices).first + end until added_device + end + added_device end # Finds volumes using the given filters. diff --git a/metadata.rb b/metadata.rb index 062ac99..afae2c4 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Provides a resource to manage volumes on any cloud RightScale supports.' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.2.8' +version '1.2.9' depends 'build-essential' diff --git a/spec/unit_test/provider_rightscale_volume_spec.rb b/spec/unit_test/provider_rightscale_volume_spec.rb index a329355..acb9316 100644 --- a/spec/unit_test/provider_rightscale_volume_spec.rb +++ b/spec/unit_test/provider_rightscale_volume_spec.rb @@ -626,9 +626,11 @@ def create_test_volume_type(name, id, size, href) end describe "#attach_volume" do + it "should attach the volume to an instance" do provider.stub(:find_volumes).and_return(array_of(volume_resource)) - provider.stub(:get_current_devices).and_return(['device_1', 'device_2']) + # First call will return 1 device, second call will return 2 devices. + provider.stub(:get_current_devices).and_return(['device_1'], ['device_1', 'device_2']) node.set[:virtualization][:system] = 'some_hypervisor' node.set['cloud']['provider'] = 'some_cloud'