Minor changes and bug fixes.
This commit is contained in:
Родитель
deec8e559d
Коммит
371ae96e14
|
@ -377,7 +377,6 @@ options = {
|
|||
:disk_label => 'disk-label',
|
||||
:disk_size => 100, #In GB
|
||||
:import => false,
|
||||
:lun => 10, #Valid LUN values are 0 through 15.
|
||||
:disk_name => 'Disk name' #Required when import is true
|
||||
}
|
||||
virtual_machine_service.add_data_disk('vm_name', 'cloud_service_name', options)
|
||||
|
|
|
@ -390,7 +390,6 @@ module Azure
|
|||
Loggerx.error_with_exit "The data disk name is not valid."
|
||||
end
|
||||
media_link = vm.media_link
|
||||
lun = options[:lun] || (Array(0..15) - vm.data_disks.map{|x| x[:lun].to_i}).first
|
||||
builder = Nokogiri::XML::Builder.new do |xml|
|
||||
xml.DataVirtualHardDisk(
|
||||
'xmlns' => 'http://schemas.microsoft.com/windowsazure',
|
||||
|
@ -399,7 +398,6 @@ module Azure
|
|||
xml.HostCaching options[:host_caching] || 'ReadOnly'
|
||||
xml.DiskLabel options[:disk_label]
|
||||
xml.DiskName options[:disk_name] if options[:import]
|
||||
xml.Lun lun
|
||||
xml.LogicalDiskSizeInGB options[:disk_size] || 100
|
||||
unless options[:import]
|
||||
disk_name = media_link[/([^\/]+)$/]
|
||||
|
|
|
@ -51,7 +51,7 @@ module Azure
|
|||
#
|
||||
# Returns an Azure::VirtualMachineManagement::VirtualMachine instance.
|
||||
def get_virtual_machine(name, cloud_service_name)
|
||||
server = list_virtual_machines(cloud_service_name).select { |x| x.vm_name == name }
|
||||
server = list_virtual_machines(cloud_service_name).select { |x| x.vm_name == name.downcase }
|
||||
server.first
|
||||
end
|
||||
|
||||
|
@ -180,14 +180,12 @@ module Azure
|
|||
deployment_name = cloud_service.deployment_name
|
||||
Loggerx.error_with_exit "Deployment doesn't exists." if cloud_service && deployment_name.empty?
|
||||
others = {}
|
||||
if options[:storage_account_name].nil?
|
||||
if cloud_service.location
|
||||
others[:location] = cloud_service.location
|
||||
elsif cloud_service.affinity_group
|
||||
others[:affinity_group_name] = cloud_service.affinity_group
|
||||
end
|
||||
options[:storage_account_name] ||= generate_storage_account_name(params[:vm_name])
|
||||
if cloud_service.location
|
||||
others[:location] = cloud_service.location
|
||||
elsif cloud_service.affinity_group
|
||||
others[:affinity_group_name] = cloud_service.affinity_group
|
||||
end
|
||||
options[:storage_account_name] ||= generate_storage_account_name(params[:vm_name])
|
||||
Azure::StorageManagementService.new.create_storage_account(options[:storage_account_name], others)
|
||||
Loggerx.info 'Deployment exists, adding role...'
|
||||
existing_ports = []
|
||||
|
@ -441,8 +439,6 @@ module Azure
|
|||
# The default is ReadOnly. Possible values are: None, ReadOnly, ReadWrite
|
||||
# * +:disk_label+ - String. Specifies the description of the data disk.
|
||||
# * +:disk_size+ - String. Specifies the size of disk in GB
|
||||
# * +lun+ - String. Specifies the Logical Unit Number
|
||||
# (LUN) for the disk. Valid LUN values are 0 through 15.
|
||||
#
|
||||
# See http://msdn.microsoft.com/en-us/library/windowsazure/jj157199.aspx
|
||||
#
|
||||
|
|
|
@ -86,10 +86,10 @@ describe Azure::VirtualMachineManagementService do
|
|||
end
|
||||
|
||||
it 'should add role and create new storage account' do
|
||||
params[:vm_name] = "add-storage-#{virtual_machine_name}"
|
||||
params[:vm_name] = "Add-storage-#{virtual_machine_name}"
|
||||
vm = subject.add_role(params)
|
||||
vm.cloud_service_name.must_equal params[:cloud_service_name]
|
||||
vm.vm_name.must_equal params[:vm_name]
|
||||
vm.vm_name.must_equal params[:vm_name].downcase
|
||||
vm.deployment_name.must_equal @vm_obj.deployment_name
|
||||
end
|
||||
end
|
||||
|
|
|
@ -158,7 +158,7 @@ describe Azure::VirtualMachineManagement::Serialization do
|
|||
public_port: '85',
|
||||
local_port: '85'
|
||||
)
|
||||
tcp_endpoints.must_include(
|
||||
tcp_endpoints.must_include(
|
||||
name: 'PowerShell',
|
||||
public_port: '5988',
|
||||
local_port: '5986'
|
||||
|
@ -170,8 +170,7 @@ describe Azure::VirtualMachineManagement::Serialization do
|
|||
|
||||
let(:options) do
|
||||
{
|
||||
disk_size: 100,
|
||||
lun: 5
|
||||
disk_size: 100,
|
||||
}
|
||||
end
|
||||
let(:media_link) { 'https://sta.blob.managment.core.net/vhds/1234.vhd' }
|
||||
|
@ -190,7 +189,6 @@ describe Azure::VirtualMachineManagement::Serialization do
|
|||
media_link = doc.css('DataVirtualHardDisk MediaLink').text
|
||||
disk_name = doc.css('DataVirtualHardDisk DiskName').text
|
||||
result.must_be_kind_of String
|
||||
doc.css('DataVirtualHardDisk Lun').text.must_equal options[:lun].to_s
|
||||
disk_size.must_equal options[:disk_size].to_s
|
||||
media_link.wont_be_empty
|
||||
disk_name.must_be_empty
|
||||
|
@ -198,14 +196,12 @@ describe Azure::VirtualMachineManagement::Serialization do
|
|||
|
||||
it 'returns an xml for existing data disk' do
|
||||
options[:import] = true
|
||||
options.delete(:lun)
|
||||
options[:disk_name] = 'disk_name'
|
||||
result = subject.add_data_disk_to_xml(@vm, options)
|
||||
doc = Nokogiri::XML(result)
|
||||
media_link = doc.css('DataVirtualHardDisk MediaLink').text
|
||||
disk_name = doc.css('DataVirtualHardDisk DiskName').text
|
||||
result.must_be_kind_of String
|
||||
doc.css('DataVirtualHardDisk Lun').text.must_equal '0'
|
||||
media_link.must_be_empty
|
||||
disk_name.wont_be_empty
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче