mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Merge branch 'master' into f-3951
This commit is contained in:
commit
dfe158f3bf
@ -2377,7 +2377,7 @@ ONEPROVISION_CONF_FILES="src/cli/etc/oneprovision.yaml \
|
||||
|
||||
ONEPROVISION_ANSIBLE_FILES="share/oneprovision/ansible"
|
||||
|
||||
ONEPROVISION_TEMPLATES_FILES="share/oneprovision/provisions/hybrid+"
|
||||
ONEPROVISION_TEMPLATES_FILES="share/oneprovision/provisions"
|
||||
|
||||
ONEPROVISION_LIB_FILES="src/oneprovision/lib/oneprovision.rb \
|
||||
src/oneprovision/lib/provision_element.rb"
|
||||
|
@ -383,36 +383,42 @@ module VCenterDriver
|
||||
.vim
|
||||
.serviceContent
|
||||
.viewManager
|
||||
.CreateContainerView({
|
||||
:container => dc.item.vmFolder,
|
||||
:type => ['VirtualMachine'],
|
||||
:recursive => true
|
||||
})
|
||||
.CreateContainerView(
|
||||
{
|
||||
:container => dc.item.vmFolder,
|
||||
:type => ['VirtualMachine'],
|
||||
:recursive => true
|
||||
}
|
||||
)
|
||||
|
||||
pc = vi_client.vim.serviceContent.propertyCollector
|
||||
|
||||
filter_spec = RbVmomi::VIM.PropertyFilterSpec(
|
||||
:objectSet => [
|
||||
{ :obj => view,
|
||||
:skip => true,
|
||||
:selectSet => [
|
||||
RbVmomi::VIM.TraversalSpec(
|
||||
:name => 'traverseEntities',
|
||||
:type => 'ContainerView',
|
||||
:path => 'view',
|
||||
:skip => false
|
||||
)
|
||||
] }
|
||||
{
|
||||
:obj => view,
|
||||
:skip => true,
|
||||
:selectSet => [
|
||||
RbVmomi::VIM.TraversalSpec(
|
||||
:name => 'traverseEntities',
|
||||
:type => 'ContainerView',
|
||||
:path => 'view',
|
||||
:skip => false
|
||||
)
|
||||
]
|
||||
}
|
||||
],
|
||||
:propSet => [
|
||||
{
|
||||
:type => 'VirtualMachine',
|
||||
:pathSet => ['config.template']
|
||||
:pathSet => ['config.template']
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
result = pc.RetrieveProperties(:specSet => [filter_spec])
|
||||
result = pc.RetrieveProperties(
|
||||
:specSet => [filter_spec]
|
||||
)
|
||||
|
||||
vms = {}
|
||||
result.each do |r|
|
||||
@ -441,7 +447,7 @@ module VCenterDriver
|
||||
.find_by_ref(
|
||||
OpenNebula::TemplatePool,
|
||||
'TEMPLATE/VCENTER_TEMPLATE_REF',
|
||||
template['_ref'],
|
||||
tref,
|
||||
vcenter_uuid,
|
||||
tpool
|
||||
)
|
||||
@ -467,7 +473,9 @@ module VCenterDriver
|
||||
end
|
||||
end
|
||||
|
||||
{ vcenter_instance_name => template_objects }
|
||||
{
|
||||
vcenter_instance_name => template_objects
|
||||
}
|
||||
end
|
||||
|
||||
def cluster_networks(one_host)
|
||||
|
@ -563,7 +563,7 @@ module VCenterDriver
|
||||
end
|
||||
end
|
||||
|
||||
dc = cluster.get_dc
|
||||
dc = cluster.datacenter
|
||||
|
||||
vcenter_vm_folder = drv_action['USER_TEMPLATE/VCENTER_VM_FOLDER']
|
||||
|
||||
@ -826,11 +826,10 @@ module VCenterDriver
|
||||
# Default disk move type (Full Clone)
|
||||
disk_move_type = :moveAllDiskBackingsAndDisallowSharing
|
||||
|
||||
if ds.instance_of?(
|
||||
RbVmomi::VIM::Datastore &&
|
||||
use_linked_clones &&
|
||||
use_linked_clones.downcase == 'yes'
|
||||
)
|
||||
if ds.instance_of?(RbVmomi::VIM::Datastore) &&
|
||||
use_linked_clones &&
|
||||
use_linked_clones.downcase == 'yes'
|
||||
|
||||
# Check if all disks in template has delta disks
|
||||
disks = vc_template.config
|
||||
.hardware
|
||||
@ -1240,8 +1239,11 @@ module VCenterDriver
|
||||
unmanaged_disks = one_item.retrieve_xmlelements(xpath)
|
||||
|
||||
managed = false
|
||||
extraconfig = reference_disks(template_ref, unmanaged_disks,
|
||||
managed)
|
||||
extraconfig = reference_disks(
|
||||
template_ref,
|
||||
unmanaged_disks,
|
||||
managed
|
||||
)
|
||||
|
||||
# Add info for existing nics in template in vm xml
|
||||
xpath =
|
||||
@ -1260,31 +1262,22 @@ module VCenterDriver
|
||||
select_net =lambda {|ref|
|
||||
device = nil
|
||||
nics.each do |nic|
|
||||
type = nic.backing.class
|
||||
type = nic.backing.class.to_s
|
||||
|
||||
case type
|
||||
when NET_CARD
|
||||
when NET_CARD.to_s
|
||||
nref = nic.backing.network._ref
|
||||
when DNET_CARD
|
||||
when DNET_CARD.to_s
|
||||
nref = nic.backing.port.portgroupKey
|
||||
when OPAQUE_CARD
|
||||
when OPAQUE_CARD.to_s
|
||||
# Select only Opaque Networks
|
||||
opaque_networks = @item.network.select do |net|
|
||||
RbVmomi::VIM::OpaqueNetwork == net.class
|
||||
end
|
||||
opaque_network =
|
||||
opaque_networks
|
||||
.find do |opn|
|
||||
first_condition =
|
||||
nic
|
||||
.backing
|
||||
.opaqueNetworkId
|
||||
second_condition =
|
||||
opn
|
||||
.summary
|
||||
.opaqueNetworkId
|
||||
first_condition == second_condition
|
||||
end
|
||||
opaque_network = opaque_networks.find do |opn|
|
||||
nic.backing.opaqueNetworkId ==
|
||||
opn.summary.opaqueNetworkId
|
||||
end
|
||||
nref = opaque_network._ref
|
||||
else
|
||||
raise 'Unsupported network card type: '\
|
||||
@ -1309,11 +1302,10 @@ module VCenterDriver
|
||||
unmanaged_nics.each do |unic|
|
||||
vnic = select_net.call(unic['VCENTER_NET_REF'])
|
||||
nic_class = vnic.class if vnic
|
||||
new_model =
|
||||
Nic
|
||||
.nic_model_class(
|
||||
unic['MODEL']
|
||||
) if unic['MODEL']
|
||||
|
||||
if unic['MODEL']
|
||||
new_model = Nic.nic_model_class(unic['MODEL'])
|
||||
end
|
||||
|
||||
# if vnic is nil add a new device
|
||||
if vnic.nil?
|
||||
@ -1324,27 +1316,24 @@ module VCenterDriver
|
||||
:device => vnic,
|
||||
:operation => :remove
|
||||
}
|
||||
device_change <<
|
||||
calculate_add_nic_spec(
|
||||
unic,
|
||||
vnic.unitNumber
|
||||
)
|
||||
# update the actual nic
|
||||
device_change << calculate_add_nic_spec(
|
||||
unic,
|
||||
vnic.unitNumber
|
||||
)
|
||||
else
|
||||
vnic.macAddress = unic['MAC']
|
||||
device_change <<
|
||||
{
|
||||
:device => vnic,
|
||||
:operation => :edit
|
||||
}
|
||||
device_change << {
|
||||
:device => vnic,
|
||||
:operation => :edit
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
rescue StandardError => e
|
||||
raise 'There is a problem with your vm NICS,'\
|
||||
'make sure that they are working properly. '\
|
||||
"Error: #{e.message}"
|
||||
raise 'There is a problem with your vm NICS, '\
|
||||
'make sure that they are working properly. '\
|
||||
"Error: #{e.message}"
|
||||
end
|
||||
|
||||
# Save in extraconfig the key for unmanaged disks
|
||||
|
@ -373,10 +373,8 @@ module VCenterDriver
|
||||
one_i.info
|
||||
start_time = Time.now
|
||||
|
||||
first_condition = one_i.state_str != 'READY'
|
||||
second_condition = Time.now - start_time < 300
|
||||
|
||||
while first_condition && second_condition
|
||||
while (one_i.state_str != 'READY') &&
|
||||
(Time.now - start_time < 300)
|
||||
sleep 1
|
||||
one_i.info
|
||||
end
|
||||
@ -986,7 +984,7 @@ module VCenterDriver
|
||||
)
|
||||
|
||||
vi_client = opts[:vi_client]
|
||||
vc_uuid = opts[:vc_uuidv]
|
||||
vc_uuid = opts[:vc_uuid]
|
||||
npool = opts[:npool]
|
||||
hpool = opts[:hpool]
|
||||
vcenter_instance_name = opts[:vcenter]
|
||||
@ -1661,10 +1659,10 @@ module VCenterDriver
|
||||
folders = []
|
||||
until item.instance_of? RbVmomi::VIM::Datacenter
|
||||
item = item.parent
|
||||
unless item.instance_of?(
|
||||
RbVmomi::VIM::Datacenter &&
|
||||
item.name != 'vm'
|
||||
)
|
||||
first_condition = item.instance_of? RbVmomi::VIM::Datacenter
|
||||
second_condition = item.name != 'vm'
|
||||
|
||||
unless first_condition && second_condition
|
||||
folders << item.name
|
||||
end
|
||||
if item.nil?
|
||||
@ -1834,8 +1832,8 @@ module VCenterDriver
|
||||
opts[:name]
|
||||
)
|
||||
unless template_copy_ref
|
||||
raise "There is a problem creating creating \
|
||||
your copy: #{error}"
|
||||
raise 'There is a problem creating creating' \
|
||||
"your copy: #{error}"
|
||||
end
|
||||
|
||||
template =
|
||||
@ -1860,8 +1858,8 @@ module VCenterDriver
|
||||
dc
|
||||
)
|
||||
unless one_template
|
||||
raise "There is a problem obtaining info \
|
||||
from your template's copy"
|
||||
raise 'There is a problem obtaining info '\
|
||||
"from your template's copy"
|
||||
end
|
||||
|
||||
working_template = one_template
|
||||
@ -1916,7 +1914,7 @@ module VCenterDriver
|
||||
template_moref = selected[:vcenter_ref]
|
||||
end
|
||||
|
||||
opts = {
|
||||
opts_nics = {
|
||||
:vi_client => @vi_client,
|
||||
:vc_uuid => vc_uuid,
|
||||
:npool => npool,
|
||||
@ -1929,7 +1927,7 @@ module VCenterDriver
|
||||
error, template_nics, _ar_ids, allocated_nets =
|
||||
template
|
||||
.import_vcenter_nics(
|
||||
opts,
|
||||
opts_nics,
|
||||
id,
|
||||
dc
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user