| Summary: | [Hyper-V][RHEL7]Inconsistent behaviour when setting static IP using WMI from Hyper-V | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | yonatan.amir | ||||||
| Component: | hyperv-daemons | Assignee: | Vitaly Kuznetsov <vkuznets> | ||||||
| Status: | CLOSED WORKSFORME | QA Contact: | xuli <xuli> | ||||||
| Severity: | unspecified | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | 7.3 | CC: | ailan, hhei, linl, ribarry, xiaofwan, xuli, yacao, yonatan.amir | ||||||
| Target Milestone: | rc | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: |
Hyper-V (Windows Server 2012 R2)
|
|||||||
| Last Closed: | 2019-02-15 07:22:44 UTC | Type: | Bug | ||||||
| Regression: | --- | Mount Type: | --- | ||||||
| Documentation: | --- | CRM: | |||||||
| Verified Versions: | Category: | --- | |||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||
| Attachments: |
|
||||||||
|
Description
yonatan.amir
2016-11-15 10:54:46 UTC
(In reply to yonatan.amir from comment #0) > 4. Start the VM and immediately try to set a static IP, e.g. using > Msvm_VirtualSystemManagementService.SetGuestNetworkAdapterConfiguration() This should read: Start the VM and immediately *following Hyper-V reporting an IP for the NIC*, try to set a static IP, e.g. using Msvm_VirtualSystemManagementService.SetGuestNetworkAdapterConfiguration() Seeing this in /var/log/messages:
Nov 15 16:36:40 localhost network: Determining IP information for eth0.../etc/sysconfig/network-scripts/ifup-eth: line 297: 932 Terminated /sbin/dhclient ${DHCLIENTARGS} ${DEVICE}
So it looks like the script terminates while dhclient is running.
Looks like a race condition with ifup, probably one can avoid having to boot the VM and simply run the WMI command right after running ifup in the guest. (In reply to yonatan.amir from comment #4) > Looks like a race condition with ifup, probably one can avoid having to boot > the VM and simply run the WMI command right after running ifup in the guest. I couldn't reproduce in the above fashion. Perhaps the CPU load at boot makes this more likely to occur, as it reproduces reliably for me. Test on Kernel 3.10.0-514.el7.x86_64, hyperv-daemons-0-0.29.20160216git.el7.x86_64, I cannot reproduce this issue after try 5 times in local test enviroment (VM 1 CPU, 2G Memory with host Hyper-v server core 2016). Could you please use ip-injection.ps1 from attachment to check whether can reproduce in your enviroment? Test steps: 1. Install/import a RHEL 7.3 VM with a NIC on Hyper-V. 2. Set the NIC to use DHCP, #cat ifcfg-eth0 IPV6INIT="yes" DHCP_HOSTNAME="rhel7" BOOTPROTO="dhcp" DEVICE="eth0" ONBOOT="yes" #UUID="" 3. Shut down the VM. 4. Start the VM and immediately set a static IP by ip-injection.ps1 (execute "Get-VMNetworkAdapter -vmName xuli_rhel7.3 | ft ipaddresses", after just get vm ip, execute ./ip-injection.ps1 ). 5. View that it only shows static ip when checking by ifconfig. #cat ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none IPADDR0=192.168.1.12 NETMASK0=255.255.255.0 GATEWAY=192.168.1.1 DNS1=192.168.1.2 IPV6INIT=yes NM_CONTROLLED=no PEERDNS=yes ONBOOT=yes Created attachment 1221493 [details]
ip injection script
Created attachment 1221501 [details]
Modified IP injection script
I've modified the script, partly because it didn't execute for me, but also to ensure it reproduces the issue. Note that the injection must be done immediately after the VM reports an IP address.
To reproduce:
1. Configure the VM to use DHCP
2. Stop the VM
3. Run the script
In my case, this is the output (truncated), note the 2 IPv4 addresses for the first NIC:
__GENUS : 2
__CLASS : Msvm_GuestNetworkAdapterConfiguration
__SUPERCLASS :
__DYNASTY : Msvm_GuestNetworkAdapterConfiguration
__RELPATH : Msvm_GuestNetworkAdapterConfiguration.InstanceID="Microsoft:GuestNetwork\\37DF2DF8-2700-4E87-91F2-0A7E3202DAAE\\
663C9F90-1E91-4859-8B8D-CCB8DE1B4556"
__PROPERTY_COUNT : 8
__DERIVATION : {}
__SERVER : ZNEST159HV01
__NAMESPACE : root\virtualization\v2
__PATH : \\ZNEST159HV01\root\virtualization\v2:Msvm_GuestNetworkAdapterConfiguration.InstanceID="Microsoft:GuestNetwork\\
37DF2DF8-2700-4E87-91F2-0A7E3202DAAE\\663C9F90-1E91-4859-8B8D-CCB8DE1B4556"
DefaultGateways : {}
DHCPEnabled : True
DNSServers : {172.20.0.95, 172.20.0.96}
InstanceID : Microsoft:GuestNetwork\37DF2DF8-2700-4E87-91F2-0A7E3202DAAE\663C9F90-1E91-4859-8B8D-CCB8DE1B4556
IPAddresses : {fe80::215:5dff:fecd:3329}
IPAddressOrigins : {}
ProtocolIFType : 4097
Subnets : {/64}
PSComputerName : ZNEST159HV01
Operation completed successfully
VMName Name MacAddress IPAddresses VirtualSubnetId
------ ---- ---------- ----------- ---------------
RHEL Network Adapter 00155DCD3329 {172.20.205.109, 172.2... 0
RHEL Network Adapter 00155DCD332A {172.20.205.120, fe80:... 0
Retest this bug on RHEL 7 kernel with 3.10.0-957.el7.x86_64 build by following https://bugzilla.redhat.com/show_bug.cgi?id=1395178#c6, still cannot reproduce this issue. When use "ip injection script" in attachment, need to remove VM's snapshot, and only one network-adapter. Also tried add "Start-vm ----- write-host "done" to my ip injection script, still cannot reproduce this issue. When use modified "ip injection script" from Yonatan, get error "GuestNetworkAdapterConfiguration not found for nic", this is script issue. Hi Yonatan, I will close this bug based on cannot reproduce. If you disagree, please feel free to comment on this bug. Thank you so much. Best Regards, Xuemin |