-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
virt-handler, Add infoSource field to vmi status #6793
Conversation
/uncc @jean-edouard @yuhaohaoyu |
/test pull-kubevirt-check-unassigned-tests |
/test pull-kubevirt-unit-test |
75d5134
to
43a66d2
Compare
/cc @EdDev |
Could you paste some examples of what the status representation will look like, so its easier to visualize ? As is, I am unsure I understand what you're proposing. |
An interface where the domain and guest-agent both know to interface (usually the case)
Now if you change the mac of the interface in the guest itself, the situation will be (before this PR)
This PR suggest to add the infoSource field as follows
You can see here the 3 possible values of the new field. |
- infoSource: domain
mac: 02:1e:d6:00:00:6b
name: br10-vlan100-network
- infoSource: guest-agent
interfaceName: eth1
ipAddress: 10.200.0.1
ipAddresses:
- 10.200.0.1
- fe80::1e:d6ff:fe00:6b
mac: 02:00:b5:b5:b5:c9 But do the above 2 entries refer to the same entity ? From your PR's description, I think so. How can I - or anything that reads the interface status - infer that @oshoval ? AFAIU, there isn't any attribute there to map them together. Probably if you add a more complete example I'll understand. |
@@ -249,11 +250,13 @@ func MergeAgentStatusesWithDomainData(domInterfaces []api.Interface, interfaceSt | |||
} | |||
|
|||
aliasesCoveredByAgent := []string{} | |||
// Add alias from domain to interfaceStatus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this comment removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because now it adds also the InfoSource not just the alias,so it is outdated (and code is self explanatory about those 2)
@@ -158,14 +159,18 @@ func (c *NetStat) UpdateStatus(vmi *v1.VirtualMachineInstance, domain *api.Domai | |||
// Remove the interface from domainInterfaceStatusByMac to mark it as handled | |||
if interfaceStatus, exists := domainInterfaceStatusByMac[interfaceMAC]; exists { | |||
newInterface.InterfaceName = interfaceStatus.InterfaceName | |||
newInterface.InfoSource = interfaceStatus.InfoSource |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the InfoSource
information from interfaceStatus
, isn't it obvious the InfoSource
here is InfoSourceDomainAndGA
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the merge has one of 3 values:
- domain
InfoSourceDomain
guest-agent(can't be in this specific line, because we know we are iterating the spec)- domain and guest-agent (
InfoSourceDomainAndGA
)
then there are two options left 1 and 3, not just InfoSourceDomainAndGA
(option 3)
@@ -180,6 +185,7 @@ func (c *NetStat) UpdateStatus(vmi *v1.VirtualMachineInstance, domain *api.Domai | |||
IP: domainInterfaceStatus.Ip, | |||
IPs: domainInterfaceStatus.IPs, | |||
InterfaceName: domainInterfaceStatus.InterfaceName, | |||
InfoSource: domainInterfaceStatus.InfoSource, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, it is obvious the InfoSource
is InfoSourceGuestAgent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but delegated it to the one that calculate it atm (the merger), here we just copied the result (we can do it explicit if needed)
for i, interfaceStatus := range interfaceStatuses { | ||
if alias, exists := aliasByMac[interfaceStatus.Mac]; exists { | ||
interfaceStatuses[i].Name = alias | ||
interfaceStatuses[i].InfoSource = netvmispec.InfoSourceDomainAndGA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the InfoSource
information here is redundant, please refer to the comments of netstat.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to move the whole logic to netstat.go
We need first this fix #6926
(which isn't enough by it's own, see example below)
I tried to start with it, and saw that it uncover the leakage in case the mac is changed
#6744 (last comment shows it)
As discussed also previously in this PR, there are couple place that are doing merges,
we can do an effort in the future to refactor them, meanwhile i prefer to keep the current logic please if possible, as it is more self contained in the current state of the code.
This change would be bit delicate, wider, and with some gotchas so I think it deserves a separate PR.
For example I tried to take #6926 + #6744 + this PR and check what happens:
We would still have the zombie ips as last comment of 6744 shows
We can see here that the ips are added because they appear in the pod, the merge code "protects"
and we would need to protect in a different method if we remove it (remove the code of 6744):
interfaces:
- infoSource: domain
ipAddress: 10.244.140.77
ipAddresses:
- 10.244.140.77
- fd10:244::8c4c
mac: "02:00:05:05:05:05"
name: default
- infoSource: guest-agent
interfaceName: eth0
ipAddress: 10.244.140.77
ipAddresses:
- 10.244.140.77
- fe80::5ff:fe05:505
mac: 02:00:b5:b5:b5:b5
Another reason is that Edy is already working on improving the updateStatus
, and it's test coverage,
I think it will be safer and easier to refactor the virt-launcher merger and updateStatus
once we have his PRs merged.
// Do not update if interface has Masquerede binding | ||
// virt-controller should update VMI status interface with Pod IP instead | ||
if !isForwardingBindingInterface { | ||
newInterface.IP = interfaceStatus.Ip | ||
newInterface.IPs = interfaceStatus.IPs | ||
} | ||
delete(domainInterfaceStatusByMac, interfaceMAC) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, currently this else
is redundant since domainInterfaceStatusByMac
represents both the guet agent + libvirt domain interfaces. So even interfaces the are not reported y the ga by reported by libvirt will be there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is true only if there is guest agent, if there isn't (or even if there is but until the first report of it) then we do need this else
as the whole merge won't be called and we will need to set the infoSource ourself, because the interface won't be found on domainInterfaceStatusByMac
}}, | ||
} | ||
|
||
netStat.UpdateStatus(vmi, domain) | ||
|
||
Expect(vmi.Status.Interfaces).To(Equal([]v1.VirtualMachineInstanceNetworkInterface{ | ||
newVMIStatusIface(networkName, nil, ifaceMAC, guestIfaceName), | ||
newVMIStatusIface(networkName, nil, ifaceMAC, guestIfaceName, netvmispec.InfoSourceDomainAndGA), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a test with InfoSourceDomain
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see this please
https://github.com/kubevirt/kubevirt/pull/6793/files#diff-1c532caac99cc080ba1fb740c75c0ff712ca91509093f55cebdfaefee06ae887R287
same file line 287 if link doesnt open
/sig network |
/approve I"m waiting for a follow-up PR removing the non guest agent information from the merge as #6744 intended to do, |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AlonaKaplan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks CI has some problems fetching from quay / github, will retest soon |
/retest still |
/retest |
1 similar comment
/retest |
/retest |
Since two networks can use the same network attachement defintion, allow MultusNetwork to specify the network name in addition to the nad name. This way more than one network can be created using the same nad. Signed-off-by: Or Shoval <oshoval@redhat.com>
In case of MAC change in the guest, the vmi status will present two interfaces, one based on the domain spec, and one based on the guest agent (if it exists). The reason is that the MAC address is used in order to match the interface of the domain spec with the interfaces reported by the guest agent. Once the MAC is changed, this matching can't be performed. In order to make the info easier to understand, add a new field to each interface in vmi.status. infoSource field has 3 possible values: 1. domain - info is based on the domain spec 2. guest-agent - info is based on guest agent report 3. domain, guest-agent - info is based on both domain spec and guest agent report. Signed-off-by: Or Shoval <oshoval@redhat.com>
rebased |
/test pull-kubevirt-check-tests-for-flakes |
/retest |
/test pull-kubevirt-e2e-kind-1.22-sriov for some reason CI didnt run it for 18 hours |
/retest |
1 similar comment
/retest |
/cherry-pick release-0.49 |
@oshoval: new pull request created: #7034 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
In case of MAC change in the guest,
the vmi status will present two interfaces,
one based on the domain spec, and one based on the
guest agent (if it exists).
The reason is that the MAC address is used in order
to match the interface of the domain spec with the
interfaces reported by the guest agent.
Once the MAC is changed, this matching can't be performed.
In order to make the info easier to understand,
add a new field to each interface in vmi.status.
infoSource field has 3 possible values:
and guest agent report.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2013455
Special notes for your reviewer:
User Guide PR: kubevirt/user-guide#504
Release note: