diff --git a/packaging/cockpit-machines.spec.in b/packaging/cockpit-machines.spec.in index f68c0793f..dbb6df217 100644 --- a/packaging/cockpit-machines.spec.in +++ b/packaging/cockpit-machines.spec.in @@ -43,7 +43,6 @@ Requires: libvirt-daemon-driver-qemu Requires: libvirt-daemon-driver-network Requires: libvirt-daemon-driver-nodedev Requires: libvirt-daemon-driver-storage-core -Requires: (libvirt-daemon-driver-interface if virt-install) Requires: (libvirt-daemon-config-network if virt-install) Recommends: libvirt-daemon-driver-storage-disk %if 0%{?rhel} diff --git a/src/actions/store-actions.js b/src/actions/store-actions.js index 33c382dc2..381a95e5a 100644 --- a/src/actions/store-actions.js +++ b/src/actions/store-actions.js @@ -26,7 +26,6 @@ import { UNDEFINE_NETWORK, UNDEFINE_STORAGE_POOL, UNDEFINE_VM, - UPDATE_ADD_INTERFACE, UPDATE_ADD_NETWORK, UPDATE_ADD_NODE_DEVICE, UPDATE_ADD_STORAGE_POOL, @@ -141,13 +140,6 @@ export function updateDomainSnapshots({ connectionName, domainPath, snaps }) { }; } -export function updateOrAddInterface(props) { - return { - type: UPDATE_ADD_INTERFACE, - payload: { iface: props }, - }; -} - export function updateOrAddNetwork(props, updateOnly) { return { type: UPDATE_ADD_NETWORK, diff --git a/src/app.jsx b/src/app.jsx index 9501073b6..dc480a26a 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -247,7 +247,7 @@ class AppActive extends React.Component { } render() { - const { vms, config, storagePools, systemInfo, ui, networks, nodeDevices, interfaces } = store.getState(); + const { vms, config, storagePools, systemInfo, ui, networks, nodeDevices } = store.getState(); const { path, cloudInitSupported, downloadOSSupported, unattendedSupported, unattendedUserLogin, virtInstallAvailable } = this.state; const combinedVms = [...vms, ...dummyVmsFilter(vms, ui.vms)]; const properties = { @@ -337,7 +337,6 @@ class AppActive extends React.Component { ui={ui} libvirtVersion={systemInfo.libvirtVersion} storagePools={storagePools} - interfaces={interfaces} networks={networks} actions={vmActions} resourceHasError={this.state.resourceHasError} diff --git a/src/constants/store-action-types.js b/src/constants/store-action-types.js index 561a85124..08a6cda74 100644 --- a/src/constants/store-action-types.js +++ b/src/constants/store-action-types.js @@ -30,7 +30,6 @@ export const SET_NODE_MAX_MEMORY = "SET_NODE_MAX_MEMORY"; export const UNDEFINE_NETWORK = "UNDEFINE_NETWORK"; export const UNDEFINE_STORAGE_POOL = "UNDEFINE_STORAGE_POOL"; export const UNDEFINE_VM = "UNDEFINE_VM"; -export const UPDATE_ADD_INTERFACE = "UPDATE_ADD_INTERFACE"; export const UPDATE_ADD_NETWORK = "UPDATE_ADD_NETWORK"; export const UPDATE_ADD_NODE_DEVICE = "UPDATE_ADD_NODE_DEVICE"; export const UPDATE_ADD_VM = "UPDATE_ADD_VM"; diff --git a/src/helpers.js b/src/helpers.js index 0718740ae..dacc357e1 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -683,23 +683,17 @@ export function getStorageVolumesUsage(vms, storagePool) { /** * Returns a list of potential physical devices suitable as network devices - * by merging all network node devices and interfaces. * * @returns {array} */ export function getNetworkDevices() { - const { nodeDevices, interfaces } = store.getState(); const devs = []; - nodeDevices.forEach(dev => { + store.getState().nodeDevices.forEach(dev => { if (dev.capability.type === "net") devs.push(dev.capability.interface); }); - interfaces.forEach(iface => { - devs.push(iface.name); - }); - const uniq = [...new Set(devs)]; uniq.sort(); diff --git a/src/libvirtApi/common.js b/src/libvirtApi/common.js index 327013332..ecea8d070 100644 --- a/src/libvirtApi/common.js +++ b/src/libvirtApi/common.js @@ -57,9 +57,6 @@ import { Enum, timeout, } from "../libvirtApi/helpers.js"; -import { - interfaceGetAll, -} from "../libvirtApi/interface.js"; import { networkGet, networkGetAll, @@ -455,7 +452,6 @@ export function getApiData({ connectionName }) { return Promise.allSettled([ domainGetAll({ connectionName }), storagePoolGetAll({ connectionName }), - interfaceGetAll({ connectionName }), networkGetAll({ connectionName }), nodeDeviceGetAll({ connectionName }), getNodeMaxMemory({ connectionName }), diff --git a/src/libvirtApi/interface.js b/src/libvirtApi/interface.js deleted file mode 100644 index a50f86be6..000000000 --- a/src/libvirtApi/interface.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of Cockpit. - * - * Copyright (C) 2021 Red Hat, Inc. - * - * Cockpit is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * Cockpit is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Cockpit; If not, see . - */ - -/* - * Provider for Libvirt using libvirt-dbus API. - * See https://github.com/libvirt/libvirt-dbus - */ -import store from '../store.js'; - -import { updateOrAddInterface } from '../actions/store-actions.js'; -import { parseIfaceDumpxml } from '../libvirt-xml-parse.js'; -import { call, Enum, timeout } from './helpers.js'; - -/* - * Read properties of a single Interface - * - * @param {object} objPath interface object path - * @param {string} connectionName - */ -export async function interfaceGet({ - id: objPath, - connectionName, -}) { - const props = {}; - - try { - const [resultProps] = await call(connectionName, objPath, 'org.freedesktop.DBus.Properties', 'GetAll', - ['org.libvirt.Interface'], { timeout, type: 's' }); - /* Sometimes not all properties are returned; for example when some network got deleted while part - * of the properties got fetched from libvirt. Make sure that there is check before reading the attributes. - */ - if ("Active" in resultProps) - props.active = resultProps.Active.v.v; - if ("MAC" in resultProps) - props.mac = resultProps.MAC.v.v; - if ("Name" in resultProps) - props.name = resultProps.Name.v.v; - props.id = objPath; - props.connectionName = connectionName; - - const [xml] = await call(connectionName, objPath, 'org.libvirt.Interface', 'GetXMLDesc', [0], { timeout, type: 'u' }); - const iface = parseIfaceDumpxml(xml); - store.dispatch(updateOrAddInterface(Object.assign(props, iface))); - } catch (ex) { - console.log('listInactiveInterfaces action for path', objPath, ex.toString()); - } -} - -export async function interfaceGetAll({ connectionName }) { - const flags = Enum.VIR_CONNECT_LIST_INTERFACES_ACTIVE | Enum.VIR_CONNECT_LIST_INTERFACES_INACTIVE; - - try { - const [ifaces] = await call(connectionName, '/org/libvirt/QEMU', 'org.libvirt.Connect', 'ListInterfaces', [flags], { timeout, type: 'u' }); - await Promise.all(ifaces.map(path => interfaceGet({ connectionName, id: path }))); - } catch (ex) { - console.warn('getAllInterfaces action failed:', ex.toString()); - throw ex; - } -} diff --git a/src/reducers.js b/src/reducers.js index 6f10a663a..73192a645 100644 --- a/src/reducers.js +++ b/src/reducers.js @@ -29,7 +29,6 @@ import { UNDEFINE_NETWORK, UNDEFINE_STORAGE_POOL, UNDEFINE_VM, - UPDATE_ADD_INTERFACE, UPDATE_ADD_NETWORK, UPDATE_ADD_NODE_DEVICE, UPDATE_ADD_VM, @@ -93,33 +92,6 @@ function lazyComposedReducer({ parentReducer, getSubreducer, getSubstate, setSub }; } -function interfaces(state, action) { - state = state || []; - - switch (action.type) { - case UPDATE_ADD_INTERFACE: { - const { iface } = action.payload; - - if (isObjectEmpty(iface)) - return [...state, iface]; // initialize iface to empty object - - const connectionName = iface.connectionName; - const index = getFirstIndexOfResource(state, 'name', iface.name, connectionName); - if (index < 0) { // add - const initObjIndex = state.findIndex(obj => isObjectEmpty(obj)); - if (initObjIndex >= 0) - state.splice(initObjIndex, 1); // remove empty initial object - return [...state, iface]; - } - - const updatedIface = Object.assign({}, state[index], iface); - return replaceResource({ state, updatedResource: updatedIface, index }); - } - default: - return state; - } -} - function networks(state, action) { state = state || []; @@ -428,7 +400,6 @@ export default combineReducers({ getSubstate: (state) => state.providerState, setSubstate: (state, subState) => Object.assign({}, state, { providerState: subState }), }), - interfaces, networks, nodeDevices, vms, diff --git a/test/browser/browser.sh b/test/browser/browser.sh index d98035425..e53ce55d7 100755 --- a/test/browser/browser.sh +++ b/test/browser/browser.sh @@ -67,7 +67,6 @@ sh -x test/vm.install if [ "${PLATFORM_ID:-}" != "platform:el8" ]; then # https://gitlab.com/libvirt/libvirt/-/issues/219 - systemctl start virtinterfaced.socket systemctl start virtnetworkd.socket systemctl start virtnodedevd.socket systemctl start virtstoraged.socket diff --git a/test/vm.install b/test/vm.install index 1761d08ee..d05bcc2d8 100755 --- a/test/vm.install +++ b/test/vm.install @@ -7,11 +7,6 @@ if grep -q 'ID=debian' /usr/lib/os-release; then echo '* soft core unlimited' >> /etc/security/limits.conf fi -if grep -q 'ID="opensuse' /usr/lib/os-release; then - # Make sure virtinterfaced.socket is enabled - systemctl enable --now virtinterfaced.socket -fi - systemctl enable cockpit.socket # don't force https:// (self-signed cert)