incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1151442 - /incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
Date Wed, 27 Jul 2011 12:16:55 GMT
Author: mfojtik
Date: Wed Jul 27 12:16:54 2011
New Revision: 1151442

URL: http://svn.apache.org/viewvc?rev=1151442&view=rev
Log:
Added user_data option in vsphere driver

Signed-off-by: Francesco Vollero <fvollero@redhat.com>

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb?rev=1151442&r1=1151441&r2=1151442&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb Wed
Jul 27 12:16:54 2011
@@ -229,6 +229,25 @@ module Deltacloud::Drivers::VSphere
         # encoded gzipped ISO image.
         # This image will be uplaoded to the Datastore given in 'realm_id'
         # parameter and them attached to instance.
+        if opts[:user_data] and not opts[:user_data].empty?
+          device = vm[:instance].config.hardware.device.select { |hw| hw.class == RbVmomi::VIM::VirtualCdrom
}.first
+          if device
+            VSphere::FileManager::user_data!(datastore, opts[:user_data],"deltacloud_user_data")
+            machine_config[:extraConfig] << {
+              :key => 'user_data_file', :value => "deltacloud_user_data.iso"
+            }
+            device.backing = RbVmomi::VIM.VirtualCdromIsoBackingInfo(:fileName => "[#{opts[:realm_id]
|| vm[:datastore]}] "+
+                                                                     "/#{VSphere::FileManager::DIRECTORY_PATH}/deltacloud_user_data.iso")
+            machine_config.merge!({
+              :deviceChange => [{
+                :operation => :edit,
+                :device => device
+              }]
+            })
+          else
+            raise "Failed to inject data to device because there is no CD-ROM drive defined
in given template"
+          end
+        end
         if opts[:user_iso] and not opts[:user_iso].empty?
           device = vm[:instance].config.hardware.device.select { |hw| hw.class == RbVmomi::VIM::VirtualCdrom
}.first
           if device



Mime
View raw message