-
Notifications
You must be signed in to change notification settings - Fork 75
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
Drop usage of virtinterfaced #1782
Drop usage of virtinterfaced #1782
Conversation
Our bots images still have |
cde6d88
to
0e703fe
Compare
On TF, TestMachinesNetworks.testNetworksCreate fails. I also get that locally, plus a whole lot of other failures which don't look related to Added fix. |
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.
Not convinced at all that "nothing uses this":
getBootOrderDevices
uses vm.interfaces which seems to come from this reducer state if I am reading this correctly:
And used here:
} else if (boot.type === "network") {
const dev = ifaces[0];
if (dev) {
ifaces.splice(0, 1);
devices.push({
device: dev,
bootOrder: i + 1, // bootOrder begins at 1
type: "network"
});
}
}
Sure, but there's no doubt about a VM having a list of network interfaces. virtinterfaced is tracking the host's network interface. As far as I understand the deprecation announcement, the main use case was
... and the only place which does that is that test helper I could of course misunderstand all of this. @KKoukiou do you remember something about this? |
The problem here is that I cannot read :)
And that component does not use Next up remove |
dc07a76
to
95d35ce
Compare
This comment was marked as outdated.
This comment was marked as outdated.
I assume this means host network devices that could be used by VMs, right? Most commonly, that means a bridge type device. For reference, I think this is how virt-manager handles that (see lines 42-110) https://github.com/virt-manager/virt-manager/blob/main/virtinst/devices/interface.py#L94 Disclaimer: I'm slightly familiar with virt-manager code, but far from an expert :-) |
95d35ce
to
f22e922
Compare
@jfehlig Thanks for the pointer! But |
The terminology is starting to confuse me. Let's clarify it :-). https://libvirt.org/html/libvirt-libvirt-network.html https://libvirt.org/html/libvirt-libvirt-interface.html https://libvirt.org/formatdomain.html#network-interfaces Ok, back to the topic. virt-manager can be used to create/manage libvirt virtual networks. It cannot be used to create/manage any host network interface devices. The virt-manager code I referenced is used to find a host network interface of type 'bridge', which will then be displayed as a possible network to attach virtual interface(s) of new VMs. By default, virt-manager prefers connecting virtual interfaces to a bridge, but the list of possible networks will include any active libvirt virtual networks too. If no bridge is found, virt-manager doesn't provide a way to create one. It simply excludes 'bridge device' from the list of possible networks. IIUC, that code is used to populate the 'Network selection' list I mentioned above. E.g. the list shown on step 5 of 5 of the new VM wizard. |
test/check-machines-networks
Outdated
|
||
return device | ||
def getNetworkDefaultRouteDevice(m): | ||
routes = json.loads(m.execute("ip --json route show default")) |
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.
Is show default
needed here? At least on fedora 40 and tumbleweed, the test will pass if you use ip --json route
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.
Yes, but only by happenstance -- as soon as you have more than one route, and the default one isn't the first one, that will fail. I'd rather make it explicit.
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 see. That's a fair point
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 seems the problem is that there is no default route on those test systems at this point. The previous code did not pick a specific interface, just any first one, not even enabled. On one system here the first virsh command would have picked "lo". Does routing to outside the host actually need to work? If yes, then which destination? As example 127.0.0.1 then ip --json route get 127.0.0.1
. If not then maybe hard coding "lo" is fine.
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.
Ah, indeed -- it failed, as I locally tested in an inadequate way.
My main issue is that I have not the slightest idea what this operation in the test actually does -- it creates a libvirt network with a <dev>
node, which happens to be "eth0" or "eth1". I assume this creates a bridge which forwards its traffic to the given host device? But then "lo" doesn't make much sense, does it?
So indeed I'll just drop the default
here, that'll also pick "eth0". I don't know what exactly this does, but at least it stays compatible 😅
For the record -- this is way more involved than it initially looked. This was a quick attempt, but it apparently needs someone who actually has a clue about c-machines/libvirt. So it's back in my long queue of "fix someday", or "we need a c-machines maintainer again". 😢 |
I looked into this a bit and created a draft for replicating the old behavior with the |
f22e922
to
68ec0e9
Compare
Thanks @Nykseli ! I merged (conceptually, not git) the two MRs. I started with your commit, fixed up some things (like parsing MAC and Active properties), and added back the packaging updates. I also triggered a run against the tumbleweed refresh. |
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.
Small cleanup request
virtinterfaced is being deprecated [1], and at least some distros want to get rid of the dependency. Replace it with reading `ip --json a` instead to get all the interface names. Fixes cockpit-project#1777 [1] https://listman.redhat.com/archives/libvir-list/2020-December/msg00183.html Co-Authored-By: Martin Pitt <[email protected]>
68ec0e9
to
b8b3be2
Compare
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.
This replacement is reasonable considering the virtinterfaced is so undermaintained and causes visible crashes.
Let me know if you want me to review the code as well.
} catch (ex) { | ||
console.log('listInactiveInterfaces action for path', objPath, ex.toString()); | ||
console.warn("Failed to get interfaces with ip command:", ex.toString()); |
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.
This added line is not executed by any test.
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.
Can't tell if the debian failure is a flake or not, if not feel free to merge
Our tests are all green. Seems packit's TF integration is AWOL today -- but I feel comfortable to ignore, the previous version was all green, and the diff was just that little code cleanup. |
Sorry for the late response, but I don't have anything to add anyhow other than thanks a lot for resolving this issue! |
virtinterfaced is being deprecated [1], and at least some distros want
to get rid of the dependency.
Replace it with reading
ip --json a
instead to get all the interfacenames.
Fixes #1777
[1] https://listman.redhat.com/archives/libvir-list/2020-December/msg00183.html