1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F #~: reuse imported mac (#1453)

This commit is contained in:
Carlos J. Herrera 2021-09-14 09:41:45 -04:00 committed by GitHub
parent e1a48863e9
commit 6e0ae88fd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -1090,14 +1090,22 @@ end
#
# @return [Hash ("String" => self.Nic)] Model representation of nics
def info_nics
keep_mac_on_imported = false
keep_mac_on_imported = CONFIG[:keep_mac_on_imported] \
unless CONFIG[:keep_mac_on_imported].nil?
@nics = { :macs => {} }
vc_nics = vcenter_nics_list
one_nics = one_nics_get
one_nics.each do |one_nic|
index = one_nic['NIC_ID']
mac = one_nic['MAC']
index = one_nic['NIC_ID']
if keep_mac_on_imported && one_nic['MAC_IMPORTED']
mac = one_nic['MAC_IMPORTED']
else
mac = one_nic['MAC']
end
vc_dev = query_nic(mac, vc_nics)
if vc_dev

View File

@ -733,6 +733,9 @@ module VCenterDriver
nic, true)
network_found.info
if nic[:mac]
nic_tmp << "MAC_IMPORTED=\"#{nic[:mac]}\",\n"
end
# This is the existing nic info
if nic[:mac] && ipv4.empty? && ipv6.empty?
nic_tmp << "MAC=\"#{nic[:mac]}\",\n"

View File

@ -43,3 +43,6 @@
# Set to true if you need OpenNebula to detach non persistent disks
# from VMs on VM terminate but avoid deleting them afterwards
:keep_non_persistent_disks: false
# Set to true if you need OpenNebula avoid change imported MAC
:keep_mac_on_imported: true