Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.4k
VMware: match nic mac for ip address fetch#10641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
559c011
match nic mac for ip address fetch
4a40b00
rename field to properly match usage
2726aca
rebase to 4.20 and adapt code to match other PR
0dd48f1
Merge branch '4.20' into fix-vmware-ip-loss
DaanHoogland 323eb1f
Merge branch '4.20' into fix-vmware-ip-loss
DaanHoogland 5f0e76f
Update UserVmManagerImpl.java
alexandru-bagu 33e0691
Merge branch '4.20' into fix-vmware-ip-loss
weizhouapache 97e8e94
Update plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/…
weizhouapache 230412d
fix ip fetch on L2 network
weizhouapache ccce3e9
Update server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
weizhouapache cddab12
Update plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/…
weizhouapache File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
17 changes: 13 additions & 4 deletions
17 ...hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -756,7 +756,7 @@ private class VmIpAddrFetchThread extends ManagedContextRunnable { | ||
| String networkCidr; | ||
| String macAddress; | ||
| public VmIpAddrFetchThread(long vmId, long nicId, String instanceName, boolean windows, Long hostId, String networkCidr, String macAddress) { | ||
| public VmIpAddrFetchThread(long vmId, String vmUuid, long nicId, String instanceName, boolean windows, Long hostId, String networkCidr, String macAddress) { | ||
| this.vmId = vmId; | ||
| this.vmUuid = vmUuid; | ||
| this.nicId = nicId; | ||
| @@ -778,8 +778,13 @@ protected void runInContext() { | ||
| Answer answer = _agentMgr.send(hostId, cmd); | ||
| if (answer.getResult()) { | ||
| String vmIp = answer.getDetails(); | ||
| if (NetUtils.isValidIp4(vmIp)) { | ||
| if (vmIp == null) { | ||
| // we got a valid response and the NIC does not have an IP assigned, as such we will update the database with null | ||
| if (nic.getIPv4Address() != null) { | ||
| nic.setIPv4Address(null); | ||
| _nicDao.update(nicId, nic); | ||
| } | ||
| } else if (NetUtils.isValidIp4(vmIp)) { | ||
| // set this vm ip addr in vm nic. | ||
| if (nic != null) { | ||
| nic.setIPv4Address(vmIp); | ||
| @@ -794,12 +799,8 @@ protected void runInContext() { | ||
| } | ||
| } | ||
| } else { | ||
| //previously vm has ip and nic table has ip address. After vm restart or stop/start | ||
weizhouapache marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| //if vm doesnot get the ip then set the ip in nic table to null | ||
| if (nic.getIPv4Address() != null) { | ||
| nic.setIPv4Address(null); | ||
| _nicDao.update(nicId, nic); | ||
| } | ||
| // since no changes are being done, we should not decrement IP usage | ||
| decrementCount = false; | ||
| if (answer.getDetails() != null) { | ||
| logger.debug("Failed to get vm ip for Vm [id: {}, uuid: {}, name: {}], details: {}", | ||
| vmId, vmUuid, vmName, answer.getDetails()); | ||
| @@ -2696,7 +2697,8 @@ protected void runInContext() { | ||
| VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(userVm); | ||
| VirtualMachine vm = vmProfile.getVirtualMachine(); | ||
| boolean isWindows = _guestOSCategoryDao.findById(_guestOSDao.findById(vm.getGuestOSId()).getCategoryId()).getName().equalsIgnoreCase("Windows"); | ||
| _vmIpFetchThreadExecutor.execute(new VmIpAddrFetchThread(vmId, nicId, vmInstance.getInstanceName(), | ||
| _vmIpFetchThreadExecutor.execute(new VmIpAddrFetchThread(vmId, vmInstance.getUuid(), nicId, vmInstance.getInstanceName(), | ||
| isWindows, vm.getHostId(), network.getCidr(), nicVo.getMacAddress())); | ||
| } | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.