1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

Azure driver now uses short Cloud Service Name for Windows hostname compatibility

Hybrid libraries replacement
This commit is contained in:
Tino Vazquez 2015-07-17 11:10:21 +02:00
parent c83ec4946e
commit 135ba1cb24
23 changed files with 207 additions and 17 deletions

View File

@ -603,7 +603,10 @@ RUBY_LIB_FILES="src/mad/ruby/ActionManager.rb \
src/oca/ruby/deprecated/OpenNebula.rb \
src/oca/ruby/opennebula.rb \
src/sunstone/OpenNebulaVNC.rb \
src/vmm_mad/remotes/vcenter/vcenter_driver.rb"
src/vmm_mad/remotes/vcenter/vcenter_driver.rb \
src/vmm_mad/remotes/az/az_driver.rb \
src/vmm_mad/remotes/ec2/ec2_driver.rb \
src/vmm_mad/remotes/sl/sl_driver.rb"
#-------------------------------------------------------------------------------
# Ruby auth library files, to be installed under $LIB_LOCATION/ruby/opennebula
@ -777,8 +780,7 @@ VMM_EXEC_EC2_SCRIPTS="src/vmm_mad/remotes/ec2/cancel \
src/vmm_mad/remotes/ec2/reset \
src/vmm_mad/remotes/ec2/save \
src/vmm_mad/remotes/ec2/poll \
src/vmm_mad/remotes/ec2/shutdown \
src/vmm_mad/remotes/ec2/ec2_driver.rb"
src/vmm_mad/remotes/ec2/shutdown"
#------------------------------------------------------------------------------
# VMM Driver SoftLayer scripts, to be installed under $REMOTES_LOCATION/vmm/sl
@ -799,8 +801,7 @@ VMM_EXEC_SL_SCRIPTS="src/vmm_mad/remotes/sl/cancel \
src/vmm_mad/remotes/sl/reset \
src/vmm_mad/remotes/sl/save \
src/vmm_mad/remotes/sl/poll \
src/vmm_mad/remotes/sl/shutdown \
src/vmm_mad/remotes/sl/sl_driver.rb"
src/vmm_mad/remotes/sl/shutdown"
#------------------------------------------------------------------------------
# VMM Driver Azure scripts, to be installed under $REMOTES_LOCATION/vmm/az
@ -821,8 +822,7 @@ VMM_EXEC_AZ_SCRIPTS="src/vmm_mad/remotes/az/cancel \
src/vmm_mad/remotes/az/reset \
src/vmm_mad/remotes/az/save \
src/vmm_mad/remotes/az/poll \
src/vmm_mad/remotes/az/shutdown \
src/vmm_mad/remotes/az/az_driver.rb"
src/vmm_mad/remotes/az/shutdown"
#-------------------------------------------------------------------------------
# Information Manager Probes, to be installed under $REMOTES_LOCATION/im

View File

@ -184,7 +184,7 @@ class AzureDriver
csn = az_value(az_info, 'CLOUD_SERVICE')
csn = "OpenNebulaDefaultCloudServiceName-#{id}" if !csn
csn = "csn#{id}" if !csn
create_params = create_params(id,csn,az_info)
create_options = create_options(id,csn,az_info)
@ -273,10 +273,10 @@ class AzureDriver
vm_template_to_one = vm_template_to_one.gsub("\n","")
if vm.vm_name.start_with?('one-') and
vm.vm_name.match(/([^_]+)_(.+)/) and
vm.vm_name.match(/([^_]+)_(.+)/).size > 1
vm.vm_name.match(/([^_]+)-(.+)/) and
vm.vm_name.match(/([^_]+)-(.+)/).size > 1
one_id = vm.vm_name.match(/([^_]+)_(.+)/)[1].split("-")[1]
one_id = vm.vm_name.match(/([^_]+)-(.+)/)[1].split("-")[1]
end
vms_info << "VM=[\n"
@ -438,13 +438,14 @@ private
def create_params(id,csn,az_info)
params = {
# Name will always be 'one-<id>_<cloud_service_name>'
:vm_name => "one-#{id}_#{csn}",
# Name will always be 'one-<id>-<cloud_service_name>'
:vm_name => "one-#{id}-#{csn}",
:vm_user => az_value(az_info, 'VM_USER'),
:image => az_value(az_info, 'IMAGE'),
:password => az_value(az_info, 'VM_PASSWORD'),
:location => az_value(az_info, 'LOCATION')
}.delete_if { |k, v| v.nil? }
end
def create_options(id,csn,az_info)
@ -470,7 +471,7 @@ private
# +deploy_id+: String, VM id in Azure
# +az_action+: Symbol, one of the keys of the Azure hash constant (i.e :run)
def az_action(deploy_id, az_action)
name, csn = deploy_id.match(/([^_]+)_(.+)/)[1..-1]
name, csn = deploy_id.match(/([^_]+)-(.+)/)[1..-1]
# Imported VMs do not start with one-
deploy_id = name if !name.start_with? "one-"
@ -551,12 +552,12 @@ private
retval
end
# Retrive the instance from Azure. If OpenNebula asks for it, then the
# Retrieve the instance from Azure. If OpenNebula asks for it, then the
# vm_name must comply with the notation name_csn
def get_instance(vm_name)
begin
csn = vm_name.match(/([^_]+)_(.+)/)[2]
csn = vm_name.match(/([^_]+)-(.+)/)[-1]
instance = @azure_vms.get_virtual_machine(vm_name,csn)
if instance
return instance

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'az_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# ---------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'az_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'az_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'az_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'az_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'az_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'az_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'ec2_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# ---------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'ec2_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'ec2_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'ec2_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'ec2_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'ec2_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'ec2_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'sl_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'sl_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'sl_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'sl_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'sl_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'sl_driver'

View File

@ -16,6 +16,15 @@
# limitations under the License. #
# -------------------------------------------------------------------------- #
ONE_LOCATION=ENV["ONE_LOCATION"] if !defined?(ONE_LOCATION)
if !ONE_LOCATION
RUBY_LIB_LOCATION="/usr/lib/one/ruby" if !defined?(RUBY_LIB_LOCATION)
else
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby" if !defined?(RUBY_LIB_LOCATION)
end
$: << RUBY_LIB_LOCATION
$: << File.dirname(__FILE__)
require 'sl_driver'