mirror of
				https://gitlab.com/libvirt/libvirt.git
				synced 2025-11-03 08:24:18 +03:00 
			
		
		
		
	qemu: don't fill in nicindexes for session mode libvirtd
Commit4bbe1029ffixed a problem in commitf7afeddcby moving the call to virNetDevGetIndex() to a location common to all interface types (so that the nicindex array would be filled in for macvtap as well as tap interfaces), but the location was *too* common, as the original call to virNetDevGetIndex() had been in a section qualified by "if (cfg->privileged)". The result was that the "fixed" libvirtd would try to call virNetDevGetIndex() even for session mode libvirtd, and end up failing with the log message: Unable to open control socket: Operation not permitted To remedy that, this patch qualifies the call to virNetDevGetIndex() in its new location with cfg->privileged. This resolves https://bugzilla.redhat.com/show_bug.cgi?id=1198244 (cherry picked from commit705242f880)
This commit is contained in:
		@@ -7766,6 +7766,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
 | 
			
		||||
    char **tapfdName = NULL;
 | 
			
		||||
    char **vhostfdName = NULL;
 | 
			
		||||
    int actualType = virDomainNetGetActualType(net);
 | 
			
		||||
    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 | 
			
		||||
    virNetDevBandwidthPtr actualBandwidth;
 | 
			
		||||
    size_t i;
 | 
			
		||||
 | 
			
		||||
@@ -7841,7 +7842,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
 | 
			
		||||
        /* network and bridge use a tap device, and direct uses a
 | 
			
		||||
         * macvtap device
 | 
			
		||||
         */
 | 
			
		||||
        if (nicindexes && nnicindexes && net->ifname) {
 | 
			
		||||
        if (cfg->privileged && nicindexes && nnicindexes && net->ifname) {
 | 
			
		||||
            if (virNetDevGetIndex(net->ifname, &nicindex) < 0 ||
 | 
			
		||||
                VIR_APPEND_ELEMENT(*nicindexes, *nnicindexes, nicindex) < 0)
 | 
			
		||||
                goto cleanup;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user