knife-vsphere
knife-vsphere copied to clipboard
clone fails to properly configure network on RHEL 7
Versions:
- Version of knife-vsphere: 2.1.1
- Version of chef: 13.8.5
Platform Details
- Version of vSphere: 6.0.0
- Version of ESXi: 6.0.0
Scenario:
When I attempt to clone a RHEL 7 template, network configuration does not complete properly, and instead of the static ipv4 address given in the clone command, it reports a default ipv6 address. I have reproduced the problem on RHEL versions 7.3, 7.4, and 7.5.
knife vsphere vm clone redhat73-x64 --folder Templates/RedHat --template redhat73-x64 --dest-folder Users/mockuser/ --datastore xyz --cvlan vlan212 --cips 10.10.10.0/24 --chostname redhat73-x64 --cgw 10.10.10.1 --cdnsips 10.10.10.11,10.10.10.12--cram 2 --start --config ./knife.rb --resource-pool zyx -VV
INFO: Using configuration from /home/mock/knife.rb
DEBUG: value for config item datastore: xxx
DEBUG: value for config item datastorecluster:
DEBUG: value for config item customization_macs: auto
DEBUG: value for config item chef_node_name:
DEBUG: value for config item vsphere_host: xxx
DEBUG: value for config item vsphere_path: /sdk
DEBUG: value for config item vsphere_port: 443
DEBUG: value for config item vsphere_nossl:
DEBUG: value for config item vsphere_user: xxx
DEBUG: value for config item vsphere_pass: xxx
DEBUG: value for config item vsphere_pass: xxx
DEBUG: value for config item vsphere_pass: xxx
DEBUG: value for config item vsphere_insecure: true
DEBUG: value for config item proxy_host:
DEBUG: value for config item proxy_port:
DEBUG: value for config item vsphere_dc: xxx
DEBUG: value for config item source_vm: redhat73-x64
DEBUG: value for config item folder: Templates/RedHat
DEBUG: value for config item vsphere_dc: LAB
DEBUG: value for config item linked_clone:
DEBUG: value for config item host:
DEBUG: value for config item resource_pool: zyx
DEBUG: value for config item resource_pool: zyx
DEBUG: value for config item vsphere_dc: xxx
DEBUG: value for config item linked_clone:
DEBUG: value for config item datastore: xyz
DEBUG: value for config item datastore: xyz
DEBUG: value for config item vsphere_dc: xxx
DEBUG: value for config item datastorecluster:
DEBUG: value for config item thin_provision:
DEBUG: value for config item mark_as_template:
DEBUG: value for config item annotation:
DEBUG: value for config item customization_cpucount:
DEBUG: value for config item customization_corespersocket:
DEBUG: value for config item customization_memory: 2
DEBUG: value for config item customization_memory: 2
DEBUG: value for config item customization_memory_reservation:
DEBUG: value for config item customization_macs: auto
DEBUG: value for config item customization_ips: 10.10.10.0/24
DEBUG: value for config item customization_sw_uuid:
DEBUG: value for config item customization_vlan: vlan212
DEBUG: value for config item customization_vlan: vlan212
DEBUG: value for config item customization_sw_uuid:
DEBUG: value for config item vsphere_dc: xxx
DEBUG: value for config item customization_sw_uuid:
DEBUG: value for config item customization_macs: auto
DEBUG: value for config item customization_spec:
DEBUG: value for config item disable_customization: false
DEBUG: value for config item customization_dns_ips: 10.10.10.11,10.10.10.12
DEBUG: value for config item customization_dns_ips: 10.10.10.11,10.10.10.12
DEBUG: value for config item customization_dns_suffixes:
DEBUG: value for config item customization_gw: 10.10.10.1
DEBUG: Identified os as linux.
DEBUG: value for config item customization_domain:
DEBUG: value for config item customization_plugin:
DEBUG: value for config item vsphere_dc: xxx
DEBUG: value for config item source_vm: redhat73-x64
Cloning template redhat73-x64 to new VM redhat73-x64
VirtualMachineCloneSpec(
config: VirtualMachineConfigSpec(
deviceChange: [VirtualDeviceConfigSpec(
device: VirtualE1000(
addressType: "assigned",
backing: VirtualEthernetCardNetworkBackingInfo(
deviceName: "vlan212",
network: Network("network-83")
),
connectable: VirtualDeviceConnectInfo(
allowGuestControl: true,
connected: false,
dynamicProperty: [],
startConnected: true,
status: "untried"
),
controllerKey: 100,
deviceInfo: Description(
dynamicProperty: [],
label: "Network adapter 1",
summary: "PrivateVM"
),
dynamicProperty: [],
key: 4000,
macAddress: "55:55:55:55:55:55",
slotInfo: VirtualDevicePciBusSlotInfo(
dynamicProperty: [],
pciSlotNumber: 33
),
unitNumber: 7,
wakeOnLanEnabled: false
),
operation: "edit"
)],
memoryMB: 2048
),
customization: CustomizationSpec(
globalIPSettings: CustomizationGlobalIPSettings(
dnsServerList: ["10.10.10.11", "10.10.10.11"]
),
identity: CustomizationLinuxPrep(
domain: "",
hostName: CustomizationFixedName( name: "redhat73-x64" )
),
nicSettingMap: [CustomizationAdapterMapping(
adapter: CustomizationIPSettings(
gateway: ["10.10.10.1"],
ip: CustomizationFixedIp( ipAddress: "10.10.10.0" ),
subnetMask: "255.255.255.0"
)
)]
),
location: VirtualMachineRelocateSpec(
datastore: Datastore("datastore-29831"),
pool: ResourcePool("resgroup-29836")
),
powerOn: false,
template: false
)
Finished creating virtual machine redhat73-x64
DEBUG: value for config item customization_plugin:
DEBUG: value for config item mark_as_template:
DEBUG: value for config item power: true
DEBUG: value for config item vsphere_dc: xxx
Powered on virtual machine redhat73-x64
DEBUG: value for config item bootstrap:
Expected Result:
A VM is cloned from template and configured with a static IP according to the given command.
Actual Result:
The VM is cloned and configured as normal, except that the network connection is not properly configured at all. ipv4.method is set to auto, and there are no values for ipv4.addresses or ipv4.gateway. On the newly cloned VM:
nmcli con show ens33
connection.id: ens33
connection.uuid: 9bda2015-f7f6-49af-be09-c528b2acc49c
connection.stable-id: --
connection.interface-name: ens33
connection.type: 802-3-ethernet
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.timestamp: 0
connection.read-only: no
connection.permissions:
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries:
connection.gateway-ping-timeout: 0
connection.metered: unknown
connection.lldp: -1 (default)
802-3-ethernet.port: --
802-3-ethernet.speed: 0
802-3-ethernet.duplex: --
802-3-ethernet.auto-negotiate: yes
802-3-ethernet.mac-address: --
802-3-ethernet.cloned-mac-address: --
802-3-ethernet.generate-mac-address-mask:--
802-3-ethernet.mac-address-blacklist:
802-3-ethernet.mtu: auto
802-3-ethernet.s390-subchannels:
802-3-ethernet.s390-nettype: --
802-3-ethernet.s390-options:
802-3-ethernet.wake-on-lan: 1 (default)
802-3-ethernet.wake-on-lan-password: --
ipv4.method: auto
ipv4.dns:
ipv4.dns-search:
ipv4.dns-options: (default)
ipv4.dns-priority: 0
ipv4.addresses:
ipv4.gateway: --
ipv4.routes:
ipv4.route-metric: -1
ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: no
ipv4.may-fail: yes
ipv4.dad-timeout: -1 (default)
ipv6.method: auto
ipv6.dns:
ipv6.dns-search:
ipv6.dns-options: (default)
ipv6.dns-priority: 0
ipv6.addresses:
ipv6.gateway: --
ipv6.routes:
ipv6.route-metric: -1
ipv6.ignore-auto-routes: no
ipv6.ignore-auto-dns: no
ipv6.never-default: no
ipv6.may-fail: yes
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
GENERAL.NAME: ens33
GENERAL.UUID: 9bda2015-f7f6-49af-be09-c528b2acc49c
GENERAL.DEVICES: ens33
GENERAL.STATE: activating
GENERAL.DEFAULT: no
GENERAL.DEFAULT6: no
GENERAL.VPN: no
GENERAL.ZONE: --
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/7
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/1
GENERAL.SPEC-OBJECT: /
GENERAL.MASTER-PATH: --
Hi, I'm sorry I missed responding to this. Is it still happening? The template should be booting with the vmware agent running, selinux disabled, and Perl should be installed. Can you verify those, please?
Hey! No problem, I took my time in responding too, sorry about that. I'm not 100% sure what you mean by vmware agent, but vmtoolsd.service is running, selinux is set to "permissive", and Perl v5.16.3 is installed.
Same Issue here and same environment, some update ?
I need to make a downgrade to release 2.0.5 to work
Hi @leonrado is there a difference in the clone spec we send (-VV) between 2.0.5 and current?
Also are you passing CIDR addresses in --cips? I just noticed that @aespurge used the network address (--cips 10.10.10.0/24 ) so Red Hat might not like that.