├── .copr └── Makefile ├── .github └── workflows │ ├── ci.yml │ ├── codeql-analysis.yml │ ├── containers.yml │ ├── network.yml │ └── ost.yml ├── .gitignore ├── .reuse ├── dep5 └── templates │ └── vdsm.jinja2 ├── AUTHORS ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── COPYING ├── ChangeLog ├── LICENSES ├── Apache-2.0.txt ├── GPL-2.0-or-later.txt └── PSF-2.0.txt ├── Makefile.am ├── README.logging ├── README.md ├── autobuild.sh ├── autogen.sh ├── build-aux ├── Makefile.subs ├── gitlog-to-changelog ├── list-all-python-files ├── make-dist ├── pkg-version └── vercmp ├── ci ├── README ├── lint.sh ├── rpm.sh ├── tests-storage.sh └── tests.sh ├── commit-template.txt ├── configure.ac ├── contrib ├── Makefile.am ├── add-spdx-header.sh ├── block ├── create-gluster-volume.sh ├── create-vdo-brick.sh ├── deploy-gluster.sh ├── extend-stats ├── git-sync ├── install-pkg.sh ├── koji_build.sh ├── logdb ├── logstat ├── lvs-stats ├── nfs-check.py ├── profile-stats ├── refmt ├── repoplot ├── repostat ├── rhv_build.sh ├── runvm ├── shell_helper ├── target ├── vmconfig.json └── vmconfig.json.license ├── doc ├── Makefile ├── check-volume-leases.md ├── conf.py ├── development.md ├── guest-agent.md ├── incremental-backup.md ├── index.rst ├── io-timeouts.md ├── iscsi-server-setup.md ├── managed-volume.md ├── profile-vdsm-with-yappi.md └── thin-provisioning.md ├── docker ├── Dockerfile.alma-9 ├── Dockerfile.centos-9 ├── Makefile ├── lvmlocal.conf ├── network │ ├── Makefile │ ├── functional │ │ ├── Dockerfile.alma-9 │ │ └── Dockerfile.centos-9 │ ├── integration │ │ ├── Dockerfile.alma-9 │ │ └── Dockerfile.centos-9 │ └── unit │ │ ├── Dockerfile.alma-9 │ │ └── Dockerfile.centos-9 └── requirements.txt ├── execcmd-allowlist.txt ├── execcmd-allowlist.txt.license ├── helpers ├── Makefile.am ├── fallocate └── kvm2ovirt ├── init ├── Makefile.am ├── daemonAdapter ├── systemd │ ├── Makefile.am │ ├── unlimited-core.conf │ └── vdsm-tmpfiles.d.conf.in └── vdsmd_init_common.sh.in ├── lib ├── Makefile.am ├── dnf-plugins │ ├── Makefile.am │ └── vdsmupgrade.py ├── vdsm │ ├── API.py │ ├── Makefile.am │ ├── __init__.py │ ├── alignmentScan.py │ ├── api │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── schema_inconsistency_formatter.py │ │ ├── schema_to_html.py │ │ ├── schema_to_pickle.py │ │ ├── vdsm-api-gluster.yml │ │ ├── vdsm-api.yml │ │ ├── vdsm-events.yml │ │ └── vdsmapi.py │ ├── client.py │ ├── clientIF.py │ ├── common │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── api.py │ │ ├── base26.py │ │ ├── cache.py │ │ ├── cmdutils.py │ │ ├── commands.py │ │ ├── concurrent.py │ │ ├── config.py.in │ │ ├── constants.py.in │ │ ├── conv.py │ │ ├── cpuarch.py │ │ ├── define.py │ │ ├── dsaversion.py.in │ │ ├── errors.py │ │ ├── eventfd.py │ │ ├── exception.py │ │ ├── filecontrol.py │ │ ├── fileutils.py │ │ ├── function.py │ │ ├── hooks.py │ │ ├── hostdev.py │ │ ├── hostutils.py │ │ ├── libvirtconnection.py │ │ ├── lockfile.py │ │ ├── logutils.py │ │ ├── marks.py │ │ ├── nbdutils.py │ │ ├── network │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ └── address.py │ │ ├── osutils.py │ │ ├── panic.py │ │ ├── password.py │ │ ├── pki.py │ │ ├── proc.py │ │ ├── properties.py │ │ ├── pthread.py │ │ ├── response.py │ │ ├── sigutils.py │ │ ├── supervdsm.py │ │ ├── systemctl.py │ │ ├── systemd.py │ │ ├── threadlocal.py │ │ ├── time.py │ │ ├── udevadm.py │ │ ├── units.py │ │ ├── unixrpc.py │ │ ├── validate.py │ │ └── xmlutils.py │ ├── config.py │ ├── constants.py │ ├── cpuinfo.py │ ├── dmidecodeUtil.py │ ├── executor.py │ ├── gluster │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── api.py │ │ ├── apiwrapper.py │ │ ├── cli.py │ │ ├── events.py │ │ ├── exception.py │ │ ├── fence.py │ │ ├── fstab.py │ │ ├── gfapi.py │ │ ├── hooks.py │ │ ├── services.py │ │ ├── storagedev.py │ │ ├── tasks.py │ │ └── thinstorage.py │ ├── health.py │ ├── hook │ │ ├── Makefile.am │ │ ├── __init__.py │ │ └── hooking.py │ ├── host │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── api.py │ │ ├── caps.py │ │ ├── rngsources.py │ │ └── stats.py │ ├── hugepages.py │ ├── jobs.py │ ├── jsonrpcvdscli.py │ ├── kvm2ovirt.py │ ├── logUtils.py │ ├── machinetype.py │ ├── metrics │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── hawkular.py │ │ └── statsd.py │ ├── mkimage.py │ ├── moduleloader.py │ ├── momIF.py │ ├── network │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── api.py │ │ ├── bond_monitor.py │ │ ├── canonicalize.py │ │ ├── cmd.py │ │ ├── common │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── conversion_util.py │ │ │ └── switch_util.py │ │ ├── configurators │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ └── qos.py │ │ ├── connectivity.py │ │ ├── dhcp_monitor.py │ │ ├── dns.py │ │ ├── driverloader.py │ │ ├── errors.py │ │ ├── ethtool.py │ │ ├── initializer.py │ │ ├── ip │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── address.py │ │ │ └── validator.py │ │ ├── ipwrapper.py │ │ ├── kernelconfig.py │ │ ├── link │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── bond │ │ │ │ ├── Makefile.am │ │ │ │ ├── __init__.py │ │ │ │ ├── bond_speed.py │ │ │ │ ├── sysfs_driver.py │ │ │ │ ├── sysfs_options.py │ │ │ │ └── sysfs_options_mapper.py │ │ │ ├── bridge.py │ │ │ ├── iface.py │ │ │ ├── nic.py │ │ │ ├── setup.py │ │ │ ├── sriov.py │ │ │ ├── stats.py │ │ │ ├── validator.py │ │ │ └── vlan.py │ │ ├── lldp │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── info.py │ │ │ └── lldpad.py │ │ ├── lldpad │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ └── lldptool.py │ │ ├── netconfpersistence.py │ │ ├── netinfo │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── addresses.py │ │ │ ├── bonding.py │ │ │ ├── bridges.py │ │ │ ├── cache.py │ │ │ ├── nics.py │ │ │ ├── qos.py │ │ │ └── routes.py │ │ ├── netlink │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── addr.py │ │ │ ├── libnl.py │ │ │ ├── link.py │ │ │ ├── monitor.py │ │ │ ├── route.py │ │ │ └── waitfor.py │ │ ├── netstats.py │ │ ├── netswitch │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── configurator.py │ │ │ └── validator.py │ │ ├── nmstate │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── api.py │ │ │ ├── bond.py │ │ │ ├── bridge_util.py │ │ │ ├── dns.py │ │ │ ├── ip.py │ │ │ ├── linux_bridge.py │ │ │ ├── ovs │ │ │ │ ├── Makefile.am │ │ │ │ ├── __init__.py │ │ │ │ ├── info.py │ │ │ │ └── network.py │ │ │ ├── route.py │ │ │ ├── schema.py │ │ │ ├── sriov.py │ │ │ └── state.py │ │ ├── ovn.py │ │ ├── restore_net_config.py │ │ ├── sysctl.py │ │ ├── tc │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── _parser.py │ │ │ ├── _wrapper.py │ │ │ ├── cls.py │ │ │ ├── filter.py │ │ │ └── qdisc.py │ │ └── validator.py │ ├── numa.py │ ├── osinfo.py │ ├── ppc64HardwareInfo.py │ ├── profiling │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── cpu.py │ │ ├── errors.py │ │ ├── memory.py │ │ └── profile.py │ ├── protocoldetector.py │ ├── rpc │ │ ├── Bridge.py │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── bindingjsonrpc.py │ │ └── http.py │ ├── schedule.py │ ├── sslutils.py │ ├── storage │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── asyncevent.py │ │ ├── asyncutils.py │ │ ├── backends.py │ │ ├── bitmaps.py │ │ ├── blkdiscard.py │ │ ├── blockSD.py │ │ ├── blockVolume.py │ │ ├── blockdev.py │ │ ├── check.py │ │ ├── clusterlock.py │ │ ├── constants.py │ │ ├── curl-img-wrap │ │ ├── curlImgWrap.py │ │ ├── devicemapper.py │ │ ├── directio.py │ │ ├── dispatcher.py │ │ ├── dmsetup.py │ │ ├── exception.py │ │ ├── fallocate.py │ │ ├── fc-scan │ │ ├── fileSD.py │ │ ├── fileUtils.py │ │ ├── fileVolume.py │ │ ├── formatconverter.py │ │ ├── fsutils.py │ │ ├── fuser.py │ │ ├── glance.py │ │ ├── glusterSD.py │ │ ├── glusterVolume.py │ │ ├── guarded.py │ │ ├── hba.py │ │ ├── hsm.py │ │ ├── image.py │ │ ├── imageSharing.py │ │ ├── imagetickets.py │ │ ├── iscsi.py │ │ ├── iscsiadm.py │ │ ├── localFsSD.py │ │ ├── lsof.py │ │ ├── lvm.env.in │ │ ├── lvm.py │ │ ├── lvmconf.py │ │ ├── lvmdevices.py │ │ ├── lvmfilter.py │ │ ├── mailbox.py │ │ ├── managedvolume-helper │ │ ├── managedvolume.py │ │ ├── managedvolumedb.py │ │ ├── merge.py │ │ ├── misc.py │ │ ├── monitor.py │ │ ├── mount.py │ │ ├── mpathconf.py │ │ ├── mpathhealth.py │ │ ├── multipath.py │ │ ├── nbd.py │ │ ├── nfsSD.py │ │ ├── nos_brick.py │ │ ├── operation.py │ │ ├── outOfProcess.py │ │ ├── persistent.py │ │ ├── protect │ │ │ ├── Makefile.am │ │ │ ├── spmprotect.sh.in │ │ │ └── spmstop.sh │ │ ├── qemuimg.py │ │ ├── resourceFactories.py │ │ ├── resourceManager.py │ │ ├── rwlock.py │ │ ├── sanlock_direct.py │ │ ├── sanlockconf.py │ │ ├── sd.py │ │ ├── sdc.py │ │ ├── sdm │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── api │ │ │ │ ├── Makefile.am │ │ │ │ ├── __init__.py │ │ │ │ ├── add_bitmap.py │ │ │ │ ├── amend_volume.py │ │ │ │ ├── base.py │ │ │ │ ├── clear_bitmaps.py │ │ │ │ ├── copy_data.py │ │ │ │ ├── merge.py │ │ │ │ ├── move_device.py │ │ │ │ ├── reduce_domain.py │ │ │ │ ├── remove_bitmap.py │ │ │ │ ├── sparsify_volume.py │ │ │ │ └── update_volume.py │ │ │ └── volume_info.py │ │ ├── securable.py │ │ ├── sp.py │ │ ├── spbackends.py │ │ ├── spwd.py │ │ ├── storageServer.py │ │ ├── sysfs.py │ │ ├── task.py │ │ ├── taskManager.py │ │ ├── threadPool.py │ │ ├── transientdisk.py │ │ ├── utils.py │ │ ├── validators.py │ │ ├── vdsm_lvm_rules.template.in │ │ ├── volume.py │ │ ├── volumemetadata.py │ │ ├── workarounds.py │ │ └── xlease.py │ ├── supervdsm_api │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── devicemapper.py │ │ ├── dmsetup.py │ │ ├── hwinfo.py │ │ ├── ksm.py │ │ ├── lsof.py │ │ ├── managedvolume.py │ │ ├── mkimage.py │ │ ├── multipath.py │ │ ├── nbd.py │ │ ├── network.py │ │ ├── sanlock_direct.py │ │ ├── saslpasswd2.py │ │ ├── systemctl.py │ │ ├── test.py │ │ ├── udev.py │ │ └── virt.py │ ├── supervdsm_server.py │ ├── taskset.py │ ├── throttledlog.py │ ├── tool │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── check_volume_leases.py │ │ ├── common.py │ │ ├── config_lvm_filter.py │ │ ├── configfile.py │ │ ├── configurator.py │ │ ├── configurators │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── bond_defaults.py │ │ │ ├── certificates.py │ │ │ ├── libvirt.py │ │ │ ├── lvm.py │ │ │ ├── managedvolumedb.py │ │ │ ├── multipath.py │ │ │ ├── passwd.py │ │ │ ├── sanlock.py │ │ │ └── sebool.py │ │ ├── confmeta.py │ │ ├── confutils.py │ │ ├── dummybr.py │ │ ├── dump_volume_chains.py │ │ ├── network.py │ │ ├── nwfilter.py │ │ ├── register.py │ │ ├── service.py │ │ ├── transient.py │ │ ├── upgrade.py │ │ ├── vdsm-id.py │ │ ├── vdsm_config.py │ │ └── xleases.py │ ├── utils.py │ ├── v2v.py │ ├── vdsmd.py │ ├── virt │ │ ├── Makefile.am │ │ ├── __init__.py │ │ ├── backup.py │ │ ├── blockjob.py │ │ ├── cpumanagement.py │ │ ├── displaynetwork.py │ │ ├── domain_descriptor.py │ │ ├── domxml_preprocess.py │ │ ├── errors.py │ │ ├── events.py │ │ ├── externaldata.py │ │ ├── filedata.py │ │ ├── guestagent.py │ │ ├── guestagenthelpers.py │ │ ├── jobs │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── seal.py │ │ │ └── snapshot.py │ │ ├── libvirthook │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ └── vm_libvirt_hook.py │ │ ├── libvirtnetwork.py │ │ ├── libvirtxml.py │ │ ├── livemerge.py │ │ ├── metadata.py │ │ ├── migration.py │ │ ├── periodic.py │ │ ├── qemuguestagent.py │ │ ├── recovery.py │ │ ├── sampling.py │ │ ├── saslpasswd2.py │ │ ├── secret.py │ │ ├── thinp.py │ │ ├── utils.py │ │ ├── virdomain.py │ │ ├── vm.py │ │ ├── vmchannels.py │ │ ├── vmdevices │ │ │ ├── Makefile.am │ │ │ ├── __init__.py │ │ │ ├── common.py │ │ │ ├── compat.py │ │ │ ├── core.py │ │ │ ├── drivename.py │ │ │ ├── graphics.py │ │ │ ├── hostdevice.py │ │ │ ├── hwclass.py │ │ │ ├── lease.py │ │ │ ├── lookup.py │ │ │ ├── network.py │ │ │ ├── storage.py │ │ │ └── storagexml.py │ │ ├── vmexitreason.py │ │ ├── vmpowerdown.py │ │ ├── vmstats.py │ │ ├── vmstatus.py │ │ ├── vmtune.py │ │ ├── vmxml.py │ │ └── xmlconstants.py │ ├── virtsparsify.py │ └── virtsysprep.py ├── vdsmclient │ ├── Makefile.am │ ├── __init__.py │ └── client.py └── yajsonrpc │ ├── Makefile.am │ ├── __init__.py │ ├── betterAsyncore.py │ ├── exception.py │ ├── jsonrpcclient.py │ ├── stomp.py │ ├── stompclient.py │ └── stompserver.py ├── m4 └── ax_python_module.m4 ├── pylintrc ├── pyproject.toml ├── static ├── Makefile.am ├── etc │ ├── NetworkManager │ │ └── conf.d │ │ │ └── vdsm.conf │ ├── cron.hourly │ │ └── vdsm-logrotate │ ├── libvirt │ │ └── hooks │ │ │ └── qemu │ ├── modprobe.d │ │ └── vdsm-bonding-modprobe.conf │ ├── modules-load.d │ │ └── vdsm.conf │ ├── ovirt-imageio │ │ └── conf.d │ │ │ └── 60-vdsm.conf │ ├── pki │ │ └── vdsm │ │ │ └── keys │ │ │ ├── libvirt_password │ │ │ └── libvirt_password.license │ ├── security │ │ └── limits.d │ │ │ └── 99-vdsm.conf │ ├── sudoers.d │ │ └── 50_vdsm.in │ ├── sysctl.d │ │ └── vdsm.conf │ └── vdsm │ │ ├── logger.conf.in │ │ ├── logrotate │ │ └── vdsm │ │ ├── mom.conf.in │ │ ├── mom.d │ │ ├── 00-defines.policy │ │ ├── 01-parameters.policy │ │ ├── 02-balloon.policy │ │ ├── 03-ksm.policy │ │ ├── 04-cputune.policy │ │ └── 05-iotune.policy │ │ └── svdsm.logger.conf.in ├── libexec │ └── vdsm │ │ ├── get-conf-item │ │ ├── sitecustomize.py │ │ ├── supervdsmd │ │ ├── vdsm-gencerts.sh.in │ │ └── vdsmd └── usr │ ├── bin │ ├── vdsm-client │ └── vdsm-tool │ ├── lib │ └── systemd │ │ └── system │ │ ├── dev-hugepages1G.mount │ │ ├── mom-vdsm.service.in │ │ ├── supervdsmd.service.in │ │ ├── vdsm-network.service.in │ │ └── vdsmd.service.in │ └── share │ ├── man │ ├── man1 │ │ ├── vdsm-client.1 │ │ └── vdsm-tool.1.in │ └── man8 │ │ └── vdsmd.8.in │ ├── polkit-1 │ └── rules.d │ │ └── 10-vdsm-libvirt-access.rules │ └── vdsm │ ├── autounattend │ └── Autounattend.xml.in │ └── lvmlocal.conf ├── tests ├── API_test.py ├── Makefile.am ├── README.md ├── alignmentscan_test.py ├── apiData.py ├── api_response_test.py ├── better_asyncore_test.py ├── caps_libvirt_amd_6274.out ├── caps_libvirt_ibm_S822L.out ├── caps_libvirt_ibm_S822L_le.out ├── caps_libvirt_intel_E31220.out ├── caps_libvirt_intel_E5606.out ├── caps_libvirt_intel_E5649.out ├── caps_libvirt_intel_i73770.out ├── caps_libvirt_intel_i73770_nosnap.out ├── caps_libvirt_multiqemu.out ├── caps_libvirt_s390x.out ├── caps_numactl_4_nodes.out ├── caps_numactl_4_nodes.out.license ├── caps_test.py ├── check_distpkg.sh ├── check_imports.py ├── check_rpms.sh ├── clientif_test.py ├── cmdutils_test.py ├── common │ ├── __init__.py │ ├── cache_test.py │ ├── cmdutils_test.py │ ├── commands_test.py │ ├── concurrent_test.py │ ├── fileutils_test.py │ ├── fileutils_tests_qemu.conf │ ├── function_test.py │ ├── hostutils_test.py │ ├── libvirtconnection_test.py │ ├── logutils_test.py │ ├── network_test.py │ ├── osutils_test.py │ ├── proc_test.py │ ├── properties_test.py │ ├── pthread_test.py │ ├── systemctl_test.py │ ├── systemd_test.py │ ├── time_test.py │ └── validate_test.py ├── conf │ └── svdsm.logger.conf ├── config_test.py ├── conftest.py ├── cpu_info.out ├── cpu_profile_test.py ├── cpuinfo │ ├── cpuinfo_E5649_x86_64.out │ ├── cpuinfo_POWER8E_ppc64le.out │ ├── cpuinfo_aarch64.out │ ├── cpuinfo_z14_s390x.out │ └── cpuinfo_z196_s390x.out ├── cpuinfo_test.py ├── devices │ ├── __init__.py │ ├── data │ │ ├── block_sda_ssd.xml │ │ ├── block_sda_ssd.xml.license │ │ ├── computer.xml │ │ ├── computer.xml.license │ │ ├── devicetree.xml │ │ ├── devicetree.xml.license │ │ ├── net_em1_28_d2_44_55_66_88.xml │ │ ├── net_em1_28_d2_44_55_66_88.xml.license │ │ ├── pci_0000_00_02_0.xml │ │ ├── pci_0000_00_02_0.xml.license │ │ ├── pci_0000_00_09_0.xml │ │ ├── pci_0000_00_09_0.xml.license │ │ ├── pci_0000_00_19_0.xml │ │ ├── pci_0000_00_19_0.xml.license │ │ ├── pci_0000_00_1a_0.xml │ │ ├── pci_0000_00_1a_0.xml.license │ │ ├── pci_0000_00_1b_0.xml │ │ ├── pci_0000_00_1b_0.xml.license │ │ ├── pci_0000_00_1f_2.xml │ │ ├── pci_0000_00_1f_2.xml.license │ │ ├── pci_0000_05_00_1.xml │ │ ├── pci_0000_05_00_1.xml.license │ │ ├── pci_0000_05_10_7.xml │ │ ├── pci_0000_05_10_7.xml.license │ │ ├── pci_0000_06_00_0.xml │ │ ├── pci_0000_06_00_0.xml.license │ │ ├── scsi_0_0_0_0.xml │ │ ├── scsi_0_0_0_0.xml.license │ │ ├── scsi_1_0_0_0.xml │ │ ├── scsi_1_0_0_0.xml.license │ │ ├── scsi_2_0_0_0.xml │ │ ├── scsi_2_0_0_0.xml.license │ │ ├── scsi_generic_sg0.xml │ │ ├── scsi_generic_sg0.xml.license │ │ ├── scsi_generic_sg1.xml │ │ ├── scsi_generic_sg1.xml.license │ │ ├── scsi_host0.xml │ │ ├── scsi_host0.xml.license │ │ ├── scsi_host1.xml │ │ ├── scsi_host1.xml.license │ │ ├── scsi_host2.xml │ │ ├── scsi_host2.xml.license │ │ ├── scsi_target0_0_0.xml │ │ ├── scsi_target0_0_0.xml.license │ │ ├── scsi_target1_0_0.xml │ │ ├── scsi_target1_0_0.xml.license │ │ ├── scsi_target2_0_0.xml │ │ ├── scsi_target2_0_0.xml.license │ │ ├── testComplexVm.xml │ │ ├── testComplexVm.xml.license │ │ ├── testSRiovVm.xml │ │ ├── testSRiovVm.xml.license │ │ ├── usb_1_1.xml │ │ ├── usb_1_1.xml.license │ │ ├── usb_1_1_4.xml │ │ ├── usb_1_1_4.xml.license │ │ ├── usb_usb1.xml │ │ ├── usb_usb1.xml.license │ │ ├── vm_restore_spice_after.xml │ │ ├── vm_restore_spice_after.xml.license │ │ ├── vm_restore_spice_before.xml │ │ └── vm_restore_spice_before.xml.license │ └── parsing │ │ ├── __init__.py │ │ └── complex_vm_test.py ├── domcaps_libvirt_ppc64le.out ├── domcaps_libvirt_s390x.out ├── domcaps_libvirt_x86_64.out ├── domcaps_libvirt_x86_64_noibrs.out ├── domcaps_test.py ├── eventfd_test.py ├── exception_test.py ├── executor_test.py ├── fake-gluster-cli ├── fake-gluster-cli.license ├── fake-ssh-add ├── fake-ssh-agent ├── fake-virt-sysprep ├── fake-virt-v2v ├── fake-virt-v2v.err ├── fake-virt-v2v.err.license ├── fake-virt-v2v.out ├── fake-virt-v2v.out.license ├── fakelib.py ├── fakemetadatalib.py ├── filecontrol_test.py ├── functional │ ├── 60_test_balloon_shrink.policy │ ├── 70_test_balloon_grow.policy │ ├── __init__.py │ ├── momTests.py │ ├── supervdsmFuncTests.py │ ├── upgrade_vdsm_test.py │ └── utils.py ├── fuser_test.py ├── gluster │ ├── __init__.py │ ├── cli_test.py │ ├── hooks_test.py │ └── results │ │ ├── fake_vdo_status.yml │ │ ├── getTreeTestData-1.xml │ │ ├── getTreeTestData-1.xml.license │ │ ├── hook_read.json │ │ ├── hook_read.json.license │ │ ├── hooks_list.json │ │ └── hooks_list.json.license ├── glusterGeoRepStatus.xml ├── glusterGeoRepStatus.xml.license ├── glusterGeoRepStatusOld.xml ├── glusterGeoRepStatusOld.xml.license ├── glusterGlobalVolumeOptions.xml ├── glusterGlobalVolumeOptions.xml.license ├── glusterSnapshotConfig.xml ├── glusterSnapshotConfig.xml.license ├── glusterSnapshotList.xml ├── glusterSnapshotList.xml.license ├── glusterSnapshotListEmpty.xml ├── glusterSnapshotListEmpty.xml.license ├── glusterSnapshotRestore.xml ├── glusterSnapshotRestore.xml.license ├── glusterTestData.py ├── glusterVolumeGeoRepConfigList.xml ├── glusterVolumeGeoRepConfigList.xml.license ├── glusterVolumeHealInfo.xml ├── glusterVolumeHealInfo.xml.license ├── glusterVolumeProfileInfo.xml ├── glusterVolumeProfileInfo.xml.license ├── glusterVolumeProfileInfoNfs.xml ├── glusterVolumeProfileInfoNfs.xml.license ├── glusterVolumeRebalanceStatus.xml ├── glusterVolumeRebalanceStatus.xml.license ├── glusterVolumeRemoveBricksStatus.xml ├── glusterVolumeRemoveBricksStatus.xml.license ├── glusterVolumeSnapshotList.xml ├── glusterVolumeSnapshotList.xml.license ├── glusterVolumeSnapshotListEmpty.xml ├── glusterVolumeSnapshotListEmpty.xml.license ├── glusterVolumeTasks.xml ├── glusterVolumeTasks.xml.license ├── gluster_cli_test.py ├── gluster_exception_test.py ├── gluster_thinstorage_test.py ├── hooking_test.py ├── hooks │ └── vhostmd_test.py ├── hostdev_test.py ├── hostdevlib.py ├── hoststats_test.py ├── hugepages_test.py ├── hwinfo_test.py ├── integration │ ├── __init__.py │ ├── jsonRpcHelper.py │ └── sslhelper.py ├── jobs_test.py ├── jsonRpcClient_test.py ├── jsonrpc_test.py ├── kvm2ovirt_test.py ├── lib │ ├── bridge_test.py │ ├── hooks_test.py │ ├── osinfo_test.py │ ├── protocoldetector_test.py │ ├── rpc │ │ ├── http_detector_test.py │ │ └── http_image_request_handler_test.py │ ├── utils_test.py │ └── yajsonrpc │ │ ├── encoding_test.py │ │ ├── frame_test.py │ │ ├── jsonrpcserver_test.py │ │ ├── parser_test.py │ │ ├── stomp_detector_test.py │ │ ├── stomp_test.py │ │ ├── stompasyncdispatcher_test.py │ │ └── stomprpcclient_test.py ├── mem_info.out ├── mem_info.out.license ├── mkimage_test.py ├── modprobe.py ├── moduleloader_test.py ├── mom_policy_validator.py ├── mom_test.py ├── mompolicy_test.py ├── monkeypatch.py ├── monkeypatch_test.py ├── network │ ├── __init__.py │ ├── common.sh │ ├── conftest.py │ ├── dhcp.py │ ├── firewall.py │ ├── functional │ │ ├── README.md │ │ ├── __init__.py │ │ ├── bond_basic_test.py │ │ ├── bridge_test.py │ │ ├── conftest.py │ │ ├── dns_test.py │ │ ├── dynamic_ip_test.py │ │ ├── hook_test.py │ │ ├── link_mtu_test.py │ │ ├── net_basic_test.py │ │ ├── net_qos_test.py │ │ ├── net_with_bond_test.py │ │ ├── netfunctestlib.py │ │ ├── netrestore_test.py │ │ ├── rollback_test.py │ │ ├── run-tests.sh │ │ ├── static_ip_test.py │ │ ├── stats_test.py │ │ └── switch_type_change_test.py │ ├── integration │ │ ├── README.md │ │ ├── __init__.py │ │ ├── cmd_test.py │ │ ├── conftest.py │ │ ├── dhcp_monitor_test.py │ │ ├── dns_test.py │ │ ├── ethtool_test.py │ │ ├── iperf.py │ │ ├── ipwrapper_test.py │ │ ├── link_bond_test.py │ │ ├── link_bridge_test.py │ │ ├── link_iface_test.py │ │ ├── link_stats_test.py │ │ ├── lldpad_test.py │ │ ├── netinfo_test.py │ │ ├── netintegtestlib.py │ │ ├── netlink_test.py │ │ ├── run-tests.sh │ │ └── tc_test.py │ ├── nettestlib.py │ ├── static │ │ ├── bonding-defaults.json │ │ ├── bonding-defaults.json.license │ │ ├── bonding-name2numeric.json │ │ ├── bonding-name2numeric.json.license │ │ ├── config.py │ │ ├── constants.py │ │ ├── dsaversion.py │ │ ├── ip_route_show_table_all.out │ │ └── ip_route_show_table_all.out.license │ └── unit │ │ ├── README.md │ │ ├── __init__.py │ │ ├── canonicalize_test.py │ │ ├── conf_persistence_test.py │ │ ├── config_network_test.py │ │ ├── connectivity_test.py │ │ ├── dns_test.py │ │ ├── driverloader_test.py │ │ ├── ip_address_test.py │ │ ├── ip_validator_test.py │ │ ├── ipwrapper_test.py │ │ ├── link_setup_test.py │ │ ├── link_validator_test.py │ │ ├── lldpad_test.py │ │ ├── netinfo_test.py │ │ ├── netmaskconversions │ │ ├── netmaskconversions.license │ │ ├── netswitch_test.py │ │ ├── netswitch_validator_test.py │ │ ├── nmstate │ │ ├── __init__.py │ │ ├── bond_test.py │ │ ├── conftest.py │ │ ├── linux_bridge_test.py │ │ ├── ovs_bridge_test.py │ │ ├── source_route_test.py │ │ ├── sriov_test.py │ │ ├── testlib.py │ │ └── vlan_test.py │ │ ├── qos_test.py │ │ ├── run-tests.sh │ │ ├── sriov_test.py │ │ ├── tc_filter_show.out │ │ ├── tc_filter_show.out.license │ │ ├── tc_test.py │ │ └── testlib.py ├── osutils_test.py ├── panic_helper.py ├── passwords_test.py ├── permutation_test.py ├── prlimit_test.py ├── profile ├── profile-analyze ├── py-watch ├── pywatch_test.py ├── response_test.py ├── rngsources_test.py ├── run_tests_local.sh.in ├── schedule_test.py ├── schemavalidation_test.py ├── sigutils_test.py ├── slow-gluster-cli ├── slow-gluster-cli.license ├── ssl_test.py ├── statsd_test.py ├── stomp_test_utils.py ├── stompadapter_test.py ├── stompasyncclient_test.py ├── storage │ ├── README.md │ ├── __init__.py │ ├── asyncevent_test.py │ ├── asyncutils_test.py │ ├── backends_test.py │ ├── bitmaps_test.py │ ├── blkdiscard_test.py │ ├── blockdev_test.py │ ├── blocksd_test.py │ ├── blockvolume_test.py │ ├── check_test.py │ ├── cleanup.py │ ├── clusterlock_test.py │ ├── conftest.py │ ├── constants.py │ ├── curlimgwrap_test.py │ ├── devicemapper_test.py │ ├── directio_test.py │ ├── dmsetup_test.py │ ├── exception_test.py │ ├── fake-devices-non-standard │ ├── fake-devices-non-standard.license │ ├── fake-devices-standard │ ├── fake-devices-standard.license │ ├── fake-lsblk │ ├── fake-lsblk.el8.out │ ├── fake-lsblk.el8.out.license │ ├── fake-lsblk.fedora.out │ ├── fake-lsblk.fedora.out.license │ ├── fake-lsblk.node.out │ ├── fake-lsblk.node.out.license │ ├── fake-lsblk.rhel74.out │ ├── fake-lsblk.rhel74.out.license │ ├── fake_os_brick │ │ └── os_brick │ │ │ ├── __init__.py │ │ │ └── initiator │ │ │ ├── __init__.py │ │ │ └── connector.py │ ├── fakelib_test.py │ ├── fakesanlock.py │ ├── fakesanlock_test.py │ ├── fallocate_test.py │ ├── filesd_metadata_test.py │ ├── filesd_test.py │ ├── fileutil_test.py │ ├── filevolume_test.py │ ├── formatconverter_test.py │ ├── glance_test.py │ ├── glustervolume_test.py │ ├── guarded_test.py │ ├── hsm_connect_test.py │ ├── hsm_test.py │ ├── image_test.py │ ├── imagetickets_test.py │ ├── iscsi_test.py │ ├── iscsiadm_-m_iface.out │ ├── iscsiadm_-m_iface.out.license │ ├── iscsiadm_test.py │ ├── localfssd_test.py │ ├── loopback.py │ ├── loopback_test.py │ ├── lsof_test.py │ ├── lvm_test.py │ ├── lvmconf_test.py │ ├── lvmfilter_test.py │ ├── lvs_3386c6f2-926f-42c4-839c-38287fac8998.out │ ├── lvs_3386c6f2-926f-42c4-839c-38287fac8998.out.license │ ├── lvs_f9e55e18-67c4-4377-8e39-5833ca422bef.out │ ├── lvs_f9e55e18-67c4-4377-8e39-5833ca422bef.out.license │ ├── mailbox_test.py │ ├── managedvolume_test.py │ ├── managedvolumedb_test.py │ ├── marks.py │ ├── merge_test.py │ ├── misc_test.py │ ├── monitor_test.py │ ├── mount_test.py │ ├── mpathconf_test.py │ ├── mpathhealth_monitor_test.py │ ├── multipath_test.py │ ├── nbd_test.py │ ├── nbdutils_test.py │ ├── nfssd_test.py │ ├── operation_test.py │ ├── outofprocess_test.py │ ├── persistent_test.py │ ├── qemuimg_test.py │ ├── qemuio.py │ ├── qemuio_test.py │ ├── resourcemanager_test.py │ ├── rwlock_test.py │ ├── sanlock_direct_test.py │ ├── sanlockconf_test.py │ ├── sd_manifest_test.py │ ├── sd_test.py │ ├── sdm_add_bitmap_test.py │ ├── sdm_amend_volume_test.py │ ├── sdm_clear_bitmaps_test.py │ ├── sdm_copy_data_test.py │ ├── sdm_indirection_test.py │ ├── sdm_merge_test.py │ ├── sdm_remove_bitmap_test.py │ ├── sdm_update_volume_test.py │ ├── securable_test.py │ ├── spwd_test.py │ ├── storage.py │ ├── storagefakelib.py │ ├── storageserver_nfs_test.py │ ├── storageserver_test.py │ ├── storagetestlib.py │ ├── stress │ │ ├── download.py │ │ ├── extend.py │ │ ├── initiator.py │ │ ├── release-spm-lease.py │ │ ├── reload.py │ │ ├── switch_master.py │ │ └── thinp.py │ ├── sysfs_test.py │ ├── task_test.py │ ├── taskmanager_test.py │ ├── testlib_test.py │ ├── threadpool_test.py │ ├── tmpfs.py │ ├── tmprepo.py │ ├── tmpstorage.py │ ├── transientdisk_test.py │ ├── volume_metadata_test.py │ ├── volume_test.py │ ├── workarounds_test.py │ └── xlease_test.py ├── sysprep_test.py ├── taskset_test.py ├── testValidation.py ├── testing.py ├── testlib.py ├── testlib_test.py ├── testrunner.py ├── tests_child.py ├── throttledlog_test.py ├── toolTests_CCPP.conf ├── toolTests_empty.conf ├── toolTests_lconf_ssl.conf ├── toolTests_libvirtd.conf ├── toolTests_mtab_1g ├── toolTests_mtab_1g.license ├── toolTests_mtab_default ├── toolTests_mtab_default.license ├── toolTests_mtab_nohugetlbfs ├── toolTests_mtab_nohugetlbfs.license ├── toolTests_qemu_sanlock.conf ├── toolTests_qemu_ssl.conf ├── toolTests_vdsm_no_ssl.conf ├── toolTests_vdsm_ssl.conf ├── toolTests_vmcore.conf ├── tool_configurators_lvm_test.py ├── tool_confmeta_test.py ├── tool_test.py ├── unixrpc_testlib.py ├── v2v_testlib.py ├── validate_test.py ├── vdsmapi_test.py ├── vdsmdumpchains_test.py ├── verify.py ├── virt │ ├── __init__.py │ ├── backup_test.py │ ├── boot_hostdev_test.py │ ├── bulk_sampling_test.py │ ├── cd_test.py │ ├── cpumanagement_test.py │ ├── data │ │ ├── active-merge │ │ │ ├── 00-before.xml │ │ │ ├── 00-before.xml.license │ │ │ ├── 01-commit.xml │ │ │ ├── 01-commit.xml.license │ │ │ ├── 02-commit-ready.xml │ │ │ ├── 02-commit-ready.xml.license │ │ │ ├── 03-abort.xml │ │ │ ├── 03-abort.xml.license │ │ │ ├── 04-abort-ready.xml │ │ │ ├── 04-abort-ready.xml.license │ │ │ ├── 05-after.xml │ │ │ ├── 05-after.xml.license │ │ │ └── values.yml │ │ ├── disk_devices.xml │ │ ├── disk_devices.xml.license │ │ ├── disk_updated_snippet.xml │ │ ├── disk_updated_snippet.xml.license │ │ ├── domain.xml │ │ ├── domain.xml.license │ │ ├── domain_disk_block.xml │ │ ├── domain_disk_block.xml.license │ │ ├── domain_disk_file.xml │ │ ├── domain_disk_file.xml.license │ │ ├── hostedengine.xml │ │ ├── hostedengine.xml.license │ │ ├── hostedengine_lease.xml │ │ ├── hostedengine_lease.xml.license │ │ ├── internal-merge │ │ │ ├── 00-before.xml │ │ │ ├── 00-before.xml.license │ │ │ ├── 01-commit.xml │ │ │ ├── 01-commit.xml.license │ │ │ ├── 02-after.xml │ │ │ ├── 02-after.xml.license │ │ │ └── values.yml │ │ ├── sysinfo_snippet_filled.xml │ │ ├── sysinfo_snippet_filled.xml.license │ │ ├── sysinfo_snippet_template.xml │ │ ├── sysinfo_snippet_template.xml.license │ │ ├── vm_compat41.json │ │ ├── vm_compat41.json.license │ │ ├── vm_compat41.xml │ │ ├── vm_compat41.xml.license │ │ ├── vm_hibernated.xml │ │ ├── vm_hibernated.xml.license │ │ ├── vm_hibernated_390.xml │ │ ├── vm_hibernated_390.xml.license │ │ ├── vm_hosted_engine_42.xml │ │ ├── vm_hosted_engine_42.xml.license │ │ ├── vm_replace_md_base.xml │ │ ├── vm_replace_md_base.xml.license │ │ ├── vm_replace_md_update.xml │ │ ├── vm_replace_md_update.xml.license │ │ ├── vm_sysprep_floppy.xml │ │ └── vm_sysprep_floppy.xml.license │ ├── device_compat_test.py │ ├── device_lookup_test.py │ ├── device_test.py │ ├── devicexml_test.py │ ├── diskreplicate_test.py │ ├── displaynetwork_test.py │ ├── domaindescriptor_test.py │ ├── domxml_preprocess_test.py │ ├── drivename_test.py │ ├── events_test.py │ ├── externaldata_test.py │ ├── fakedomainadapter.py │ ├── filedata_test.py │ ├── guestagent_test.py │ ├── guestagenthelpers_test.py │ ├── libvirtnetwork_test.py │ ├── livemerge_test.py │ ├── metadata_storage_test.py │ ├── metadata_test.py │ ├── periodic_test.py │ ├── powerdown_test.py │ ├── prepared_test.py │ ├── qemuguestagent_test.py │ ├── sampling_test.py │ ├── seal_job_test.py │ ├── thinp_monitor_test.py │ ├── thinp_test.py │ ├── transient_test.py │ ├── utils_test.py │ ├── v2v_test.py │ ├── virdomain_test.py │ ├── vm_create_test.py │ ├── vm_libvirt_hook_test.py │ ├── vm_test.py │ ├── vmfakelib.py │ ├── vmfakelib_test.py │ ├── vmlease_test.py │ ├── vmmigration_test.py │ ├── vmoperations_test.py │ ├── vmrecovery_test.py │ ├── vmsecret_test.py │ ├── vmstats_test.py │ ├── vmstorage_test.py │ ├── vmutils_test.py │ └── vmxml_test.py ├── vmTestsData.py ├── vmapi_test.py └── vmfakecon.py ├── tox.ini ├── vdsm.spec.in ├── vdsm_hooks ├── Makefile.am ├── README ├── allocate_net │ ├── Makefile.am │ ├── README │ └── before_device_create.py ├── boot_hostdev │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── checkimages │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── checkips │ ├── Makefile.am │ ├── README │ ├── after_get_stats.py │ ├── checkips_utils.py │ ├── checkipsd │ └── vdsm-checkips.service.in ├── cpuflags │ ├── Makefile.am │ └── before_vm_start.py ├── diskunmap │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── ethtool_options │ ├── Makefile.am │ ├── README │ └── ethtool_options.py ├── extnet │ ├── Makefile.am │ ├── README │ └── extnet_vnic.py ├── extra_ipv4_addrs │ ├── Makefile.am │ ├── README │ ├── extra_ipv4_addrs.py │ └── sudoers ├── fakevmstats │ ├── Makefile.am │ └── after_get_all_vm_stats.py ├── faqemu │ ├── Makefile.am │ ├── after_get_caps.py │ └── before_vm_start.py ├── fcoe │ ├── 85-vdsm-hook-fcoe.preset │ ├── Makefile.am │ ├── README │ └── fcoe_before_network_setup.py ├── fileinject │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── httpsisoboot │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── localdisk │ ├── 12-vdsm-localdisk.rules │ ├── Makefile.am │ ├── README │ ├── after_disk_prepare │ ├── before_vm_migrate_source │ ├── localdisk-helper │ └── sudoers.vdsm_hook_localdisk ├── log_console │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── log_firmware │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── macbind │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── nestedvt │ ├── Makefile.am │ ├── README │ ├── before_vm_start.py │ └── modprobe.conf ├── openstacknet │ ├── Makefile.am │ ├── README │ ├── after_device_create.py │ ├── after_get_caps.py │ ├── after_vm_start.py │ ├── before_device_create.py │ ├── openstacknet_utils.py │ └── sudoers.in ├── qemucmdline │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── scratchpad │ ├── Makefile.am │ ├── README │ ├── after_vm_destroy.py │ ├── before_vm_migrate_source.py │ └── before_vm_start.py ├── smbios │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── spiceoptions │ ├── Makefile.am │ ├── README │ └── before_vm_start.py ├── vhostmd │ ├── Makefile.am │ ├── after_vm_destroy.py │ ├── before_vm_start.py │ └── sudoers.vdsm_hook_vhostmd └── vmfex_dev │ ├── Makefile.am │ ├── README │ └── vmfex_vnic.py └── vdsm_log ├── vdsmlog.lang ├── vdsmlog.sh └── vdsmlog.style /.github/workflows/ost.yml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | name: OST 5 | 6 | on: 7 | issue_comment: 8 | types: [created] 9 | 10 | jobs: 11 | trigger-ost: 12 | uses: oVirt/ovirt-system-tests/.github/workflows/ost.yaml@master 13 | -------------------------------------------------------------------------------- /.reuse/dep5: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: Vdsm 3 | Upstream-Contact: oVirt 4 | Source: https://github.com/oVirt/vdsm 5 | 6 | # Sample paragraph, commented out: 7 | # 8 | # Files: src/* 9 | # Copyright: $YEAR $NAME <$CONTACT> 10 | # License: ... 11 | -------------------------------------------------------------------------------- /.reuse/templates/vdsm.jinja2: -------------------------------------------------------------------------------- 1 | {% for copyright_line in copyright_lines %} 2 | {{ copyright_line }} 3 | {% endfor %} 4 | {% for expression in spdx_expressions %} 5 | SPDX-License-Identifier: {{ expression }} 6 | {% endfor %} 7 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | autoreconf -if 7 | 8 | if test "x$1" = "x--system"; then 9 | shift 10 | prefix=/usr 11 | libdir=$prefix/lib 12 | sysconfdir=/etc 13 | localstatedir=/var 14 | if [ -d /usr/lib64 ]; then 15 | libdir=$prefix/lib64 16 | fi 17 | EXTRA_ARGS="--prefix=$prefix --sysconfdir=$sysconfdir --localstatedir=$localstatedir --libdir=$libdir" 18 | echo "Running ./configure with $EXTRA_ARGS $@" 19 | else 20 | if test -z "$*" && test ! -f "$THEDIR/config.status"; then 21 | echo "I am going to run ./configure with no arguments - if you wish " 22 | echo "to pass any to it, please specify them on the $0 command line." 23 | fi 24 | fi 25 | 26 | if test -z "$*" && test -f config.status; then 27 | ./config.status --recheck 28 | else 29 | ./configure $EXTRA_ARGS "$@" 30 | fi && { 31 | echo 32 | echo "Now type 'make' to compile vdsm." 33 | } 34 | -------------------------------------------------------------------------------- /build-aux/list-all-python-files: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | # Lists all Python files (including the ones without '.py' extension, 7 | # but containing a Python shebang line) in current directory. 8 | # Please remember to run 'make' before using this script - it doesn't 9 | # cover '*.py.in' files 10 | 11 | PYTHON_MODULES=$(find . -not -path '*/\.tox*' -type f -name '*.py') 12 | 13 | PYTHON_SCRIPTS=$(grep --color=never -rl "#\!/usr/bin/python" . | \ 14 | grep -v \ 15 | -e "^\./\.git" \ 16 | -e "^\./\.tox*" \ 17 | -e "\.pyc\?$" \ 18 | -e "\.html$" \ 19 | -e ChangeLog \ 20 | -e Makefile) 21 | 22 | echo -e "${PYTHON_MODULES}\n${PYTHON_SCRIPTS}" | uniq | sort | sed -E -e '/^\s*$/d' 23 | -------------------------------------------------------------------------------- /ci/README: -------------------------------------------------------------------------------- 1 | 5 | 6 | Take a look to the [wiki] page on the details of what is in this directory and 7 | how it's used. 8 | 9 | [wiki]: http://wiki.ovirt.org/develop/dev-process/build-and-test-standards/ 10 | -------------------------------------------------------------------------------- /ci/lint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | # Only when running in a container 7 | [ -d /venv ] && { 8 | # Workaround to avoid this warning: 9 | # fatal: detected dubious ownership in repository at '/dir' 10 | git config --global --add safe.directory "$(pwd)" 11 | 12 | # Activate the tests venv (for containers only) 13 | source /venv/bin/activate 14 | } 15 | 16 | ./autogen.sh --system 17 | make 18 | make lint 19 | -------------------------------------------------------------------------------- /ci/rpm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | git config --global --add safe.directory "$PWD" 7 | 8 | export EXPORT_DIR="${EXPORT_DIR:-exported-artifacts}" 9 | 10 | if [ "$GITHUB_EVENT_NAME" = "push" ]; then 11 | # For merged patches, use stanrad git describe format matching vdsm 12 | # copr builds. 13 | # vdsm-4.50.0.2-46.git8dc924a21.el8.src.rpm 14 | ./autogen.sh --system 15 | else 16 | # For pull requests or local builds use a timestamp: 17 | # vdsm-4.50.0.2-202112031326.git8dc924a21.el8.src.rpm 18 | ./autogen.sh --system --enable-timestamp 19 | fi 20 | 21 | make 22 | make rpm 23 | 24 | mkdir -p ${EXPORT_DIR} 25 | 26 | cp $PWD/lib/vdsm/api/vdsm-api.html "${EXPORT_DIR}" 27 | 28 | find $PWD/build \ 29 | -iname '*.rpm' \ 30 | -exec mv {} "${EXPORT_DIR}/" \; 31 | 32 | find . \ 33 | -maxdepth 1 \ 34 | -iname 'vdsm*.tar.gz' \ 35 | -exec mv {} "${EXPORT_DIR}/" \; 36 | 37 | createrepo_c "${EXPORT_DIR}" 38 | -------------------------------------------------------------------------------- /ci/tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | # Enable IPv6 7 | echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6 8 | # Load bonding module 9 | SUFFIX=$RANDOM 10 | ip link add mod_bond$SUFFIX type bond && ip link del mod_bond$SUFFIX 11 | 12 | # Only when running in a container 13 | [ -d /venv ] && { 14 | # Workaround to avoid this warning: 15 | # fatal: detected dubious ownership in repository at '/dir' 16 | git config --global --add safe.directory "$(pwd)" 17 | 18 | # Activate the tests venv (for containers only) 19 | source /venv/bin/activate 20 | } 21 | 22 | ./autogen.sh --system 23 | make 24 | make tests 25 | -------------------------------------------------------------------------------- /commit-template.txt: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | topic: Short summary under 50 chars (if possible) 5 | 6 | The topic should be a module name, a subsystem name, or a feature name, 7 | helping to understand what is this patch about. 8 | 9 | The rest of the commit message should include a longer description, 10 | explaining why this patch is needed, why it is implemented in the 11 | specific way, and the nature of the change. 12 | 13 | The description should use line length of 72 chars and multiple 14 | paragraphs if necessary. 15 | 16 | Bug-Url: https://github.com/oVirt/vdsm/issues/? 17 | -------------------------------------------------------------------------------- /contrib/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | dist_noinst_PYTHON = \ 7 | nfs-check.py \ 8 | $(NULL) 9 | -------------------------------------------------------------------------------- /contrib/deploy-gluster.sh: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # Install required packages and start services. 5 | # This must run on all gluster nodes. When done, you can create gluster 6 | # bricks and volumes on one of the nodes. 7 | # 8 | # Requirements: 9 | # - Fedora 29 VM 10 | # - VirtIO OS disk 11 | 12 | set -e 13 | 14 | echo "Installing ovirt-release-master package" 15 | dnf install -y http://resources.ovirt.org/pub/yum-repo/ovirt-release-master.rpm 16 | 17 | echo "Installing runtime packages" 18 | dnf install -y \ 19 | kmod-kvdo \ 20 | vdo \ 21 | glusterfs-server 22 | 23 | echo "Disabling firewalld" 24 | systemctl stop firewalld 25 | systemctl disable firewalld 26 | 27 | echo "Starting gluster service" 28 | systemctl enable glusterd --now 29 | -------------------------------------------------------------------------------- /contrib/koji_build.sh: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | echo 'Please run this script from vdsm main folder' 5 | echo '============================================' 6 | 7 | make distclean 8 | ./autogen.sh \ 9 | --system \ 10 | --disable-ovirt-vmconsole \ 11 | --enable-vhostmd \ 12 | --enable-hooks \ 13 | --with-data-center='/run/vdsm/data-center' 14 | make srpm 15 | 16 | echo 17 | echo 'Finish to compile VDSM for koji Fedora build' 18 | echo 'Use output srp.rpm to import fedpkg' 19 | -------------------------------------------------------------------------------- /contrib/rhv_build.sh: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | echo 'Please run this script from vdsm main folder' 5 | echo '============================================' 6 | 7 | ./build-aux/make-dist with_hooks 1 with_vhostmd 1 8 | -------------------------------------------------------------------------------- /contrib/vmconfig.json.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. SPDX-FileCopyrightText: Red Hat, Inc. 2 | .. SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | .. Vdsm documentation master file, created by 5 | sphinx-quickstart on Thu Dec 24 14:07:47 2009. 6 | You can adapt this file completely to your liking, but it should at least 7 | contain the root `toctree` directive. 8 | 9 | Welcome to Vdsm's documentation! 10 | ================================ 11 | 12 | Contents: 13 | 14 | .. toctree:: 15 | :maxdepth: 3 16 | 17 | build/apidoc/vdsm.rst 18 | 19 | 20 | Indices and tables 21 | ================== 22 | 23 | * :ref:`genindex` 24 | * :ref:`modindex` 25 | * :ref:`search` 26 | 27 | -------------------------------------------------------------------------------- /docker/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | targets := alma-9 centos-9 5 | prefix := ovirt/vdsm-test 6 | 7 | .PHONY: $(targets) push 8 | 9 | all: $(targets) 10 | 11 | $(targets): 12 | podman build -t $(prefix):$@ -f Dockerfile.$@ . 13 | 14 | push: 15 | for name in $(targets); do \ 16 | podman push $(prefix):$$name quay.io/$(prefix):$$name; \ 17 | done 18 | -------------------------------------------------------------------------------- /docker/lvmlocal.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # LVM conf required for running lvm commands under mock or inside a 5 | # container. 6 | 7 | activation { 8 | udev_sync = 0 9 | udev_rules = 0 10 | } 11 | -------------------------------------------------------------------------------- /docker/network/Makefile: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | CONTAINER_CMD := podman 5 | PREFIX := ovirt/vdsm-network-tests 6 | 7 | targets := alma-9 centos-9 8 | types := functional integration unit 9 | 10 | .PHONY: $(targets) $(types) 11 | 12 | all: $(targets) 13 | 14 | $(targets): 15 | for name in $(types); do \ 16 | cd $$name; \ 17 | $(CONTAINER_CMD) build --no-cache --rm -t $(PREFIX)-$$name:$@ -f Dockerfile.$@ . || exit $$?; \ 18 | cd -; \ 19 | done 20 | 21 | $(types): 22 | for target in $(targets); do \ 23 | cd $@; \ 24 | $(CONTAINER_CMD) build --no-cache --rm -t $(PREFIX)-$@:$$target -f Dockerfile.$$target . || exit $$?; \ 25 | cd -; \ 26 | done 27 | -------------------------------------------------------------------------------- /docker/requirements.txt: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | nose==1.3.7 5 | tox 6 | userstorage>=0.5 7 | yappi 8 | -------------------------------------------------------------------------------- /execcmd-allowlist.txt.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /helpers/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | dist_vdsmexec_SCRIPTS = \ 7 | kvm2ovirt \ 8 | fallocate \ 9 | $(NULL) 10 | -------------------------------------------------------------------------------- /helpers/kvm2ovirt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | from vdsm import kvm2ovirt 9 | kvm2ovirt.main() 10 | -------------------------------------------------------------------------------- /init/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2013 IBM, Inc. 2 | # SPDX-FileCopyrightText: Red Hat, Inc. 3 | # SPDX-License-Identifier: GPL-2.0-or-later 4 | 5 | SUBDIRS = systemd 6 | 7 | include $(top_srcdir)/build-aux/Makefile.subs 8 | 9 | nodist_vdsmexec_SCRIPTS = \ 10 | vdsmd_init_common.sh \ 11 | $(NULL) 12 | 13 | dist_vdsmexec_SCRIPTS = \ 14 | daemonAdapter \ 15 | $(NULL) 16 | 17 | CLEANFILES = \ 18 | config.log \ 19 | $(nodist_vdsmexec_SCRIPTS) \ 20 | $(NULL) 21 | 22 | EXTRA_DIST = \ 23 | vdsmd_init_common.sh.in \ 24 | $(NULL) 25 | -------------------------------------------------------------------------------- /init/systemd/unlimited-core.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | ## beginning of configuration section by vdsm 5 | [Service] 6 | LimitCORE=infinity 7 | ## end of configuration section by vdsm 8 | -------------------------------------------------------------------------------- /init/systemd/vdsm-tmpfiles.d.conf.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | d @VDSMRUNDIR@ 755 @VDSMUSER@ @VDSMGROUP@ 5 | d @VDSMRUNDIR@/v2v 700 @VDSMUSER@ @VDSMGROUP@ 6 | d @VDSMRUNDIR@/payload 755 @VDSMUSER@ @VDSMGROUP@ 7 | -------------------------------------------------------------------------------- /lib/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | SUBDIRS = dnf-plugins vdsm vdsmclient yajsonrpc 7 | -------------------------------------------------------------------------------- /lib/dnf-plugins/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | dnfpluginsdir = $(pythondir)/dnf-plugins 5 | 6 | dist_dnfplugins_PYTHON = \ 7 | vdsmupgrade.py \ 8 | $(NULL) 9 | 10 | -------------------------------------------------------------------------------- /lib/vdsm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | -------------------------------------------------------------------------------- /lib/vdsm/api/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/common/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | SUBDIRS = network 7 | 8 | vdsmcommondir = $(vdsmpylibdir)/common 9 | 10 | nodist_vdsmcommon_PYTHON = \ 11 | $(srcdir)/config.py \ 12 | $(srcdir)/constants.py \ 13 | $(srcdir)/dsaversion.py \ 14 | $(NULL) 15 | 16 | dist_vdsmcommon_PYTHON = \ 17 | $(filter-out $(nodist_vdsmcommon_PYTHON), $(wildcard $(srcdir)/*.py)) 18 | $(NULL) 19 | 20 | EXTRA_DIST = \ 21 | config.py.in \ 22 | constants.py.in \ 23 | dsaversion.py.in \ 24 | $(NULL) 25 | 26 | CLEANFILES = \ 27 | $(nodist_vdsmcommon_PYTHON) \ 28 | $(NULL) 29 | 30 | all-local: \ 31 | $(nodist_vdsmcommon_PYTHON) \ 32 | $(NULL) 33 | -------------------------------------------------------------------------------- /lib/vdsm/common/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/common/conv.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | 8 | def tobool(s): 9 | try: 10 | if s is None: 11 | return False 12 | if type(s) == bool: 13 | return s 14 | if s.lower() == 'true': 15 | return True 16 | return bool(int(s)) 17 | except: 18 | return False 19 | -------------------------------------------------------------------------------- /lib/vdsm/common/errors.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | """ 5 | errors - vdsm internal errors 6 | 7 | This module provide internal errors which are not part of vdsm api, helpers for 8 | error handling. For public vdsm errors see vdsm.common.exception. 9 | """ 10 | 11 | from __future__ import absolute_import 12 | from __future__ import division 13 | 14 | 15 | class Base(Exception): 16 | msg = "Base class for vdsm errors" 17 | 18 | def __str__(self): 19 | return self.msg.format(self=self) 20 | -------------------------------------------------------------------------------- /lib/vdsm/common/filecontrol.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | import fcntl 7 | import os 8 | 9 | 10 | def _set_or_clear_bits(set, word, bits): 11 | if set: 12 | return word | bits 13 | else: 14 | return word & (~bits) 15 | 16 | 17 | def set_non_blocking(fd, value=True): 18 | """Set O_NONBLOCK flag on file descriptor""" 19 | flags = fcntl.fcntl(fd, fcntl.F_GETFL) 20 | flags = _set_or_clear_bits(value, flags, os.O_NONBLOCK) 21 | return fcntl.fcntl(fd, fcntl.F_SETFL, flags) 22 | 23 | 24 | def set_close_on_exec(fd, value=True): 25 | """Set O_CLOEXEC flag on file descriptor""" 26 | flags = fcntl.fcntl(fd, fcntl.F_GETFD) 27 | flags = _set_or_clear_bits(value, flags, fcntl.FD_CLOEXEC) 28 | return fcntl.fcntl(fd, fcntl.F_SETFD, flags) 29 | -------------------------------------------------------------------------------- /lib/vdsm/common/marks.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | 8 | def deprecated(thing): 9 | """ 10 | Mark functions, methods, and classes as deprecated. 11 | 12 | Marked items will be remove in future version. Do not used them in new 13 | code. 14 | """ 15 | return thing 16 | -------------------------------------------------------------------------------- /lib/vdsm/common/network/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmcommonnetworkdir = $(vdsmpylibdir)/common/network 7 | dist_vdsmcommonnetwork_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/common/network/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/common/panic.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | import logging 5 | import os 6 | import sys 7 | import threading 8 | 9 | 10 | def panic(msg): 11 | logging.exception("Panic: %s", msg) 12 | ready = threading.Event() 13 | 14 | def run(): 15 | ready.wait(10) 16 | os.killpg(0, 9) 17 | sys.exit(-3) 18 | 19 | t = threading.Thread(target=run) 20 | t.daemon = True 21 | t.start() 22 | try: 23 | logging.shutdown() 24 | finally: 25 | ready.set() 26 | -------------------------------------------------------------------------------- /lib/vdsm/common/pki.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import os 8 | from . import constants 9 | 10 | PKI_DIR = os.path.join(constants.SYSCONF_PATH, 'pki', 'vdsm') 11 | KEY_FILE = os.path.join(PKI_DIR, 'keys', 'vdsmkey.pem') 12 | CERT_FILE = os.path.join(PKI_DIR, 'certs', 'vdsmcert.pem') 13 | CA_FILE = os.path.join(PKI_DIR, 'certs', 'cacert.pem') 14 | -------------------------------------------------------------------------------- /lib/vdsm/common/threadlocal.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import threading 8 | 9 | vars = threading.local() 10 | vars.task = None 11 | vars.context = None 12 | -------------------------------------------------------------------------------- /lib/vdsm/common/units.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | """ 5 | Constants for file/disk sizes. 6 | """ 7 | 8 | KiB = 1024 9 | MiB = 1024**2 10 | GiB = 1024**3 11 | TiB = 1024**4 12 | PiB = 1024**5 13 | -------------------------------------------------------------------------------- /lib/vdsm/config.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | """ 7 | a proxy for vdsm.common.config. 8 | 9 | remove when all modules import vdsm.common.config directly 10 | """ 11 | 12 | from vdsm.common.config import * # NOQA: F401, F403 13 | -------------------------------------------------------------------------------- /lib/vdsm/constants.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | """ 7 | a proxy for vdsm.common.constants. 8 | 9 | remove when all modules import vdsm.common.constants directly 10 | """ 11 | 12 | from vdsm.common.constants import * # NOQA: F401, F403 13 | -------------------------------------------------------------------------------- /lib/vdsm/gluster/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmglusterdir = $(vdsmpylibdir)/gluster 7 | 8 | common = \ 9 | __init__.py \ 10 | cli.py \ 11 | exception.py \ 12 | $(NULL) 13 | 14 | if GLUSTER_MGMT 15 | gluster_mgmt = \ 16 | api.py \ 17 | apiwrapper.py \ 18 | events.py \ 19 | fence.py \ 20 | fstab.py \ 21 | gfapi.py \ 22 | hooks.py \ 23 | services.py \ 24 | storagedev.py \ 25 | tasks.py \ 26 | thinstorage.py \ 27 | $(NULL) 28 | endif 29 | 30 | dist_vdsmgluster_PYTHON = $(common) $(gluster_mgmt) 31 | -------------------------------------------------------------------------------- /lib/vdsm/hook/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vdsmhookdir = $(vdsmpylibdir)/hook 5 | 6 | dist_vdsmhook_PYTHON = \ 7 | __init__.py \ 8 | hooking.py \ 9 | $(NULL) 10 | -------------------------------------------------------------------------------- /lib/vdsm/hook/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/host/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmhostdir = $(vdsmpylibdir)/host 7 | dist_vdsmhost_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/host/rngsources.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import os.path 8 | 9 | from vdsm.common.cache import memoized 10 | 11 | _SOURCES = { 12 | 'random': '/dev/random', 13 | 'urandom': '/dev/urandom', 14 | 'hwrng': '/dev/hwrng' 15 | } 16 | 17 | 18 | def list_available(): 19 | return [ 20 | source for (source, path) in _SOURCES.items() 21 | if os.path.exists(path) and 22 | # REQUIRE_FOR: Engine <= 4.0 23 | source != 'urandom' 24 | ] 25 | 26 | 27 | def get_device(name): 28 | return _SOURCES[name] 29 | 30 | 31 | @memoized 32 | def get_source_name(dev): 33 | for name, path in _SOURCES.items(): 34 | if dev == path: 35 | return name 36 | raise KeyError(dev) 37 | -------------------------------------------------------------------------------- /lib/vdsm/logUtils.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | """ 5 | This module is left behind as a proxy to the relocated logutils module. 6 | The two proxy functions have been referenced in logger.conf, therefore, 7 | any user that may have customized the logger.conf, would not get the updated 8 | version with the new references. 9 | 10 | TODO: The configuration in these specific entries in the logger.config.in 11 | should be drop, letting the application define them (without exposing this 12 | to users). 13 | """ 14 | from __future__ import absolute_import 15 | 16 | from vdsm.common.logutils import ( # NOQA: F401 (unused import) 17 | TimezoneFormatter, 18 | UserGroupEnforcingHandler, 19 | ) 20 | -------------------------------------------------------------------------------- /lib/vdsm/metrics/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmmetricsdir = $(vdsmpylibdir)/metrics 7 | dist_vdsmmetrics_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/metrics/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import importlib 8 | from ..config import config 9 | 10 | _reporter = None 11 | 12 | 13 | def start(): 14 | global _reporter 15 | if config.getboolean('metrics', 'enabled'): 16 | _reporter = importlib.import_module( 17 | 'vdsm.metrics.' + config.get('metrics', 'collector_type') 18 | ) 19 | _reporter.start(config.get('metrics', 'collector_address')) 20 | 21 | 22 | def stop(): 23 | global _reporter 24 | if _reporter: 25 | _reporter.stop() 26 | _reporter = None 27 | 28 | 29 | def send(report): 30 | if _reporter: 31 | _reporter.send(report) 32 | -------------------------------------------------------------------------------- /lib/vdsm/moduleloader.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | import importlib 6 | import pkgutil 7 | 8 | 9 | def load_modules(pkg_name): 10 | modules = {} 11 | for _, module_name, _ in pkgutil.iter_modules([pkg_name.__path__[0]]): 12 | full_name = '{}.{}'.format(pkg_name.__name__, module_name) 13 | modules[module_name] = importlib.import_module(full_name) 14 | return modules 15 | -------------------------------------------------------------------------------- /lib/vdsm/network/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | SUBDIRS = common configurators ip link lldp lldpad netinfo netlink nmstate tc netswitch 5 | 6 | include $(top_srcdir)/build-aux/Makefile.subs 7 | 8 | vdsmnetworkdir = $(vdsmpylibdir)/network 9 | dist_vdsmnetwork_PYTHON = $(srcdir)/*.py 10 | -------------------------------------------------------------------------------- /lib/vdsm/network/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/network/cmd.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.common.cmdutils import exec_cmd as exec_sync_bytes 8 | from vdsm.network.common import conversion_util 9 | 10 | 11 | def exec_sync(cmds): 12 | """Execute a command and convert returned values to native string. 13 | 14 | Note that this function should not be used if output data could be 15 | undecodable bytes. 16 | """ 17 | retcode, out, err = exec_sync_bytes(cmds) 18 | return retcode, conversion_util.to_str(out), conversion_util.to_str(err) 19 | -------------------------------------------------------------------------------- /lib/vdsm/network/common/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworkcommondir = $(vdsmpylibdir)/network/common 7 | dist_vdsmnetworkcommon_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/network/common/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | -------------------------------------------------------------------------------- /lib/vdsm/network/common/conversion_util.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | 5 | def to_str(value): 6 | """Convert textual value to native string. 7 | 8 | Passed value will be returned as a native str value (unicode in Python 3). 9 | """ 10 | if not isinstance(value, (str, bytes)): 11 | raise ValueError( 12 | f'Expected a textual value, given {value} of type {type(value)}.' 13 | ) 14 | elif isinstance(value, bytes): 15 | return value.decode('utf-8') 16 | return value 17 | 18 | 19 | def to_binary(value): 20 | """Convert textual value to binary.""" 21 | if isinstance(value, bytes): 22 | return value 23 | else: 24 | return value.encode('utf-8') 25 | -------------------------------------------------------------------------------- /lib/vdsm/network/configurators/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworkconfiguratorsdir = $(vdsmpylibdir)/network/configurators 7 | 8 | dist_vdsmnetworkconfigurators_PYTHON = $(srcdir)/*.py 9 | -------------------------------------------------------------------------------- /lib/vdsm/network/configurators/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from . import qos 5 | 6 | __all__ = ['qos'] 7 | -------------------------------------------------------------------------------- /lib/vdsm/network/dns.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import logging 8 | 9 | DNS_CONF_FILE = '/etc/resolv.conf' 10 | 11 | 12 | def get_host_nameservers(): 13 | """Returns a list of nameservers listed in /etc/resolv.conf""" 14 | try: 15 | with open(DNS_CONF_FILE, 'r') as file_object: 16 | file_text = file_object.read() 17 | except IOError as e: 18 | logging.warning('Failed to read %s: %s', DNS_CONF_FILE, e) 19 | return [] 20 | return _parse_nameservers(file_text) 21 | 22 | 23 | def _parse_nameservers(file_text): 24 | nameservers = [] 25 | for line in file_text.splitlines(): 26 | words = line.strip().split() 27 | if len(words) < 2: 28 | continue 29 | if words[0] == 'nameserver': 30 | nameservers.append(words[1]) 31 | return nameservers 32 | -------------------------------------------------------------------------------- /lib/vdsm/network/driverloader.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from importlib import import_module 8 | from pkgutil import iter_modules 9 | 10 | from vdsm.common.cache import memoized 11 | 12 | 13 | class NoDriverError(Exception): 14 | pass 15 | 16 | 17 | @memoized 18 | def load_drivers(driver_class, package_name, package_path): 19 | drivers = {} 20 | for _, module_name, _ in iter_modules([package_path]): 21 | module = import_module('{}.{}'.format(package_name, module_name)) 22 | if hasattr(module, driver_class): 23 | drivers[module_name] = getattr(module, driver_class) 24 | return drivers 25 | 26 | 27 | def get_driver(driver, drivers): 28 | try: 29 | return drivers[driver] 30 | except KeyError: 31 | raise NoDriverError(driver) 32 | -------------------------------------------------------------------------------- /lib/vdsm/network/ip/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworkipdir = $(vdsmpylibdir)/network/ip 7 | dist_vdsmnetworkip_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/network/ip/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/network/link/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | SUBDIRS = bond 5 | 6 | include $(top_srcdir)/build-aux/Makefile.subs 7 | 8 | vdsmnetworklinkdir = $(vdsmpylibdir)/network/link 9 | dist_vdsmnetworklink_PYTHON = $(srcdir)/*.py 10 | -------------------------------------------------------------------------------- /lib/vdsm/network/link/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | __all__ = ['iface'] 8 | -------------------------------------------------------------------------------- /lib/vdsm/network/link/bond/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworklinkbonddir = $(vdsmpylibdir)/network/link/bond 7 | dist_vdsmnetworklinkbond_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/network/link/vlan.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.network.link import bond 8 | from vdsm.network.link import iface 9 | from vdsm.network.link import nic 10 | 11 | 12 | def speed(dev_name): 13 | """Return the vlan's underlying device speed.""" 14 | dev_speed = 0 15 | dev_vlan = iface.iface(dev_name) 16 | dev_base_name = dev_vlan.properties()['device'] 17 | dev_base = iface.iface(dev_base_name) 18 | dev_base_type = dev_base.type() 19 | if dev_base_type == iface.Type.NIC: 20 | dev_speed = nic.speed(dev_name) 21 | elif dev_base_type == iface.Type.BOND: 22 | dev_speed = bond.speed(dev_base_name) 23 | 24 | return dev_speed 25 | -------------------------------------------------------------------------------- /lib/vdsm/network/lldp/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworklldpdir = $(vdsmpylibdir)/network/lldp 7 | dist_vdsmnetworklldp_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/network/lldp/info.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.network import lldp 8 | from vdsm.network.link.iface import iface 9 | 10 | Lldp = lldp.driver() 11 | 12 | 13 | def get_info(filter): 14 | """ 15 | Get LLDP information for all devices. 16 | """ 17 | return {device: _get_info(device) for device in filter['devices']} 18 | 19 | 20 | def _get_info(device): 21 | dev_info = {'enabled': False, 'tlvs': []} 22 | if iface(device).is_oper_up() and Lldp.is_lldp_enabled_on_iface(device): 23 | dev_info['enabled'] = True 24 | dev_info['tlvs'] = Lldp.get_tlvs(device) 25 | return dev_info 26 | -------------------------------------------------------------------------------- /lib/vdsm/network/lldp/lldpad.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.network.lldpad import lldptool 8 | 9 | from . import LldpAPI 10 | 11 | 12 | class Lldp(LldpAPI): 13 | @staticmethod 14 | def enable_lldp_on_iface(iface, rx_only=True): 15 | lldptool.enable_lldp_on_iface(iface, rx_only) 16 | 17 | @staticmethod 18 | def disable_lldp_on_iface(iface): 19 | lldptool.disable_lldp_on_iface(iface) 20 | 21 | @staticmethod 22 | def is_lldp_enabled_on_iface(iface): 23 | return lldptool.is_lldp_enabled_on_iface(iface) 24 | 25 | @staticmethod 26 | def get_tlvs(iface): 27 | return lldptool.get_tlvs(iface) 28 | 29 | @staticmethod 30 | def is_active(): 31 | return ( 32 | lldptool.is_lldpad_service_running() 33 | and lldptool.is_lldptool_functional() 34 | ) 35 | -------------------------------------------------------------------------------- /lib/vdsm/network/lldpad/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworklldpaddir = $(vdsmpylibdir)/network/lldpad 7 | dist_vdsmnetworklldpad_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/network/lldpad/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/network/netinfo/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetinfo = $(vdsmpylibdir)/network/netinfo 7 | dist_vdsmnetinfo_PYTHON = \ 8 | __init__.py \ 9 | addresses.py \ 10 | bonding.py \ 11 | bridges.py \ 12 | cache.py \ 13 | nics.py \ 14 | qos.py \ 15 | routes.py \ 16 | $(NULL) 17 | -------------------------------------------------------------------------------- /lib/vdsm/network/netinfo/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | NET_PATH = '/sys/class/net' 8 | 9 | __all__ = [ 10 | 'addresses', 11 | 'bonding', 12 | 'nics', 13 | 'routes', 14 | ] 15 | -------------------------------------------------------------------------------- /lib/vdsm/network/netinfo/nics.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import io 8 | 9 | OPERSTATE_UP = 'up' 10 | 11 | 12 | def operstate(nic_name): 13 | with io.open('/sys/class/net/%s/operstate' % nic_name) as operstateFile: 14 | return operstateFile.read().strip() 15 | 16 | 17 | def info(link): 18 | return {'hwaddr': link.address} 19 | -------------------------------------------------------------------------------- /lib/vdsm/network/netlink/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetlinkdir = $(vdsmpylibdir)/network/netlink 7 | dist_vdsmnetlink_PYTHON = \ 8 | __init__.py \ 9 | addr.py \ 10 | libnl.py \ 11 | link.py \ 12 | monitor.py \ 13 | route.py \ 14 | waitfor.py \ 15 | $(NULL) 16 | -------------------------------------------------------------------------------- /lib/vdsm/network/netswitch/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworknetswitchdir = $(vdsmpylibdir)/network/netswitch 7 | dist_vdsmnetworknetswitch_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/network/netswitch/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from . import configurator 8 | 9 | 10 | configurator 11 | -------------------------------------------------------------------------------- /lib/vdsm/network/nmstate/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | SUBDIRS = ovs 5 | 6 | include $(top_srcdir)/build-aux/Makefile.subs 7 | 8 | vdsmnetworknmstatedir = $(vdsmpylibdir)/network/nmstate 9 | dist_vdsmnetworknmstate_PYTHON = $(srcdir)/*.py 10 | -------------------------------------------------------------------------------- /lib/vdsm/network/nmstate/ovs/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworknmstateovsdir = $(vdsmpylibdir)/network/nmstate/ovs 7 | dist_vdsmnetworknmstateovs_PYTHON = $(srcdir)/*.py 8 | -------------------------------------------------------------------------------- /lib/vdsm/network/nmstate/ovs/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | -------------------------------------------------------------------------------- /lib/vdsm/network/nmstate/sriov.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from .schema import Ethernet 5 | from .schema import Interface 6 | from .schema import InterfaceState 7 | 8 | 9 | def create_sriov_state(device, numvfs): 10 | state = { 11 | Interface.KEY: [ 12 | { 13 | Interface.NAME: device, 14 | Interface.STATE: InterfaceState.UP, 15 | Ethernet.CONFIG_SUBTREE: { 16 | Ethernet.SRIOV_SUBTREE: { 17 | Ethernet.SRIOV.TOTAL_VFS: numvfs, 18 | Ethernet.SRIOV.VFS_SUBTREE: _create_vfs_ids_subtree( 19 | numvfs 20 | ), 21 | } 22 | }, 23 | } 24 | ] 25 | } 26 | 27 | return state 28 | 29 | 30 | def _create_vfs_ids_subtree(num): 31 | return [{Ethernet.SRIOV.VFS.ID: id} for id in range(num)] if num else [] 32 | -------------------------------------------------------------------------------- /lib/vdsm/network/tc/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmnetworktcdir = $(vdsmpylibdir)/network/tc 7 | dist_vdsmnetworktc_PYTHON = \ 8 | __init__.py \ 9 | _parser.py \ 10 | _wrapper.py \ 11 | cls.py \ 12 | filter.py \ 13 | qdisc.py \ 14 | $(NULL) 15 | -------------------------------------------------------------------------------- /lib/vdsm/network/validator.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.network.ip import validator as ip_validator 8 | from vdsm.network.link import validator as link_validator 9 | from vdsm.network import netswitch 10 | 11 | 12 | def validate(networks, bondings, net_info, running_config): 13 | link_validator.validate(networks, bondings) 14 | ip_validator.validate(networks) 15 | netswitch.configurator.validate( 16 | networks, bondings, net_info, running_config 17 | ) 18 | -------------------------------------------------------------------------------- /lib/vdsm/ppc64HardwareInfo.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | import os.path 7 | 8 | from vdsm import cpuinfo 9 | from vdsm.common import cache 10 | 11 | 12 | def _from_device_tree(tree_property, tree_path='/proc/device-tree'): 13 | path = os.path.join(tree_path, tree_property) 14 | try: 15 | with open(path) as f: 16 | value = f.readline().rstrip('\0').replace(',', '') 17 | return value 18 | except IOError: 19 | return 'unavailable' 20 | 21 | 22 | @cache.memoized 23 | def getHardwareInfoStructure(): 24 | return { 25 | 'systemSerialNumber': cpuinfo.ppcmodel(), 26 | 'systemFamily': cpuinfo.platform(), 27 | 'systemVersion': cpuinfo.machine(), 28 | 'systemUUID': _from_device_tree('system-id'), 29 | 'systemProductName': _from_device_tree('model-name'), 30 | 'systemManufacturer': _from_device_tree('vendor'), 31 | } 32 | -------------------------------------------------------------------------------- /lib/vdsm/profiling/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmprofilingdir = $(vdsmpylibdir)/profiling 7 | dist_vdsmprofiling_PYTHON = \ 8 | __init__.py \ 9 | cpu.py \ 10 | errors.py \ 11 | memory.py \ 12 | profile.py \ 13 | $(NULL) 14 | -------------------------------------------------------------------------------- /lib/vdsm/profiling/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/profiling/errors.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | """ 7 | This module provides exceptions for the profiling package. 8 | """ 9 | 10 | 11 | class UsageError(Exception): 12 | """ Raised when profiler is used incorrectly """ 13 | -------------------------------------------------------------------------------- /lib/vdsm/profiling/profile.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | """ 7 | profiling facade. 8 | """ 9 | 10 | from . import cpu 11 | from . import memory 12 | 13 | 14 | def start(): 15 | cpu.start() 16 | memory.start() 17 | 18 | 19 | def stop(): 20 | cpu.stop() 21 | memory.stop() 22 | 23 | 24 | def status(): 25 | res = {} 26 | for profiler in (cpu, memory): 27 | res[profiler.__name__] = { 28 | "enabled": profiler.is_enabled(), 29 | "running": profiler.is_running() 30 | } 31 | return res 32 | -------------------------------------------------------------------------------- /lib/vdsm/rpc/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vdsmrpcdir = $(vdsmpylibdir)/rpc 5 | 6 | dist_vdsmrpc_PYTHON = \ 7 | __init__.py \ 8 | http.py \ 9 | bindingjsonrpc.py \ 10 | Bridge.py \ 11 | $(NULL) 12 | -------------------------------------------------------------------------------- /lib/vdsm/rpc/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/storage/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | -------------------------------------------------------------------------------- /lib/vdsm/storage/dmsetup.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | import os 7 | 8 | from vdsm.common import commands 9 | from vdsm.common import supervdsm 10 | from vdsm.constants import EXT_DMSETUP 11 | 12 | 13 | def status(target=None): 14 | lines = run_status(target=target).decode("utf-8").splitlines() 15 | 16 | # Handle the special "No devices found" case. 17 | # See https://bugzilla.redhat.com/1787541 18 | if len(lines) == 1 and ":" not in lines[0]: 19 | return 20 | 21 | for line in lines: 22 | name, status = line.split(":", 1) 23 | yield name, status 24 | 25 | 26 | def run_status(target=None): 27 | if os.geteuid() != 0: 28 | return supervdsm.getProxy().dmsetup_run_status(target) 29 | 30 | cmd = [EXT_DMSETUP, "status"] 31 | if target is not None: 32 | cmd.extend(["--target", target]) 33 | 34 | out = commands.run(cmd) 35 | return out 36 | -------------------------------------------------------------------------------- /lib/vdsm/storage/fsutils.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | import io 6 | import os 7 | 8 | 9 | def size(filename): 10 | """ 11 | Return actual file size, should work with both file and block device. 12 | """ 13 | with io.open(filename, "rb") as f: 14 | f.seek(0, os.SEEK_END) 15 | return f.tell() 16 | -------------------------------------------------------------------------------- /lib/vdsm/storage/fuser.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | from vdsm import constants 7 | 8 | from vdsm.storage import misc 9 | 10 | 11 | def fuser(path, mountPoint=False): 12 | cmd = [constants.EXT_FUSER] 13 | if mountPoint: 14 | cmd.append("-m") 15 | 16 | cmd.append(path) 17 | (rc, out, err) = misc.execCmd(cmd, raw=True) 18 | if rc != 0: 19 | return [] 20 | 21 | return [int(pid) for pid in out.split()] 22 | -------------------------------------------------------------------------------- /lib/vdsm/storage/lvm.env.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # 5 | # source this into your shell to gain vdsm's view of lvm. 6 | # 7 | export LVM_SYSTEM_DIR=@VDSMRUNDIR@/lvm 8 | -------------------------------------------------------------------------------- /lib/vdsm/storage/protect/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | dist_vdsmexec_SCRIPTS = \ 7 | spmstop.sh \ 8 | $(NULL) 9 | 10 | nodist_vdsmexec_SCRIPTS = \ 11 | spmprotect.sh \ 12 | $(NULL) 13 | 14 | EXTRA_DIST = \ 15 | spmprotect.sh.in \ 16 | $(NULL) 17 | 18 | all-local: \ 19 | $(nodist_vdsm_SCRIPTS) \ 20 | $(NULL) 21 | -------------------------------------------------------------------------------- /lib/vdsm/storage/sdm/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | SUBDIRS = api 5 | 6 | include $(top_srcdir)/build-aux/Makefile.subs 7 | 8 | vdsmsdmdir = $(vdsmpylibdir)/storage/sdm 9 | 10 | dist_vdsmsdm_PYTHON = \ 11 | __init__.py \ 12 | volume_info.py \ 13 | $(NULL) 14 | -------------------------------------------------------------------------------- /lib/vdsm/storage/sdm/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | -------------------------------------------------------------------------------- /lib/vdsm/storage/sdm/api/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsmsdmapidir = $(vdsmpylibdir)/storage/sdm/api 7 | 8 | dist_vdsmsdmapi_PYTHON = \ 9 | __init__.py \ 10 | amend_volume.py \ 11 | add_bitmap.py \ 12 | base.py \ 13 | copy_data.py \ 14 | clear_bitmaps.py \ 15 | merge.py \ 16 | move_device.py \ 17 | reduce_domain.py \ 18 | remove_bitmap.py \ 19 | sparsify_volume.py \ 20 | update_volume.py \ 21 | $(NULL) 22 | -------------------------------------------------------------------------------- /lib/vdsm/storage/sdm/api/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | -------------------------------------------------------------------------------- /lib/vdsm/storage/sdm/api/base.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | from vdsm import jobs 7 | 8 | 9 | class Job(jobs.Job): 10 | _JOB_TYPE = "storage" 11 | autodelete = True 12 | 13 | def __init__(self, job_id, desc, host_id): 14 | super(Job, self).__init__(job_id, desc) 15 | self.host_id = host_id 16 | -------------------------------------------------------------------------------- /lib/vdsm/storage/sdm/api/update_volume.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | from vdsm.storage import guarded 7 | from vdsm.storage import validators 8 | 9 | from .copy_data import CopyDataDivEndpoint 10 | from . import base 11 | 12 | 13 | class Job(base.Job): 14 | 15 | def __init__(self, job_id, host_id, vol_info, vol_attr): 16 | super(Job, self).__init__(job_id, 'update_volume', host_id) 17 | self._endpoint = CopyDataDivEndpoint(vol_info, host_id) 18 | self._vol_attr = validators.VolumeAttributes(vol_attr) 19 | 20 | def _run(self): 21 | with guarded.context(self._endpoint.locks): 22 | self._endpoint.volume.update_attributes(self._endpoint.generation, 23 | self._vol_attr) 24 | -------------------------------------------------------------------------------- /lib/vdsm/storage/utils.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from vdsm.storage import constants as sc 5 | 6 | 7 | def next_generation(current_generation): 8 | # Increment a generation value and wrap to 0 after MAX_GENERATION 9 | return (current_generation + 1) % (sc.MAX_GENERATION + 1) 10 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | supervdsm_apidir = $(vdsmpylibdir)/supervdsm_api 7 | dist_supervdsm_api_PYTHON = \ 8 | __init__.py \ 9 | devicemapper.py \ 10 | dmsetup.py \ 11 | hwinfo.py \ 12 | ksm.py \ 13 | lsof.py \ 14 | managedvolume.py \ 15 | mkimage.py \ 16 | multipath.py \ 17 | nbd.py \ 18 | network.py \ 19 | sanlock_direct.py \ 20 | saslpasswd2.py \ 21 | systemctl.py \ 22 | test.py \ 23 | udev.py \ 24 | virt.py \ 25 | $(NULL) 26 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | 8 | def expose(func): 9 | func.exposed_api = True 10 | return func 11 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/devicemapper.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.storage import devicemapper 8 | from . import expose 9 | 10 | 11 | @expose 12 | def devicemapper_removeMapping(deviceName): 13 | return devicemapper.removeMapping(deviceName) 14 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/dmsetup.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.storage import dmsetup 8 | from . import expose 9 | 10 | 11 | @expose 12 | def dmsetup_run_status(target=None): 13 | return dmsetup.run_status(target) 14 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/lsof.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from vdsm.storage import lsof 5 | from . import expose 6 | 7 | 8 | @expose 9 | def lsof_run(path): 10 | return lsof.run(path) 11 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/managedvolume.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.storage import managedvolume 8 | from . import expose 9 | 10 | 11 | @expose 12 | def managedvolume_run_helper(cmd, cmd_input=None): 13 | return managedvolume.run_helper(cmd, cmd_input=cmd_input) 14 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/mkimage.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from . import expose 8 | 9 | from vdsm.mkimage import getFileName, injectFilesToFs, mkFloppyFs, \ 10 | mkIsoFs, removeFs 11 | 12 | 13 | expose(getFileName) 14 | expose(injectFilesToFs) 15 | expose(mkFloppyFs) 16 | expose(mkIsoFs) 17 | expose(removeFs) 18 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/multipath.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.storage import multipath 8 | from . import expose 9 | 10 | 11 | @expose 12 | def multipath_resize_map(name): 13 | return multipath.resize_map(name) 14 | 15 | 16 | @expose 17 | def multipath_is_ready(): 18 | return multipath.is_ready() 19 | 20 | 21 | @expose 22 | def multipath_get_scsi_serial(physdev): 23 | return multipath.get_scsi_serial(physdev) 24 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/nbd.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.storage import nbd 8 | 9 | from . import expose 10 | 11 | 12 | @expose 13 | def nbd_start_transient_service(server_id, config): 14 | return nbd.start_transient_service(server_id, config) 15 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/sanlock_direct.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from vdsm.storage import sanlock_direct 5 | from vdsm.storage import constants as sc 6 | from . import expose 7 | 8 | 9 | @expose 10 | def sanlock_direct_run_dump( 11 | path, 12 | offset=0, 13 | size=None, 14 | block_size=sc.BLOCK_SIZE_512, 15 | alignment=sc.ALIGNMENT_1M): 16 | 17 | return sanlock_direct.run_dump( 18 | path=path, 19 | offset=offset, 20 | size=size, 21 | block_size=block_size, 22 | alignment=alignment) 23 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/saslpasswd2.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | from vdsm.virt import saslpasswd2 7 | from . import expose 8 | 9 | 10 | @expose 11 | def saslpasswd2_set_vnc_password(username, passwd): 12 | return saslpasswd2.set_vnc_password(username, passwd) 13 | 14 | 15 | @expose 16 | def saslpasswd2_remove_vnc_password(username): 17 | return saslpasswd2.remove_vnc_password(username) 18 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/systemctl.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.common import systemctl 8 | from . import expose 9 | 10 | 11 | @expose 12 | def systemctl_stop(name): 13 | return systemctl.stop(name) 14 | 15 | 16 | @expose 17 | def systemctl_enable(name): 18 | return systemctl.enable(name) 19 | -------------------------------------------------------------------------------- /lib/vdsm/supervdsm_api/test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | from . import expose 7 | 8 | 9 | @expose 10 | def ping(*args, **kwargs): 11 | # This method exists for testing purposes 12 | return True 13 | -------------------------------------------------------------------------------- /lib/vdsm/tool/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | SUBDIRS=configurators 5 | 6 | include $(top_srcdir)/build-aux/Makefile.subs 7 | 8 | dist_vdsmtool_PYTHON = \ 9 | __init__.py \ 10 | config_lvm_filter.py \ 11 | confmeta.py \ 12 | confutils.py \ 13 | dummybr.py \ 14 | dump_volume_chains.py \ 15 | network.py \ 16 | nwfilter.py \ 17 | configfile.py \ 18 | configurator.py \ 19 | register.py \ 20 | service.py \ 21 | transient.py \ 22 | upgrade.py \ 23 | vdsm-id.py \ 24 | vdsm_config.py \ 25 | common.py \ 26 | check_volume_leases.py \ 27 | xleases.py \ 28 | $(NULL) 29 | 30 | CLEANFILES = \ 31 | config.log \ 32 | $(nodist_vdsmtool_PYTHON) \ 33 | $(nodist_vdsmexec_SCRIPTS) \ 34 | $(NULL) 35 | 36 | all-local: \ 37 | $(nodist_vdsmtool_PYTHON) \ 38 | $(nodist_vdsmexec_SCRIPTS) \ 39 | $(NULL) 40 | -------------------------------------------------------------------------------- /lib/vdsm/tool/common.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | from __future__ import print_function 7 | 8 | from six.moves import input 9 | 10 | 11 | def confirm(msg): 12 | """ 13 | Display a message to the user and wait for confirmation. 14 | 15 | Arguments: 16 | msg (string) - message to display 17 | 18 | Returns: 19 | True if the user confirmed the message, False otherwise 20 | """ 21 | while True: 22 | try: 23 | res = input(msg) 24 | res = res.strip().lower() 25 | except KeyboardInterrupt: 26 | print() 27 | return False 28 | if res in ("no", ""): 29 | return False 30 | if res == "yes": 31 | return True 32 | -------------------------------------------------------------------------------- /lib/vdsm/tool/configurators/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | dist_configurators_PYTHON = \ 7 | __init__.py \ 8 | bond_defaults.py \ 9 | certificates.py \ 10 | libvirt.py \ 11 | lvm.py \ 12 | managedvolumedb.py \ 13 | multipath.py \ 14 | passwd.py \ 15 | sanlock.py \ 16 | sebool.py \ 17 | $(NULL) 18 | -------------------------------------------------------------------------------- /lib/vdsm/tool/configurators/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | from vdsm.tool import UsageError 7 | 8 | 9 | class InvalidConfig(UsageError): 10 | """ raise when invalid configuration passed """ 11 | pass 12 | 13 | 14 | class InvalidRun(UsageError): 15 | """ raise when the environment is not valid to run the command """ 16 | pass 17 | 18 | 19 | # Declare state of configuration 20 | # 21 | # YES = Module configured. 22 | # 23 | # NO = Module not configured before. 24 | # 25 | # MAYBE = Module configured before, 26 | # configuration validity could not be determined. 27 | # 28 | # See also --force at configurators.py. 29 | YES, NO, MAYBE = tuple(range(3)) 30 | -------------------------------------------------------------------------------- /lib/vdsm/tool/configurators/bond_defaults.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import os 8 | 9 | from vdsm import constants 10 | from vdsm.network.link.bond import sysfs_options_mapper 11 | 12 | from . import YES, NO 13 | 14 | 15 | BONDING_DEFAULTS = constants.P_VDSM_RUN + 'bonding-defaults.json' 16 | 17 | 18 | def isconfigured(): 19 | return YES if os.path.exists(BONDING_DEFAULTS) else NO 20 | 21 | 22 | def configure(): 23 | sysfs_options_mapper.dump_bonding_options() 24 | -------------------------------------------------------------------------------- /lib/vdsm/tool/vdsm-id.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | from .. import host 7 | from . import expose, ExtraArgsError 8 | import sys 9 | 10 | 11 | @expose("vdsm-id") 12 | def getUUID(*args): 13 | """ 14 | vdsm-id 15 | Printing host uuid 16 | """ 17 | if len(args) > 1: 18 | raise ExtraArgsError() 19 | hostUUID = host.uuid() 20 | if hostUUID is None: 21 | raise EnvironmentError('Cannot retrieve host UUID') 22 | sys.stdout.write(hostUUID + '\n') 23 | return 0 24 | -------------------------------------------------------------------------------- /lib/vdsm/tool/vdsm_config.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from vdsm.common import config 5 | from . import expose 6 | 7 | 8 | @expose("show-default-config") 9 | def show_default_config(*args): 10 | """ 11 | show-default-config 12 | 13 | Prints the default configuration used for VDSM. 14 | """ 15 | config.print_config() 16 | -------------------------------------------------------------------------------- /lib/vdsm/virt/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | SUBDIRS = jobs libvirthook vmdevices 7 | 8 | vdsmvirtdir = $(vdsmpylibdir)/virt 9 | dist_vdsmvirt_PYTHON = *.py 10 | -------------------------------------------------------------------------------- /lib/vdsm/virt/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/vdsm/virt/blockjob.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import libvirt 8 | 9 | # Map virDomainBlockJobType to name. 10 | _TYPE = { 11 | libvirt.VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN: "UNKNOWN", 12 | libvirt.VIR_DOMAIN_BLOCK_JOB_TYPE_PULL: "PULL", 13 | libvirt.VIR_DOMAIN_BLOCK_JOB_TYPE_COPY: "COPY", 14 | libvirt.VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT: "COMMIT", 15 | libvirt.VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT: "ACTIVE_COMMIT", 16 | } 17 | 18 | # Require libvirt 6.0, available in RHEL 8.2 and Fedora 30. 19 | # pylint: disable=no-member 20 | if hasattr(libvirt, "VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP"): 21 | _TYPE[libvirt.VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP] = "BACKUP" 22 | 23 | 24 | def type_name(job_type): 25 | return _TYPE.get(job_type, "Unknown job type {}".format(job_type)) 26 | -------------------------------------------------------------------------------- /lib/vdsm/virt/displaynetwork.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.network import api as net_api 8 | from vdsm.virt import libvirtnetwork 9 | 10 | 11 | def create_network(netname, user_reference=None): 12 | display_device = _display_device(netname) 13 | libvirtnetwork.create_network(netname, display_device, user_reference) 14 | 15 | 16 | def delete_network(netname, user_reference=None): 17 | libvirtnetwork.delete_network(netname, user_reference) 18 | 19 | 20 | def _display_device(netname): 21 | return net_api.network_northbound(netname) 22 | -------------------------------------------------------------------------------- /lib/vdsm/virt/errors.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | """ 5 | Internal errors. 6 | 7 | For public error see lib.vdsm.common.exception. 8 | """ 9 | 10 | from vdsm.common.errors import Base # noqa: F401 (unused import) 11 | 12 | 13 | class StorageUnavailableError(Exception): 14 | pass 15 | -------------------------------------------------------------------------------- /lib/vdsm/virt/jobs/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | vdsm_virt_jobsdir = $(vdsmpylibdir)/virt/jobs 7 | 8 | dist_vdsm_virt_jobs_PYTHON = \ 9 | __init__.py \ 10 | seal.py \ 11 | snapshot.py \ 12 | $(NULL) 13 | -------------------------------------------------------------------------------- /lib/vdsm/virt/jobs/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm import jobs 8 | from vdsm.common import concurrent 9 | 10 | 11 | class Job(jobs.Job): 12 | _JOB_TYPE = "virt" 13 | autodelete = True 14 | 15 | 16 | def schedule(job): 17 | t = concurrent.thread(job.run, name="virt/" + job.id[:8]) 18 | t.start() 19 | -------------------------------------------------------------------------------- /lib/vdsm/virt/libvirthook/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | dist_vdsmexec_SCRIPTS = \ 7 | vm_libvirt_hook.py \ 8 | $(NULL) 9 | -------------------------------------------------------------------------------- /lib/vdsm/virt/libvirthook/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | -------------------------------------------------------------------------------- /lib/vdsm/virt/vmdevices/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vmdevicesdir = $(vdsmpylibdir)/virt/vmdevices 5 | 6 | dist_vmdevices_PYTHON = \ 7 | __init__.py \ 8 | common.py \ 9 | compat.py \ 10 | core.py \ 11 | drivename.py \ 12 | graphics.py \ 13 | hostdevice.py \ 14 | hwclass.py \ 15 | lease.py \ 16 | lookup.py \ 17 | network.py \ 18 | storage.py \ 19 | storagexml.py \ 20 | $(NULL) 21 | -------------------------------------------------------------------------------- /lib/vdsm/virt/vmdevices/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from . import core 8 | from . import hostdevice 9 | from . import hwclass 10 | from . import graphics 11 | from . import lease 12 | from . import network 13 | from . import storage 14 | from . import storagexml 15 | from . import common 16 | 17 | # Silence pyflakes 18 | common, core, graphics, hostdevice, hwclass, lease, network, storage 19 | storagexml 20 | -------------------------------------------------------------------------------- /lib/vdsm/virt/vmdevices/drivename.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | 8 | from vdsm.common import base26 9 | 10 | 11 | _DEVNAMES = { 12 | 'ide': 'hd', 13 | 'scsi': 'sd', 14 | 'virtio': 'vd', 15 | 'fdc': 'fd', 16 | 'sata': 'sd', 17 | } 18 | 19 | 20 | _DEVIFACES = { 21 | 'hd': 'ide', 22 | 'sd': 'scsi', # SATA will be alias for SCSI 23 | 'vd': 'virtio', 24 | 'fd': 'fdc', 25 | } 26 | 27 | 28 | def make(interface, index): 29 | devindex = base26.encode(index) 30 | return _DEVNAMES.get(interface, 'hd') + devindex 31 | 32 | 33 | def split(devname): 34 | prefix = devname[:2] 35 | if prefix not in _DEVIFACES: 36 | raise ValueError('Unrecognized device name: %s', devname) 37 | return _DEVIFACES[prefix], base26.decode(devname[2:]) 38 | -------------------------------------------------------------------------------- /lib/vdsm/virt/vmdevices/hwclass.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | 8 | DISK = 'disk' 9 | NIC = 'interface' 10 | GRAPHICS = 'graphics' 11 | HOSTDEV = 'hostdev' 12 | LEASE = 'lease' 13 | 14 | 15 | # libvirt is not giving back aliases 16 | WITHOUT_ALIAS = GRAPHICS 17 | 18 | # devices that needs updates per-host basis from Vdsm 19 | TO_REFRESH = ( 20 | DISK, # needed because of local preparation, localdisk hook 21 | NIC, # needed by many network-related hooks (vmfex, ovn) 22 | ) 23 | 24 | HOTPLUGGABLE = (DISK, NIC, LEASE,) 25 | -------------------------------------------------------------------------------- /lib/vdsm/virt/vmstatus.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import libvirt 8 | 9 | UP = 'Up' 10 | DOWN = 'Down' 11 | MIGRATION_SOURCE = 'Migration Source' 12 | MIGRATION_DESTINATION = 'Migration Destination' 13 | PAUSED = 'Paused' 14 | POWERING_DOWN = 'Powering down' 15 | POWERING_UP = 'Powering up' 16 | REBOOT_IN_PROGRESS = 'RebootInProgress' 17 | RESTORING_STATE = 'Restoring state' 18 | SAVING_STATE = 'Saving State' 19 | WAIT_FOR_LAUNCH = 'WaitForLaunch' 20 | 21 | PAUSED_STATES = (POWERING_DOWN, REBOOT_IN_PROGRESS, UP) 22 | 23 | LIBVIRT_DOWN_STATES = ( 24 | libvirt.VIR_DOMAIN_SHUTOFF, 25 | libvirt.VIR_DOMAIN_CRASHED, 26 | ) 27 | -------------------------------------------------------------------------------- /lib/vdsm/virt/xmlconstants.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | 8 | _METADATA_PREFIX = 'ovirt' 9 | 10 | METADATA_VM_VDSM_URI = 'http://ovirt.org/vm/1.0' 11 | METADATA_VM_VDSM_ELEMENT = 'vm' 12 | METADATA_VM_VDSM_PREFIX = _METADATA_PREFIX + '-vm' 13 | 14 | METADATA_VM_TUNE_URI = 'http://ovirt.org/vm/tune/1.0' 15 | METADATA_VM_TUNE_ELEMENT = 'qos' 16 | METADATA_VM_TUNE_PREFIX = _METADATA_PREFIX + '-tune' 17 | -------------------------------------------------------------------------------- /lib/vdsm/virtsparsify.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from vdsm.virt.utils import LibguestfsCommand 5 | 6 | _VIRTSPARSIFY = LibguestfsCommand("/usr/bin/virt-sparsify") 7 | 8 | 9 | def sparsify_inplace(vol_path): 10 | """ 11 | Sparsify the volume in place 12 | (without copying from an input disk to an output disk) 13 | 14 | :param vol_path: path to the volume 15 | """ 16 | _VIRTSPARSIFY.run(['--machine-readable', '--in-place', vol_path]) 17 | -------------------------------------------------------------------------------- /lib/vdsm/virtsysprep.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from vdsm.virt.utils import LibguestfsCommand 5 | 6 | _VIRTSYSPREP = LibguestfsCommand("/usr/bin/virt-sysprep") 7 | 8 | 9 | def sysprep(vm_id, vol_paths): 10 | """ 11 | Run virt-sysprep on the list of volumes 12 | 13 | :param vol_paths: list of volume paths 14 | """ 15 | args = ['--hostname', 'localhost', '--selinux-relabel'] 16 | for vol_path in vol_paths: 17 | args.extend(('-a', vol_path)) 18 | 19 | _VIRTSYSPREP.run(args, log_tag=vm_id) 20 | -------------------------------------------------------------------------------- /lib/vdsmclient/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vdsmclientdir = $(pythondir)/vdsmclient 5 | 6 | dist_vdsmclient_PYTHON = \ 7 | __init__.py \ 8 | client.py \ 9 | $(NULL) 10 | 11 | -------------------------------------------------------------------------------- /lib/vdsmclient/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /lib/yajsonrpc/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | yajsonrpcdir = $(pythondir)/yajsonrpc 5 | 6 | dist_yajsonrpc_PYTHON = \ 7 | __init__.py \ 8 | betterAsyncore.py \ 9 | exception.py \ 10 | jsonrpcclient.py \ 11 | stompclient.py \ 12 | stompserver.py \ 13 | stomp.py \ 14 | $(NULL) 15 | 16 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | [tool.black] 5 | line-length = 79 6 | skip-string-normalization = true 7 | -------------------------------------------------------------------------------- /static/etc/NetworkManager/conf.d/vdsm.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # VDSM specific configuration. 5 | 6 | [main] 7 | # Order bond slaves based on device names, mimicking initscripts behaviour. 8 | slaves-order=name 9 | -------------------------------------------------------------------------------- /static/etc/libvirt/hooks/qemu: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | DOMAIN="$1" 7 | EVENT="$2" 8 | PHASE="$3" 9 | 10 | export LC_ALL=C.UTF-8 11 | exec /usr/libexec/vdsm/vm_libvirt_hook.py "$DOMAIN" "$EVENT" "$PHASE" 12 | -------------------------------------------------------------------------------- /static/etc/modprobe.d/vdsm-bonding-modprobe.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # VDSM bonding modprobe configuration 5 | options bonding max_bonds=0 6 | -------------------------------------------------------------------------------- /static/etc/modules-load.d/vdsm.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # Kernel modules required by vdsm 5 | bonding 6 | bridge 7 | 8021q 8 | vfio-pci 9 | -------------------------------------------------------------------------------- /static/etc/pki/vdsm/keys/libvirt_password: -------------------------------------------------------------------------------- 1 | shibboleth -------------------------------------------------------------------------------- /static/etc/pki/vdsm/keys/libvirt_password.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /static/etc/security/limits.d/99-vdsm.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # This limits are intended for medium VDSM hosts, for large hosts scale these 5 | # numbers appropriately. 6 | 7 | # nproc should be the maximum amount of storage operations usage. 8 | # VMs run by "qemu" user, vm processes are not relavent to "vdsm" user limits. 9 | vdsm - nproc 4096 10 | 11 | # nofile should be at least 3(stdin,stdour,stderr) * each external process. 12 | # 3 * 4096 = 12288 13 | vdsm - nofile 12288 14 | -------------------------------------------------------------------------------- /static/etc/sudoers.d/50_vdsm.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | Cmnd_Alias VDSM_STORAGE = \ 5 | @FSCK_PATH@ -p *, \ 6 | @TUNE2FS_PATH@ -j *, \ 7 | @MKFS_PATH@ -q -j *, \ 8 | @KILL_PATH@, \ 9 | @CHOWN_PATH@ @VDSMUSER@\:@QEMUGROUP@ *, \ 10 | @CHOWN_PATH@ @METADATAUSER@\:@METADATAGROUP@ *, \ 11 | @ISCSIADM_PATH@ *, \ 12 | @LVM_PATH@, \ 13 | @SETSID_PATH@ @IONICE_PATH@ -c ? -n ? @SU_PATH@ vdsm -s /bin/sh -c /usr/libexec/vdsm/spmprotect.sh*, \ 14 | @SERVICE_PATH@ vdsmd *, \ 15 | @REBOOT_PATH@ -f 16 | 17 | vdsm ALL=(ALL) NOPASSWD: VDSM_STORAGE 18 | Defaults:vdsm !requiretty 19 | Defaults:vdsm !syslog 20 | -------------------------------------------------------------------------------- /static/etc/sysctl.d/vdsm.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # Set dirty page parameters 5 | vm.dirty_ratio = 5 6 | vm.dirty_background_ratio = 2 7 | 8 | # Using iSCSI multipath with multiple interfaces in the same subnet, the 9 | # default OS behaviour won't allow the independent traffic between local NICs 10 | # and iSCSI targets (BZ#1112861). The kernel parameters bellow are needed to 11 | # accomodate this case: 12 | # For the ARP flux problem, where the machine may respond to ARP requests 13 | # from all Ethernet interfaces, we are setting "arp_ignore=1" and 14 | # "arp_announce=2" 15 | net.ipv4.conf.default.arp_ignore = 1 16 | net.ipv4.conf.default.arp_announce = 2 17 | 18 | # locally reserve vdsm and ovirt-imageio ports 19 | net.ipv4.ip_local_reserved_ports=54321,54322 20 | -------------------------------------------------------------------------------- /static/etc/vdsm/logrotate/vdsm: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | /var/log/vdsm/*.log { 5 | rotate 100 6 | missingok 7 | size 15M 8 | compress 9 | compresscmd /usr/bin/xz 10 | uncompresscmd /usr/bin/unxz 11 | compressext .xz 12 | } 13 | -------------------------------------------------------------------------------- /static/etc/vdsm/mom.d/00-defines.policy: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # This file defines python constans that make it easier to convert data 5 | # received by setMOMPolicyParameters 6 | (defvar False 0) 7 | (defvar True 1) 8 | 9 | # Define variables for configurable options here 10 | (defvar ksmMergeAcrossNodes 1) 11 | (defvar ksmEnabled 1) 12 | (defvar balloonEnabled 0) 13 | (defvar cpuTuneEnabled 1) 14 | (defvar ioTuneEnabled 1) 15 | 16 | -------------------------------------------------------------------------------- /static/etc/vdsm/mom.d/01-parameters.policy: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /static/etc/vdsm/svdsm.logger.conf.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # supervdsm logging configuration. 5 | 6 | [loggers] 7 | keys=root,SuperVdsm,Gluster 8 | 9 | [handlers] 10 | keys=logfile,logthread 11 | 12 | [formatters] 13 | keys=long 14 | 15 | [logger_root] 16 | level=DEBUG 17 | handlers=logthread 18 | propagate=0 19 | 20 | [logger_SuperVdsm] 21 | level=DEBUG 22 | handlers=logthread 23 | qualname=SuperVdsm 24 | propagate=0 25 | 26 | [logger_Gluster] 27 | level=DEBUG 28 | handlers=logthread 29 | qualname=Gluster 30 | propagate=0 31 | 32 | [handler_logthread] 33 | class=vdsm.common.logutils.ThreadedHandler 34 | args=[] 35 | level=DEBUG 36 | target=logfile 37 | 38 | [handler_logfile] 39 | class=vdsm.common.logutils.UserGroupEnforcingHandler 40 | args=('root', 'root', '@VDSMLOGDIR@/supervdsm.log',) 41 | level=DEBUG 42 | formatter=long 43 | 44 | [formatter_long] 45 | format: %(threadName)s::%(levelname)s::%(asctime)s::%(module)s::%(lineno)d::%(name)s::(%(funcName)s) %(message)s 46 | -------------------------------------------------------------------------------- /static/libexec/vdsm/get-conf-item: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | # Access python's config files from bash. 7 | # Usage: get-conf-item filename.conf section item default 8 | 9 | from __future__ import absolute_import 10 | from __future__ import print_function 11 | import sys 12 | 13 | try: 14 | from vdsm.config import config 15 | except: 16 | from six.moves import configparser 17 | config = configparser.ConfigParser() 18 | 19 | (dummy, file, section, item, default) = sys.argv 20 | config.read(file) 21 | try: 22 | print(config.get(section, item)) 23 | except: 24 | print(default) 25 | -------------------------------------------------------------------------------- /static/libexec/vdsm/sitecustomize.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from vdsm.config import config 5 | 6 | if config.getboolean('devel', 'coverage_enable'): 7 | import coverage # pylint: disable=import-error 8 | coverage.process_startup() 9 | -------------------------------------------------------------------------------- /static/libexec/vdsm/supervdsmd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | import sys 9 | 10 | from vdsm import supervdsm_server 11 | 12 | supervdsm_server.main(sys.argv[1:]) 13 | -------------------------------------------------------------------------------- /static/libexec/vdsm/vdsmd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. and/or its affiliates. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | from vdsm import vdsmd 9 | 10 | vdsmd.main() 11 | -------------------------------------------------------------------------------- /static/usr/bin/vdsm-client: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | from vdsmclient import client 9 | 10 | client.main() 11 | -------------------------------------------------------------------------------- /static/usr/lib/systemd/system/dev-hugepages1G.mount: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | [Unit] 5 | Description=Huge Pages 1G File System 6 | ConditionPathExists=/sys/kernel/mm/hugepages/hugepages-1048576kB 7 | 8 | [Mount] 9 | What=hugetlbfs 10 | Where=/dev/hugepages1G 11 | Options=pagesize=1G 12 | Type=hugetlbfs 13 | -------------------------------------------------------------------------------- /static/usr/lib/systemd/system/mom-vdsm.service.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | [Unit] 5 | Description=MOM instance configured for VDSM purposes 6 | Requires=vdsmd.service 7 | After=vdsmd.service 8 | Conflicts=momd.service ksmtuned.service 9 | 10 | [Service] 11 | Type=simple 12 | LimitCORE=infinity 13 | ExecStart=/usr/sbin/momd -c /etc/vdsm/mom.conf 14 | Restart=always 15 | RestartSec=5 16 | User=@VDSMUSER@ 17 | Group=@VDSMGROUP@ 18 | TimeoutStopSec=@SERVICE_STOP_TIMEOUT@ 19 | StartLimitBurst=10 20 | StartLimitInterval=120 21 | 22 | [Install] 23 | WantedBy=multi-user.target 24 | -------------------------------------------------------------------------------- /static/usr/lib/systemd/system/supervdsmd.service.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | [Unit] 5 | Description=Auxiliary vdsm service for running helper functions as root 6 | Requires=libvirtd.service 7 | Wants=lldpad.service 8 | After=lldpad.service libvirtd.service 9 | 10 | [Service] 11 | Type=simple 12 | LimitCORE=infinity 13 | EnvironmentFile=-/etc/sysconfig/supervdsmd 14 | ExecStart=@LIBEXECDIR@/daemonAdapter "@LIBEXECDIR@/supervdsmd" --sockfile "@VDSMRUNDIR@/svdsm.sock" 15 | Restart=always 16 | -------------------------------------------------------------------------------- /static/usr/lib/systemd/system/vdsm-network.service.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | [Unit] 5 | Description=Virtual Desktop Server Manager network restoration 6 | Wants=network.target 7 | Requires=libvirtd.service openvswitch.service NetworkManager.service 8 | After=libvirtd.service openvswitch.service NetworkManager.service 9 | 10 | [Service] 11 | Type=oneshot 12 | EnvironmentFile=-/etc/sysconfig/vdsm 13 | ExecStartPre=@BINDIR@/vdsm-tool dump-bonding-options 14 | ExecStart=@BINDIR@/vdsm-tool restore-nets 15 | RemainAfterExit=yes 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /static/usr/share/polkit-1/rules.d/10-vdsm-libvirt-access.rules: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # VDSM libvirt management permissions 5 | 6 | polkit.addRule(function(action, subject) { 7 | if (action.id == "org.libvirt.unix.manage" && 8 | subject.user == "vdsm") { 9 | return polkit.Result.YES; 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /tests/apiData.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2012 Adam Litke, IBM Corporation 2 | # SPDX-FileCopyrightText: Red Hat, Inc. 3 | # SPDX-License-Identifier: GPL-2.0-or-later 4 | 5 | from __future__ import absolute_import 6 | from __future__ import division 7 | 8 | 9 | class APIData(object): 10 | def __init__(self, obj, meth, data): 11 | self.obj = obj 12 | self.meth = meth 13 | self.data = data 14 | 15 | 16 | testPing_apidata = [ 17 | APIData('Global', 'ping', { 18 | 'status': {'code': 0, 'message': 'OK'}}) 19 | ] 20 | 21 | testPingError_apidata = [ 22 | APIData('Global', 'ping', { 23 | 'status': {'code': 1, 'message': 'Fake error'}}) 24 | ] 25 | -------------------------------------------------------------------------------- /tests/caps_numactl_4_nodes.out: -------------------------------------------------------------------------------- 1 | available: 4 nodes (0-3) 2 | node 0 cpus: 0 1 2 3 4 5 6 7 3 | node 0 size: 65525 MB 4 | node 0 free: 63748 MB 5 | node 1 cpus: 8 9 10 11 12 13 14 15 6 | node 1 size: 65536 MB 7 | node 1 free: 63995 MB 8 | node 2 cpus: 16 17 18 19 20 21 22 23 9 | node 2 size: 65536 MB 10 | node 2 free: 64100 MB 11 | node 3 cpus: 24 25 26 27 28 29 30 31 12 | node 3 size: 65535 MB 13 | node 3 free: 64025 MB 14 | node distances: 15 | node 0 1 2 3 16 | 0: 10 20 20 20 17 | 1: 20 10 20 20 18 | 2: 20 20 10 20 19 | 3: 20 20 20 10 20 | -------------------------------------------------------------------------------- /tests/caps_numactl_4_nodes.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/check_rpms.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | # enable complex globs 7 | shopt -s extglob 8 | 9 | ARTIFACTS_DIR=$1 10 | 11 | export LC_ALL=C.UTF8 # no idea why this is suddenly needed 12 | 13 | rpmlint "$ARTIFACTS_DIR/"*.src.rpm 14 | 15 | # TODO: fix spec to stop ignoring the few current errors 16 | ! rpmlint "$ARTIFACTS_DIR/"!(*.src).rpm | \ 17 | grep ': E: ' | \ 18 | grep -v explicit-lib-dependency | \ 19 | grep -v no-binary | \ 20 | grep -v non-readable | \ 21 | grep -v non-standard-dir-perm | \ 22 | grep -v missing-dependency-to-cron # FIXME: missing-dependency-to-cron check is broken in rpmlint 1.11, valid check is available since ver. 2.1 23 | -------------------------------------------------------------------------------- /tests/common/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/common/fileutils_tests_qemu.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vnc_tls_x509_cert_dir="/etc/pki/vdsm/libvirt-vnc" 5 | dynamic_ownership=0 6 | lock_manager="sanlock" 7 | max_core="unlimited" 8 | remote_display_port_max=6923 9 | remote_display_port_min=5900 10 | save_image_format="raw" 11 | spice_tls=1 12 | migrate_tls_x509_cert_dir="/etc/pki/vdsm/libvirt-migrate" 13 | spice_tls_x509_cert_dir="/etc/pki/vdsm/libvirt-spice" 14 | vnc_tls=1 15 | #vnc_commented=1 16 | -------------------------------------------------------------------------------- /tests/conf/svdsm.logger.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # supervdsm logging configuration for testing. 5 | 6 | [loggers] 7 | keys=root,SuperVdsm,Gluster 8 | 9 | [handlers] 10 | keys=logfile 11 | 12 | [formatters] 13 | keys=long 14 | 15 | [logger_root] 16 | level=DEBUG 17 | handlers=logfile 18 | propagate=0 19 | 20 | [logger_SuperVdsm] 21 | level=DEBUG 22 | handlers=logfile 23 | qualname=SuperVdsm 24 | propagate=0 25 | 26 | [logger_Gluster] 27 | level=DEBUG 28 | handlers=logfile 29 | qualname=Gluster 30 | propagate=0 31 | 32 | [handler_logfile] 33 | class=StreamHandler 34 | args=[] 35 | level=DEBUG 36 | formatter=long 37 | 38 | [formatter_long] 39 | format: %(threadName)s::%(levelname)s::%(asctime)s::%(module)s::%(lineno)d::%(name)s::(%(funcName)s) %(message)s 40 | -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | """ 5 | Common fixtures that can be used without importing anything. 6 | """ 7 | 8 | from __future__ import absolute_import 9 | from __future__ import division 10 | 11 | import pytest 12 | 13 | 14 | @pytest.fixture 15 | def fake_executeable(tmpdir): 16 | """ 17 | Prepares shell script which can be used by another fixture to fake a binary 18 | that is called in the test. Typical usage is to fake the binary output in 19 | the script. 20 | """ 21 | path = tmpdir.join("fake-executable") 22 | path.ensure() 23 | path.chmod(0o755) 24 | 25 | return path 26 | -------------------------------------------------------------------------------- /tests/cpuinfo/cpuinfo_z196_s390x.out: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vendor_id : IBM/S390 5 | # processors : 3 6 | bogomips per cpu: 14367.00 7 | features : esan3 zarch stfle msa ldisp eimm dfp etf3eh highgprs 8 | cache0 : level=1 type=Data scope=Private size=128K line_size=256 associativity=8 9 | cache1 : level=1 type=Instruction scope=Private size=64K line_size=256 associativity=4 10 | cache2 : level=2 type=Unified scope=Private size=1536K line_size=256 associativity=12 11 | cache3 : level=3 type=Unified scope=Shared size=24576K line_size=256 associativity=12 12 | cache4 : level=4 type=Unified scope=Shared size=196608K line_size=256 associativity=24 13 | processor 0: version = FF, identification = 000123, machine = 2817 14 | processor 1: version = FF, identification = 100123, machine = 2817 15 | processor 2: version = FF, identification = 200123, machine = 2817 16 | -------------------------------------------------------------------------------- /tests/devices/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/devices/data/block_sda_ssd.xml: -------------------------------------------------------------------------------- 1 | 2 | block_sda_ssd 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sdb 4 | scsi_0_0_0_0 5 | 6 | /dev/sda 7 | ata 8 | disk 9 | SSD 10 | ATA 11 | 1234 12 | 1 13 | 1 14 | 1 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/devices/data/block_sda_ssd.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/computer.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/oVirt/vdsm/cef17bfe355d95e53dc4443af1a52c63de0ab9e6/tests/devices/data/computer.xml -------------------------------------------------------------------------------- /tests/devices/data/computer.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/devicetree.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/net_em1_28_d2_44_55_66_88.xml: -------------------------------------------------------------------------------- 1 | 2 | net_em1_28_d2_44_55_66_88 3 | /sys/devices/pci0000:00/0000:00:19.0/net/em1 4 | pci_0000_00_19_0 5 | 6 | em1 7 |
28:d2:44:55:66:88
8 | 9 | 10 | 11 |
12 | -------------------------------------------------------------------------------- /tests/devices/data/net_em1_28_d2_44_55_66_88.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_02_0.xml: -------------------------------------------------------------------------------- 1 | 2 | pci_0000_00_02_0 3 | /sys/devices/pci0000:00/0000:00:02.0 4 | computer 5 | 6 | i915 7 | 8 | 9 | 0 10 | 0 11 | 2 12 | 0 13 | 2nd Generation Core Processor Family Integrated Graphics Controller 14 | Intel Corporation 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_02_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_09_0.xml: -------------------------------------------------------------------------------- 1 | 2 | pci_0000_00_09_0 3 | /sys/devices/pci0000:00/0000:00:09.0 4 | computer 5 | 6 | pcieport 7 | 8 | 9 | 0 10 | 0 11 | 9 12 | 0 13 | 7500/5520/5500/X58 I/O Hub PCI Express Root Port 9 14 | Intel Corporation 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_09_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_19_0.xml: -------------------------------------------------------------------------------- 1 | 2 | pci_0000_00_19_0 3 | /sys/devices/pci0000:00/0000:00:19.0 4 | computer 5 | 6 | e1000e 7 | 8 | 9 | 0 10 | 0 11 | 25 12 | 0 13 | 82579LM Gigabit Network Connection 14 | Intel Corporation 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_19_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_1a_0.xml: -------------------------------------------------------------------------------- 1 | 2 | pci_0000_00_1a_0 3 | /sys/devices/pci0000:00/0000:00:1a.0 4 | computer 5 | 6 | 0 7 | 0 8 | 26 9 | 0 10 | 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 11 | Intel Corporation 12 | 13 | 14 | -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_1a_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_1b_0.xml: -------------------------------------------------------------------------------- 1 | 2 | pci_0000_00_1b_0 3 | /sys/devices/pci0000:00/0000:00:1b.0 4 | computer 5 | 6 | snd_hda_intel 7 | 8 | 9 | 0 10 | 0 11 | 27 12 | 0 13 | 6 Series/C200 Series Chipset Family High Definition Audio Controller 14 | Intel Corporation 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_1b_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_1f_2.xml: -------------------------------------------------------------------------------- 1 | 2 | pci_0000_00_1f_2 3 | /sys/devices/pci0000:00/0000:00:1f.2 4 | computer 5 | 6 | ahci 7 | 8 | 9 | 0 10 | 0 11 | 31 12 | 2 13 | 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller 14 | Intel Corporation 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_00_1f_2.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_05_00_1.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_05_10_7.xml: -------------------------------------------------------------------------------- 1 | 2 | pci_0000_05_10_7 3 | /sys/devices/pci0000:00/0000:00:09.0/0000:05:10.7 4 | pci_0000_00_09_0 5 | 6 | igbvf 7 | 8 | 9 | 0 10 | 5 11 | 16 12 | 7 13 | 82576 Virtual Function 14 | Intel Corporation 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_05_10_7.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/pci_0000_06_00_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_0_0_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_0_0_0_0 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0 4 | scsi_target0_0_0 5 | 6 | sd 7 | 8 | 9 | 0 10 | 0 11 | 0 12 | 0 13 | disk 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_0_0_0_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_1_0_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_1_0_0_0 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host1/target1:0:0/1:0:0:0 4 | scsi_target1_0_0 5 | 6 | sd 7 | 8 | 9 | 1 10 | 0 11 | 0 12 | 0 13 | disk 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_1_0_0_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_2_0_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_2_0_0_0 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host2/target2:0:0/2:0:0:0 4 | scsi_target2_0_0 5 | 6 | sd 7 | 8 | 9 | 2 10 | 0 11 | 0 12 | 0 13 | disk 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_2_0_0_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_generic_sg0.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_generic_sg0 3 | /sys/devices/pci0000:00/0000:00:11.4/ata1/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 4 | scsi_0_0_0_0 5 | 6 | /dev/sg0 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_generic_sg0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_generic_sg1.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_generic_sg1 3 | /sys/devices/pci0000:00/0000:00:11.4/ata1/host1/target1:0:0/1:0:0:0/scsi_generic/sg1 4 | scsi_1_0_0_0 5 | 6 | /dev/sg1 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_generic_sg1.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_host0.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_host0 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0 4 | pci_0000_00_1f_2 5 | 6 | 0 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_host0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_host1.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_host1 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host1 4 | pci_0000_00_1f_2 5 | 6 | 1 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_host1.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_host2.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_host2 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host2 4 | pci_0000_00_1f_2 5 | 6 | 2 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_host2.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_target0_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_target0_0_0 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0 4 | scsi_host0 5 | 6 | target0:0:0 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_target0_0_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_target1_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_target1_0_0 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host1/target1:0:0 4 | scsi_host1 5 | 6 | target1:0:0 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_target1_0_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/scsi_target2_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | scsi_target2_0_0 3 | /sys/devices/pci0000:00/0000:00:1f.2/ata1/host2/target2:0:0 4 | scsi_host2 5 | 6 | target2:0:0 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/devices/data/scsi_target2_0_0.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/testComplexVm.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/testSRiovVm.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/usb_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | usb_1_1 3 | /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1 4 | usb_usb1 5 | 6 | usb 7 | 8 | 9 | 1 10 | 2 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/devices/data/usb_1_1.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/usb_1_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | usb_1_1_4 3 | /sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4 4 | usb_1_1 5 | 6 | usb 7 | 8 | 9 | 1 10 | 10 11 | Broadcom Bluetooth Device 12 | Broadcom Corp 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/devices/data/usb_1_1_4.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/usb_usb1.xml: -------------------------------------------------------------------------------- 1 | 2 | usb_usb1 3 | /sys/devices/pci0000:00/0000:00:1a.0/usb1 4 | pci_0000_00_1a_0 5 | 6 | usb 7 | 8 | 9 | 1 10 | 1 11 | EHCI Host Controller 12 | Linux 3.10.0-123.6.3.el7.x86_64 ehci_hcd 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/devices/data/usb_usb1.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/vm_restore_spice_after.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/data/vm_restore_spice_before.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/devices/parsing/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/fake-gluster-cli: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import print_function 6 | 7 | 8 | print(''' 9 | 10 | 0 11 | 0 12 | 13 | 14 | 15 | 16 | vol-2 17 | 1 18 | 19 | 10.70.43.13 20 | /gluster-bricks/brick-2/brick-2 21 | bb8caa37-9dab-4fba-b3d5-418dcf6683c1 22 | 1 23 | 49152 24 | 25 | 49152 26 | N/A 27 | 28 | 19089 29 | 30 | 31 | 32 | 33 | 34 | ''') 35 | -------------------------------------------------------------------------------- /tests/fake-gluster-cli.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/fake-ssh-add: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | from __future__ import print_function 8 | 9 | import getpass 10 | import sys 11 | 12 | if '-D' in sys.argv[1:]: 13 | print('All identities removed.') 14 | else: 15 | print('Identity added: /home/%s/.ssh/id_rsa (/home/%s/.ssh/id_rsa)' % 16 | (getpass.getuser(), getpass.getuser())) 17 | -------------------------------------------------------------------------------- /tests/fake-ssh-agent: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | from __future__ import print_function 8 | 9 | print('''SSH_AUTH_SOCK=/tmp/ssh-IWWQReDk7XZp/agent.31069; export SSH_AUTH_SOCK; 10 | SSH_AGENT_PID=31070; export SSH_AGENT_PID; 11 | echo Agent pid 31070;''') 12 | -------------------------------------------------------------------------------- /tests/fake-virt-sysprep: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | from __future__ import absolute_import 6 | 7 | import io 8 | import argparse 9 | 10 | parser = argparse.ArgumentParser() 11 | 12 | parser.add_argument('-a', '--add', action='append', dest='paths', 13 | help='Add disk image file') 14 | parser.add_argument('--hostname', 15 | help='Set new hostname') 16 | parser.add_argument('--selinux-relabel', 17 | help='Fix SELinux labels in guest', action='store_true') 18 | parser.add_argument('-v', '--verbose', action='store_true', 19 | help='Enable verbose messages for debugging') 20 | parser.add_argument('-x', action='store_true', 21 | help='Enable tracing of libguestfs API calls') 22 | 23 | options = parser.parse_args() 24 | 25 | for path in options.paths: 26 | with io.open(path, 'r+') as imagefile: 27 | imagefile.write(u'fake-virt-sysprep was here') 28 | -------------------------------------------------------------------------------- /tests/fake-virt-v2v.err: -------------------------------------------------------------------------------- 1 | libguestfs: trace: internal_autosync = 0 2 | libguestfs: sending SIGTERM to process 12345 3 | libguestfs: trace: shutdown = 0 4 | libguestfs: trace: close 5 | libguestfs: closing guestfs handle 0x1e265f0 (state 0) 6 | -------------------------------------------------------------------------------- /tests/fake-virt-v2v.err.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/fake-virt-v2v.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/functional/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/fuser_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import os 8 | from tempfile import NamedTemporaryFile 9 | from vdsm.storage import fuser 10 | 11 | from testlib import VdsmTestCase 12 | 13 | 14 | class TestFuser(VdsmTestCase): 15 | 16 | def testSelfExe(self): 17 | pid = os.getpid() 18 | with NamedTemporaryFile() as tempFile: 19 | self.assertIn(pid, fuser.fuser(tempFile.name)) 20 | -------------------------------------------------------------------------------- /tests/gluster/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/gluster/results/getTreeTestData-1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 6 | 7 | d6b27c29-dce0-420e-9982-42f855bca9cd 8 | 9 | -------------------------------------------------------------------------------- /tests/gluster/results/getTreeTestData-1.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/gluster/results/hook_read.json: -------------------------------------------------------------------------------- 1 | { 2 | "checksum": "ba5a391049fb083e5b180a5971bf4c3d9ccd5f97d89fabf57ce25281b29e7abb", 3 | "content": "dGVzdCBicmljayBob29r", 4 | "md5sum": "", 5 | "mimetype": "text/plain" 6 | } -------------------------------------------------------------------------------- /tests/gluster/results/hook_read.json.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/gluster/results/hooks_list.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "status":"ENABLED", 4 | "mimetype":"text/plain", 5 | "name":"11test1.sh", 6 | "level":"PRE", 7 | "checksum":"ba5a391049fb083e5b180a5971bf4c3d9ccd5f97d89fabf57ce25281b29e7abb", 8 | "md5sum":"", 9 | "command":"add-brick" 10 | }, 11 | { 12 | "status":"DISABLED", 13 | "mimetype":"text/plain", 14 | "name":"12test2.sh", 15 | "level":"POST", 16 | "checksum":"d237ee8a8a63a041dc05d4791b9f0341f05ae1a55d8f71c2d9c44500dc8c1f74", 17 | "md5sum":"", 18 | "command":"create" 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /tests/gluster/results/hooks_list.json.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterGeoRepStatus.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterGeoRepStatusOld.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterGlobalVolumeOptions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 6 | 7 | 7 8 | 9 | 10 | 51 11 | 12 | 13 | 14 | disable 15 | 16 | 17 | 18 | 31202 19 | 20 | 21 | 22 | 31202 23 | 24 | 25 | 26 | disable 27 | 28 | 29 | 30 | 0 31 | 32 | 33 | 34 | disable 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/glusterGlobalVolumeOptions.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterSnapshotConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 6 | 7 | 8 | 255 9 | 91% 10 | disable 11 | disable 12 | 13 | 14 | 15 | snap-vol 16 | 256 17 | 255 18 | 232 19 | 20 | 21 | snap-vol2 22 | 254 23 | 254 24 | 231 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/glusterSnapshotConfig.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterSnapshotList.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterSnapshotListEmpty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 6 | 7 | 0 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tests/glusterSnapshotListEmpty.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterSnapshotRestore.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 6 | 7 | 8 | snap-vol2 9 | 8558c40f-1581-414e-89d6-46854376ae3d 10 | 11 | 12 | snap1 13 | ef4b5442-2d6e-498b-9e42-fd0e566ac74c 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/glusterSnapshotRestore.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeGeoRepConfigList.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeHealInfo.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeProfileInfo.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeProfileInfoNfs.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeRebalanceStatus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 6 | 7 | cffd9543-55dc-46ba-a0ac-825aba103948 8 | 3 9 | 1 10 | 11 | localhost 12 | 883626f8-4d29-4d02-8c5d-c9f48c5b2445 13 | 10.2 14 | 78 15 | 79872 16 | 278 17 | 0 18 | 0 19 | 3 20 | completed 21 | 22 | 23 | 10.2 24 | 78 25 | 79872 26 | 278 27 | 0 28 | 0 29 | 3 30 | completed 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/glusterVolumeRebalanceStatus.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeRemoveBricksStatus.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 6 | 7 | 1 8 | 9 | localhost 10 | 883626f8-4d29-4d02-8c5d-c9f48c5b2445 11 | 10.2 12 | 78 13 | 79872 14 | 278 15 | 0 16 | 0 17 | 3 18 | completed 19 | 20 | 21 | 10.2 22 | 78 23 | 79872 24 | 278 25 | 0 26 | 0 27 | 3 28 | completed 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/glusterVolumeRemoveBricksStatus.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeSnapshotList.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeSnapshotListEmpty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 0 5 | 6 | 7 | 8 | sp-vol 9 | 0 10 | 255 11 | 12 | 0 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tests/glusterVolumeSnapshotListEmpty.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/glusterVolumeTasks.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/integration/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/lib/rpc/http_detector_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | import pytest 7 | 8 | from vdsm.rpc.http import HttpDetector 9 | from yajsonrpc import stomp 10 | 11 | 12 | @pytest.mark.parametrize("data", [ 13 | b"PUT /", 14 | b"GET /", 15 | ]) 16 | def test_http_detector_should_detect_http_protocol(data): 17 | assert HttpDetector(server=None).detect(data) 18 | 19 | 20 | @pytest.mark.parametrize("data", [ 21 | b"smth", 22 | b"\x23\x54" 23 | ]) 24 | def test_http_detector_should_reject_non_http_protocol(data): 25 | assert not HttpDetector(server=None).detect(data) 26 | 27 | 28 | @pytest.mark.parametrize("data", [c.encode("utf-8") for c in stomp.COMMANDS]) 29 | def test_http_detector_should_reject_stomp_commands(data): 30 | assert not HttpDetector(server=None).detect(data) 31 | -------------------------------------------------------------------------------- /tests/mem_info.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/network/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/network/functional/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | import pytest 5 | 6 | 7 | pytest.register_assert_rewrite(__name__ + '.netfunctestlib') 8 | -------------------------------------------------------------------------------- /tests/network/integration/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/network/integration/cmd_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from vdsm.network import cmd 5 | 6 | 7 | class TestCmd(object): 8 | def test_exec_sync_with_no_output(self): 9 | _, out, err = cmd.exec_sync(('true',)) 10 | assert out == '' 11 | assert err == '' 12 | 13 | def test_exec_sync_with_success_output(self): 14 | rc, out, err = cmd.exec_sync(('echo', 'hello world')) 15 | assert rc == 0, err 16 | assert out == 'hello world\n' 17 | assert err == '' 18 | 19 | def test_exec_sync_with_error_output(self): 20 | rc, out, err = cmd.exec_sync(('ls', 'no such prog')) 21 | assert rc != 0 22 | assert 'No such file or directory' in err 23 | assert out == '' 24 | -------------------------------------------------------------------------------- /tests/network/integration/dns_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.network import dns 8 | 9 | 10 | class TestNetworkDnsIntegration(object): 11 | def test_read_dns_entries_from_resolv_conf(self): 12 | # Assuming at least one DNS entry exists on the host running the tests 13 | nameservers = dns.get_host_nameservers() 14 | assert nameservers, 'No DNS entries detected' 15 | -------------------------------------------------------------------------------- /tests/network/integration/ethtool_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | import pytest 5 | 6 | from vdsm.network import ethtool 7 | 8 | from network.nettestlib import bridge_device 9 | 10 | 11 | @pytest.fixture 12 | def bridge(): 13 | with bridge_device() as br: 14 | yield br 15 | 16 | 17 | class TestEthtoolDeviceInfo(object): 18 | def test_detect_device_driver(self, bridge): 19 | assert ethtool.driver_name(bridge) == 'bridge' 20 | -------------------------------------------------------------------------------- /tests/network/integration/link_iface_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | import pytest 5 | 6 | from network.nettestlib import dummy_device 7 | 8 | from vdsm.network.link.iface import iface 9 | 10 | 11 | @pytest.fixture 12 | def link_iface(): 13 | with dummy_device() as nic: 14 | _iface = iface(nic) 15 | yield _iface 16 | 17 | 18 | class TestLinkIface(object): 19 | def test_iface_up(self, link_iface): 20 | link_iface.up() 21 | assert link_iface.is_up() 22 | 23 | def test_iface_down(self, link_iface): 24 | link_iface.up() 25 | link_iface.down() 26 | assert not link_iface.is_up() 27 | 28 | def test_iface_notpromisc(self, link_iface): 29 | link_iface.up() 30 | assert not link_iface.is_promisc() 31 | 32 | def test_iface_hwaddr(self, link_iface): 33 | MAC_ADDR = '02:00:00:00:00:01' 34 | 35 | link_iface.set_address(MAC_ADDR) 36 | assert link_iface.address() == MAC_ADDR 37 | -------------------------------------------------------------------------------- /tests/network/integration/netintegtestlib.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from contextlib import contextmanager 5 | 6 | import pytest 7 | 8 | from vdsm.network import cmd 9 | from vdsm.network.ipwrapper import netns_add 10 | from vdsm.network.ipwrapper import netns_delete 11 | 12 | 13 | _SYSTEMCTL = 'systemctl' 14 | 15 | 16 | def requires_systemctl(): 17 | rc, _, err = cmd.exec_sync([_SYSTEMCTL, 'status', 'foo']) 18 | run_chroot_err = 'Running in chroot' 19 | if rc == 1 or run_chroot_err in err: 20 | pytest.skip('systemctl is not available') 21 | 22 | 23 | @contextmanager 24 | def network_namespace(name): 25 | netns_add(name) 26 | try: 27 | yield name 28 | finally: 29 | netns_delete(name) 30 | -------------------------------------------------------------------------------- /tests/network/integration/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xe 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | source tests/network/common.sh 7 | 8 | IMAGE_TAG="${IMAGE_TAG:=centos-9}" 9 | CONTAINER_IMAGE="${CONTAINER_IMAGE:=$IMAGE_PREFIX-integration}" 10 | 11 | load_kernel_modules 12 | 13 | CONTAINER_ID="$($CONTAINER_CMD run --privileged -d -v $PROJECT_PATH:$CONTAINER_WORKSPACE:Z --env PYTHONPATH=lib $CONTAINER_IMAGE:$IMAGE_TAG)" 14 | trap remove_container EXIT 15 | 16 | setup_vdsm_sources_for_testing 17 | 18 | if [ "$1" == "--shell" ];then 19 | container_shell 20 | exit 0 21 | fi 22 | 23 | run_tests integration 24 | -------------------------------------------------------------------------------- /tests/network/static/bonding-defaults.json.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/network/static/bonding-name2numeric.json.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/network/static/constants.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | P_VDSM = '/usr/share/vdsm/' 5 | P_VDSM_HOOKS = '/usr/libexec/vdsm/hooks/' 6 | P_VDSM_LIB = '/var/lib/vdsm/' 7 | P_VDSM_RUN = '/run/vdsm/' 8 | -------------------------------------------------------------------------------- /tests/network/static/dsaversion.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | """ 5 | This module provides DSA software versioning information for 6 | python based components 7 | """ 8 | 9 | raw_version_revision = "4.40.static.unittest.version" 10 | -------------------------------------------------------------------------------- /tests/network/static/ip_route_show_table_all.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/network/unit/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/network/unit/driverloader_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import pytest 8 | 9 | from vdsm.network import driverloader 10 | 11 | 12 | def test_load_non_existing_driver(): 13 | _drivers = driverloader.load_drivers('ClassName', 'foo.bar', '/no/drivers') 14 | with pytest.raises(driverloader.NoDriverError): 15 | return driverloader.get_driver('shrubbery', _drivers) 16 | -------------------------------------------------------------------------------- /tests/network/unit/link_setup_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.network.link import setup as linksetup 8 | 9 | 10 | def test_parse_nets_bridge_opts(): 11 | nets = { 12 | 'br1': { 13 | 'custom': { 14 | 'bridge_opts': 'multicast_router=0 multicast_snooping=0' 15 | } 16 | }, 17 | 'br2': { 18 | 'custom': { 19 | 'bridge_opts': 'multicast_router=1 multicast_snooping=1' 20 | } 21 | }, 22 | } 23 | expected = { 24 | 'br1': {'multicast_router': '0', 'multicast_snooping': '0'}, 25 | 'br2': {'multicast_router': '1', 'multicast_snooping': '1'}, 26 | } 27 | 28 | for name, opts in linksetup.parse_nets_bridge_opts(nets): 29 | assert expected[name] == opts 30 | -------------------------------------------------------------------------------- /tests/network/unit/netmaskconversions: -------------------------------------------------------------------------------- 1 | #bitmask address 2 | 0 0.0.0.0 3 | 1 128.0.0.0 4 | 2 192.0.0.0 5 | 3 224.0.0.0 6 | 4 240.0.0.0 7 | 5 248.0.0.0 8 | 6 252.0.0.0 9 | 7 254.0.0.0 10 | 8 255.0.0.0 11 | 9 255.128.0.0 12 | 10 255.192.0.0 13 | 11 255.224.0.0 14 | 12 255.240.0.0 15 | 13 255.248.0.0 16 | 14 255.252.0.0 17 | 15 255.254.0.0 18 | 16 255.255.0.0 19 | 17 255.255.128.0 20 | 18 255.255.192.0 21 | 19 255.255.224.0 22 | 20 255.255.240.0 23 | 21 255.255.248.0 24 | 22 255.255.252.0 25 | 23 255.255.254.0 26 | 24 255.255.255.0 27 | 25 255.255.255.128 28 | 26 255.255.255.192 29 | 27 255.255.255.224 30 | 28 255.255.255.240 31 | 29 255.255.255.248 32 | 30 255.255.255.252 33 | 31 255.255.255.254 34 | 32 255.255.255.255 35 | -------------------------------------------------------------------------------- /tests/network/unit/netmaskconversions.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/network/unit/nmstate/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | -------------------------------------------------------------------------------- /tests/network/unit/nmstate/conftest.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from unittest import mock 5 | 6 | import pytest 7 | 8 | 9 | from vdsm.network import nmstate 10 | from vdsm.network.nmstate import api 11 | 12 | 13 | @pytest.fixture(autouse=True) 14 | def current_state_mock(): 15 | with mock.patch.object(api, 'state_show') as state: 16 | state.return_value = { 17 | nmstate.Interface.KEY: [], 18 | nmstate.DNS.KEY: {}, 19 | nmstate.Route.KEY: {}, 20 | nmstate.RouteRule.KEY: {}, 21 | } 22 | yield state.return_value 23 | 24 | 25 | @pytest.fixture(autouse=True) 26 | def rconfig_mock(): 27 | with mock.patch.object(api, 'RunningConfig') as rconfig: 28 | rconfig.return_value.networks = {} 29 | rconfig.return_value.bonds = {} 30 | rconfig.return_value.devices = {} 31 | yield rconfig.return_value 32 | -------------------------------------------------------------------------------- /tests/network/unit/tc_filter_show.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/panic_helper.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | import os 7 | 8 | from vdsm.common import panic 9 | 10 | # Create new process group so panic will not kill the test runner. 11 | os.setpgid(0, 0) 12 | 13 | panic.panic("panic test") 14 | -------------------------------------------------------------------------------- /tests/run_tests_local.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | if [ -z "$PYTHON_EXE" ]; then 7 | PYTHON_EXE="python3" 8 | fi 9 | 10 | function terminate_jobs { 11 | running_jobs=$(jobs -pr) 12 | if [ -n "$running_jobs" ]; then 13 | kill $running_jobs 14 | fi 15 | } 16 | 17 | trap terminate_jobs EXIT 18 | 19 | export \ 20 | LC_ALL=C.UTF8 \ 21 | NOSE_EVAL_ATTR \ 22 | NOSE_LOGFORMAT='%(asctime)s %(levelname)-5s (%(threadName)s) [%(name)s] %(message)s (%(module)s:%(lineno)d)' \ 23 | NOSE_VERBOSE=${NOSE_VERBOSE:-1} \ 24 | PYTHONDONTWRITEBYTECODE=1 \ 25 | PYTHONPATH="@top_srcdir@/static/usr/share/vdsm:@top_srcdir@/lib:@top_srcdir@/vdsm_api:$PYTHONPATH" \ 26 | $NULL 27 | 28 | if [ -n "$TIMEOUT" ]; then 29 | PYTHON_EXE="$PYTHON_EXE py-watch $TIMEOUT $PYTHON_EXE" 30 | fi 31 | 32 | $PYTHON_EXE "@top_srcdir@"/tests/testrunner.py --local-modules "$@" 33 | -------------------------------------------------------------------------------- /tests/slow-gluster-cli.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/storage/blkdiscard_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from monkeypatch import MonkeyPatch 8 | from testlib import VdsmTestCase 9 | 10 | from vdsm.common import cmdutils 11 | from vdsm.storage import blkdiscard 12 | 13 | 14 | class TestBlkdiscard(VdsmTestCase): 15 | 16 | @MonkeyPatch(blkdiscard._blkdiscard, '_cmd', '/usr/bin/true') 17 | def test_discard_success(self): 18 | self.assertNotRaises(blkdiscard.discard, "/dev/vg/lv") 19 | 20 | @MonkeyPatch(blkdiscard._blkdiscard, '_cmd', '/usr/bin/false') 21 | def test_discard_error(self): 22 | self.assertRaises(cmdutils.Error, blkdiscard.discard, "/dev/vg/lv") 23 | -------------------------------------------------------------------------------- /tests/storage/cleanup.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import pprint 8 | 9 | 10 | class CleanupError(Exception): 11 | def __init__(self, msg, errors): 12 | self.msg = msg 13 | self.errors = errors 14 | 15 | def __str__(self): 16 | return "%s: %s" % (self.msg, pprint.pformat(self.errors)) 17 | 18 | def __repr__(self): 19 | return str(self) 20 | -------------------------------------------------------------------------------- /tests/storage/constants.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | # Before 4.20.34-1 (ovirt-4.2.5), metadata was cleared by writing invalid 8 | # metadta. 9 | CLEARED_VOLUME_METADATA = b"NONE=" + (b"#" * 502) + b"\nEOF\n" 10 | -------------------------------------------------------------------------------- /tests/storage/fake-devices-non-standard: -------------------------------------------------------------------------------- 1 | Character devices: 2 | 1 mem 3 | 4 /dev/vc/0 4 | 4 tty 5 | 4 ttyS 6 | 5 /dev/tty 7 | 5 /dev/console 8 | 5 /dev/ptmx 9 | 7 vcs 10 | 10 misc 11 | 13 input 12 | 14 sound 13 | 21 sg 14 | 29 fb 15 | 116 alsa 16 | 128 ptm 17 | 136 pts 18 | 162 raw 19 | 180 usb 20 | 188 ttyUSB 21 | 189 usb_device 22 | 202 cpu/msr 23 | 203 cpu/cpuid 24 | 226 drm 25 | 241 uio 26 | 242 aux 27 | 243 virtio-portsdev 28 | 244 hidraw 29 | 245 usbmon 30 | 246 bsg 31 | 247 watchdog 32 | 248 ptp 33 | 249 pps 34 | 250 cec 35 | 251 rtc 36 | 252 dax 37 | 253 tpm 38 | 254 gpiochip 39 | 40 | Block devices: 41 | 8 sd 42 | 9 md 43 | 65 sd 44 | 66 sd 45 | 67 sd 46 | 68 sd 47 | 69 sd 48 | 70 sd 49 | 71 sd 50 | 128 sd 51 | 129 sd 52 | 130 sd 53 | 131 sd 54 | 132 sd 55 | 133 sd 56 | 134 sd 57 | 135 sd 58 | 252 device-mapper 59 | 253 virtblk 60 | 254 mdp 61 | 259 blkext -------------------------------------------------------------------------------- /tests/storage/fake-devices-non-standard.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/fake-devices-standard.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/fake-lsblk: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | set -e 7 | 8 | # Fake the output 9 | cat $FAKE_STDOUT 10 | -------------------------------------------------------------------------------- /tests/storage/fake-lsblk.el8.out: -------------------------------------------------------------------------------- 1 | { 2 | "blockdevices": [ 3 | {"name": "/dev/sda1", "type": "part", 4 | "children": [ 5 | {"name": "/dev/sda", "type": "disk"} 6 | ] 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /tests/storage/fake-lsblk.el8.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/fake-lsblk.fedora.out: -------------------------------------------------------------------------------- 1 | lvm /dev/mapper/fedora-swap [SWAP] 2 | dm /dev/mapper/docker-253:3-1204232-pool 3 | lvm /dev/mapper/fedora-home /home 4 | lvm /dev/mapper/fedora-docker--poolmeta 5 | lvm /dev/mapper/fedora-root / 6 | -------------------------------------------------------------------------------- /tests/storage/fake-lsblk.fedora.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/fake-lsblk.node.out: -------------------------------------------------------------------------------- 1 | { 2 | "blockdevices": [ 3 | { 4 | "name": "/dev/mapper/0QEMU_QEMU_HARDDISK_host4-data2", 5 | "type": "part", 6 | "children": [ 7 | { 8 | "name": "/dev/mapper/0QEMU_QEMU_HARDDISK_host4-data", 9 | "type": "mpath", 10 | "children": [ 11 | { 12 | "name": "/dev/sda", 13 | "type": "disk" 14 | } 15 | ] 16 | } 17 | ] 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /tests/storage/fake-lsblk.node.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/fake-lsblk.rhel74.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/fake_os_brick/os_brick/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | -------------------------------------------------------------------------------- /tests/storage/fake_os_brick/os_brick/initiator/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | -------------------------------------------------------------------------------- /tests/storage/iscsiadm_-m_iface.out: -------------------------------------------------------------------------------- 1 | default tcp,,,, 2 | iser iser,,,, 3 | eth1 tcp,,,SAN1, 4 | eth2 tcp,,,eth2, 5 | -------------------------------------------------------------------------------- /tests/storage/iscsiadm_-m_iface.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/iscsiadm_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | import six 8 | 9 | import pytest 10 | 11 | from vdsm.storage import iscsiadm 12 | 13 | from . marks import requires_root 14 | 15 | 16 | @requires_root 17 | @pytest.mark.root 18 | def test_run_cmd(): 19 | out = iscsiadm.run_cmd(["--version"]) 20 | assert isinstance(out, six.text_type) 21 | assert "iscsiadm version" in out 22 | -------------------------------------------------------------------------------- /tests/storage/lsof_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | import os 5 | import pwd 6 | 7 | import pytest 8 | 9 | from vdsm.storage import lsof 10 | 11 | from .marks import requires_root 12 | 13 | 14 | @requires_root 15 | @pytest.mark.root 16 | def test_proc_info_used(tmpdir): 17 | path = str(tmpdir.join("file")) 18 | with open(path, "w") as f: 19 | assert list(lsof.proc_info(path)) == [{ 20 | "command": "pytest", 21 | "fd": f.fileno(), 22 | "pid": os.getpid(), 23 | "user": pwd.getpwuid(os.getuid())[0] 24 | }] 25 | 26 | 27 | @requires_root 28 | @pytest.mark.root 29 | def test_proc_info_unused(tmpdir): 30 | path = tmpdir.join("file") 31 | path.write("") 32 | assert list(lsof.proc_info(str(path))) == [] 33 | 34 | 35 | @requires_root 36 | @pytest.mark.root 37 | def test_proc_info_no_such_file(): 38 | assert list(lsof.proc_info("/no/such/file")) == [] 39 | -------------------------------------------------------------------------------- /tests/storage/lvs_3386c6f2-926f-42c4-839c-38287fac8998.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/lvs_f9e55e18-67c4-4377-8e39-5833ca422bef.out: -------------------------------------------------------------------------------- 1 | 3oqnyE-86gI-ZcF4-or87-Jt1j-6DdQ-hcGUyl|0574c3f6-3d44-4cc7-98e3-6d90626dd95f|f9e55e18-67c4-4377-8e39-5833ca422bef|-wi-----|2147483648|0|/dev/mapper/1Dafna-rhevm11333889(195)|MD_17,IU_ae863f0d-0f24-41d4-b6ed-333c6634c7dc 2 | c6fE1p-7Uwi-tnPA-CZjt-uxwg-j5aK-bWbs34|0641b528-c72c-45ed-94bc-7090085a0d4b|f9e55e18-67c4-4377-8e39-5833ca422bef|-wi-----|2147483648|0|/dev/mapper/1Dafna-rhevm11333889(259)|PU_00000000-0000-0000-0000-000000000000,MD_21 3 | ju1mna-9CU4-QwEH-lC74-fOM1-bq2w-rMhTAx|128f0b4a-2ed0-4ea1-84a5-105c6721f4b7|f9e55e18-67c4-4377-8e39-5833ca422bef|-wi-----|2147483648|0|/dev/mapper/1Dafna-rhevm11333889(211)|MD_24,PU_00000000-0000-0000-0000-000000000000,IU_8e6eef9f-457b-4145-ace7-19d35938a80b 4 | 0XEEv2-uysB-Lm23-kTwj-VdLA-pgOA-R8QJrp|16166e99-a723-4a2a-a2e8-28e219229332|3386c6f2-926f-42c4-839c-38287fac8998|-wi-----|2147483648|0|/dev/mapper/1Dafna-rhevm11333889(337)|PU_00000000-0000-0000-0000-000000000000,MD_28,IU_5c9afa6a-44c3-49a6-b106-1779f0a280ce 5 | -------------------------------------------------------------------------------- /tests/storage/lvs_f9e55e18-67c4-4377-8e39-5833ca422bef.out.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/storage/sd_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | import pytest 7 | 8 | from vdsm.storage import sd 9 | from vdsm.storage import exception as se 10 | 11 | 12 | def test_validate_domain_version_invaid(): 13 | with pytest.raises(se.UnsupportedDomainVersion): 14 | sd.StorageDomain.validate_version(-1) 15 | 16 | 17 | @pytest.mark.parametrize("domain_version", [0, 2, 3, 4, 5]) 18 | def test_validate_domain_version_supported(domain_version): 19 | sd.StorageDomain.validate_version(domain_version) 20 | -------------------------------------------------------------------------------- /tests/storage/stress/release-spm-lease.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | """ 5 | Release the SPM lease behind vdsm back. 6 | """ 7 | import subprocess 8 | import sys 9 | 10 | import sanlock 11 | 12 | print("Looking up vdsm pid") 13 | out = subprocess.check_output(["pgrep", "^vdsmd"]).decode("utf-8") 14 | vdsm_pid = int(out) 15 | 16 | print("Inquiring process {} resoruces".format(vdsm_pid)) 17 | for r in sanlock.inquire(pid=vdsm_pid): 18 | if r["resource"] == b"SDM": 19 | break 20 | else: 21 | print("Not SPM host", file=sys.stderr) 22 | sys.exit(1) 23 | 24 | print("Releasing SPM lease {}".format(r)) 25 | sanlock.release(r["lockspace"], r["resource"], r["disks"], pid=vdsm_pid) 26 | -------------------------------------------------------------------------------- /tests/sysprep_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm import virtsysprep 8 | from vdsm.common import cmdutils 9 | from vdsm.virt.utils import LibguestfsCommand 10 | 11 | from monkeypatch import MonkeyPatch 12 | from testlib import VdsmTestCase as TestCaseBase 13 | 14 | 15 | BLANK_UUID = '00000000-0000-0000-0000-000000000000' 16 | FAKE_VOLUME = '/we/dont/care/about/this/path' 17 | 18 | 19 | FakeCommand = LibguestfsCommand('/bin/false') 20 | 21 | 22 | class VirtSysprepTests(TestCaseBase): 23 | 24 | @MonkeyPatch(virtsysprep, '_VIRTSYSPREP', FakeCommand) 25 | def test_raise_error_on_failure(self): 26 | 27 | self.assertRaises(cmdutils.Error, 28 | virtsysprep.sysprep, 29 | BLANK_UUID, [FAKE_VOLUME]) 30 | -------------------------------------------------------------------------------- /tests/testing.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | """ 5 | testing - Testing environment helpers 6 | """ 7 | 8 | from __future__ import absolute_import 9 | from __future__ import division 10 | 11 | import os 12 | 13 | 14 | def on_centos(ver=''): 15 | with open('/etc/redhat-release') as f: 16 | return 'CentOS Linux release {}'.format(ver) in f.readline() 17 | 18 | 19 | def on_rhel(ver=''): 20 | with open('/etc/redhat-release') as f: 21 | return 'Red Hat Enterprise Linux release {}'.format( 22 | ver) in f.readline() 23 | 24 | 25 | def on_fedora(ver=''): 26 | with open('/etc/redhat-release') as f: 27 | return 'Fedora release {}'.format(ver) in f.readline() 28 | 29 | 30 | def on_travis_ci(): 31 | return 'TRAVIS_CI' in os.environ 32 | 33 | 34 | def on_ovirt_ci(): 35 | return 'OVIRT_CI' in os.environ 36 | -------------------------------------------------------------------------------- /tests/toolTests_CCPP.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | ## beginning of configuration section by vdsm-%(LATEST_CONF_VERSION)s 5 | MakeCompatCore=no 6 | SaveBinaryImage=no 7 | CreateCoreBacktrace=yes 8 | SaveFullCore=no 9 | ## end of configuration section by vdsm-%(LATEST_CONF_VERSION)s 10 | -------------------------------------------------------------------------------- /tests/toolTests_empty.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/toolTests_lconf_ssl.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | ## beginning of configuration section by vdsm-%(LATEST_CONF_VERSION)s 5 | listen_tcp=0 6 | auth_tcp="sasl" 7 | listen_addr="0.0.0.0" 8 | unix_sock_group="qemu" 9 | unix_sock_rw_perms="0770" 10 | auth_unix_rw="sasl" 11 | host_uuid="72d18a98-8d96-4687-967a-72d989d3b65f" 12 | keepalive_interval=-1 13 | log_outputs="1:file:/var/log/libvirt/libvirtd.log" 14 | ca_file="/etc/pki/vdsm/certs/cacert.pem" 15 | cert_file="/etc/pki/vdsm/certs/vdsmcert.pem\" 16 | ## end of configuration section by vdsm-%(LATEST_CONF_VERSION)s 17 | -------------------------------------------------------------------------------- /tests/toolTests_libvirtd.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | ## beginning of configuration section by vdsm-%(LATEST_CONF_VERSION)s 5 | auto_disk_leases=0 6 | require_lease_for_disks=0 7 | ## end of configuration section by vdsm-%(LATEST_CONF_VERSION)s 8 | -------------------------------------------------------------------------------- /tests/toolTests_mtab_1g.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/toolTests_mtab_default.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/toolTests_mtab_nohugetlbfs.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/toolTests_qemu_sanlock.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | ## beginning of configuration section by vdsm-%(LATEST_CONF_VERSION)s 5 | LIBVIRTD_ARGS=--listen 6 | DAEMON_COREFILE_LIMIT=unlimited 7 | ## end of configuration section by vdsm-%(LATEST_CONF_VERSION)s 8 | -------------------------------------------------------------------------------- /tests/toolTests_qemu_ssl.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | ## beginning of configuration section by vdsm-%(LATEST_CONF_VERSION)s 5 | spice_tls=1 6 | dynamic_ownership=1 7 | save_image_format="raw" 8 | user="qemu" 9 | group="qemu" 10 | migrate_tls_x509_cert_dir="/etc/pki/vdsm/libvirt-migrate" 11 | spice_tls_x509_cert_dir="/etc/pki/vdsm/libvirt-spice" 12 | remote_display_port_min=5900 13 | remote_display_port_max=6923 14 | lock_manager="sanlock" 15 | ## end of configuration section by vdsm-%(LATEST_CONF_VERSION)s 16 | -------------------------------------------------------------------------------- /tests/toolTests_vdsm_no_ssl.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | [vars] 5 | ssl = false 6 | -------------------------------------------------------------------------------- /tests/toolTests_vdsm_ssl.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | [vars] 5 | ssl = true 6 | -------------------------------------------------------------------------------- /tests/toolTests_vmcore.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | ## beginning of configuration section by vdsm-%(LATEST_CONF_VERSION)s 5 | CopyVMcore=no 6 | ## end of configuration section by vdsm-%(LATEST_CONF_VERSION)s 7 | -------------------------------------------------------------------------------- /tests/tool_configurators_lvm_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | import os 5 | 6 | from vdsm.tool import confmeta 7 | 8 | TOPDIR = os.path.dirname(os.path.dirname(__file__)) 9 | 10 | 11 | def test_lvmlocal_conf(): 12 | lvmlocal_conf = os.path.join( 13 | TOPDIR, "static/usr/share/vdsm/lvmlocal.conf") 14 | md = confmeta.read_metadata(lvmlocal_conf) 15 | assert md.revision >= 7 16 | assert md.private is False 17 | -------------------------------------------------------------------------------- /tests/virt/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | -------------------------------------------------------------------------------- /tests/virt/data/active-merge/00-before.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/active-merge/01-commit.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/active-merge/02-commit-ready.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/active-merge/03-abort.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/active-merge/04-abort-ready.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/active-merge/05-after.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/disk_devices.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/disk_updated_snippet.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/domain.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/domain_disk_block.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/domain_disk_file.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/hostedengine.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/hostedengine_lease.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/internal-merge/00-before.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/internal-merge/01-commit.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/internal-merge/02-after.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/sysinfo_snippet_filled.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | sysinfo_snippet 4 | 8386df52-d717-4353-93ad-2c72d20eccaf 5 | 5242880 6 | 5242880 7 | 16 8 | 9 | 10 | Red Hat 11 | test-product 12 | 42-1 13 | test-serial 14 | 346b8d80-b4f2-4a81-bf60-a662220c27a4 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/virt/data/sysinfo_snippet_filled.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/sysinfo_snippet_template.xml: -------------------------------------------------------------------------------- 1 | 2 | sysinfo_snippet 3 | 8386df52-d717-4353-93ad-2c72d20eccaf 4 | 5242880 5 | 5242880 6 | 16 7 | 8 | 9 | Red Hat 10 | OS-NAME:NAME 11 | OS-VERSION:VERSION 12 | HOST-SERIAL:SERIAL 13 | 346b8d80-b4f2-4a81-bf60-a662220c27a4 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /tests/virt/data/sysinfo_snippet_template.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/vm_compat41.json.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/vm_compat41.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/vm_hibernated.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/vm_hibernated_390.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/vm_hosted_engine_42.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/vm_replace_md_base.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/vm_replace_md_update.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/data/vm_sysprep_floppy.xml.license: -------------------------------------------------------------------------------- 1 | SPDX-FileCopyrightText: Red Hat, Inc. 2 | SPDX-License-Identifier: GPL-2.0-or-later -------------------------------------------------------------------------------- /tests/virt/events_test.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | from __future__ import division 6 | 7 | from vdsm.virt import events 8 | 9 | from testlib import VdsmTestCase as TestCaseBase 10 | 11 | 12 | class TestEventName(TestCaseBase): 13 | 14 | def test_known(self): 15 | for event_id in events.LIBVIRT_EVENTS: 16 | assert events.event_name(event_id) 17 | 18 | def test_unknown(self): 19 | UNKNOWN_FAKE_EVENT_ID = 424242 20 | # given unknown events, it must still return a meaningful string) 21 | assert UNKNOWN_FAKE_EVENT_ID not in events.LIBVIRT_EVENTS 22 | assert events.event_name(UNKNOWN_FAKE_EVENT_ID) 23 | -------------------------------------------------------------------------------- /vdsm_hooks/allocate_net/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_device_create.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_device_create 9 | $(INSTALL_SCRIPT) $(srcdir)/before_device_create.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_device_create/10_allocate_net 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_device_create/10_allocate_net 14 | 15 | -------------------------------------------------------------------------------- /vdsm_hooks/boot_hostdev/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_boot_hostdev 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_boot_hostdev 14 | 15 | -------------------------------------------------------------------------------- /vdsm_hooks/boot_hostdev/README: -------------------------------------------------------------------------------- 1 | 5 | 6 | boot_hostdev vdsm hook 7 | ================================= 8 | This hook allows to boot VMs from passthrough devices such as SCSI, PCI cards 9 | and USB devices. 10 | 11 | Installation: 12 | * Use engine-config to set the appropriate custom properties as such: 13 | 14 | Custom property for all interfaces in a VM: 15 | sudo engine-config -s "UserDefinedVMProperties=boot_hostdev=^.*$" 16 | 17 | Usage: 18 | 1. Pass a device to a VM using the Host Devices tab. 19 | 2. Copy the device name 20 | 3. Edit the VM, in custom properties set boot_hostdev and paste the device name 21 | 4. Start the VM 22 | 23 | The hook will set the hostdev from step 2 with bootindex=1 in qemu command line, 24 | all other devices will have their boot indexes bumped by 1. 25 | -------------------------------------------------------------------------------- /vdsm_hooks/checkimages/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/60_checkimages 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/60_checkimages 14 | 15 | -------------------------------------------------------------------------------- /vdsm_hooks/checkimages/README: -------------------------------------------------------------------------------- 1 | 5 | 6 | checkimages vdsm hook 7 | ===================== 8 | Hook performs consistency check on all qcow2 format disk images of a 9 | particular VM using the QEMU disk image utility. 10 | 11 | Accepts optional parameter 'timeout' (in seconds) to specify how long 12 | the hook should wait for the QEMU disk image utility operation to complete. 13 | 14 | Without 'timeout' specified, particular timeout is computed based on 15 | image size. 16 | 17 | syntax: 18 | checkimages=true(|,timeout:\d+\.{1}\d+); 19 | 20 | example: 21 | checkimages=true,timeout:1.12 # Use 1.12 seconds as timeout 22 | 23 | checkimages=true # Compute timeout based on image size 24 | 25 | Note: Timeout value is taken in seconds. Check of 1GB image takes ~0.02 s. 26 | 27 | -------------------------------------------------------------------------------- /vdsm_hooks/checkips/checkips_utils.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | from __future__ import absolute_import 5 | 6 | import os 7 | 8 | CHECKIPV4 = 'checkipv4' 9 | CHECKIPV6 = 'checkipv6' 10 | 11 | 12 | def touch(net, file_dir): 13 | file_path = os.path.join(file_dir, net) 14 | with open(file_path, 'a'): 15 | os.utime(file_path, None) 16 | 17 | 18 | def get_ping_addresses(net_attrs): 19 | ping_addresses = [] 20 | if 'custom' in net_attrs: 21 | for address_type in (CHECKIPV4, CHECKIPV6): 22 | if address_type in net_attrs['custom']: 23 | ping_addresses.append( 24 | ( 25 | address_type, net_attrs['custom'][address_type] 26 | ) 27 | ) 28 | return ping_addresses 29 | -------------------------------------------------------------------------------- /vdsm_hooks/checkips/vdsm-checkips.service.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | [Unit] 5 | Description=Service that ping given ips each 60 seconds 6 | 7 | [Service] 8 | Type=simple 9 | LimitCORE=infinity 10 | ExecStart=@HOOKSDIR@/checkipsd 11 | Restart=on-failure 12 | RestartSec=10 13 | User=@VDSMUSER@ 14 | Group=@VDSMGROUP@ 15 | TimeoutStopSec=@SERVICE_STOP_TIMEOUT@ 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /vdsm_hooks/cpuflags/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | EXTRA_DIST = \ 7 | before_vm_start.py 8 | 9 | install-data-local: 10 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 11 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 12 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_cpuflags 13 | 14 | uninstall-local: 15 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_cpuflags 16 | -------------------------------------------------------------------------------- /vdsm_hooks/diskunmap/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_diskunmap 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_diskunmap 14 | 15 | -------------------------------------------------------------------------------- /vdsm_hooks/ethtool_options/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | ethtool_options.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_network_setup 9 | $(INSTALL_SCRIPT) $(srcdir)/ethtool_options.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/after_network_setup/30_ethtool_options 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/after_network_setup/30_ethtool_options 14 | -------------------------------------------------------------------------------- /vdsm_hooks/extnet/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | extnet_vnic.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_device_create 9 | $(INSTALL_SCRIPT) $(srcdir)/extnet_vnic.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_device_create/50_extnet 11 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_nic_hotplug 12 | $(INSTALL_SCRIPT) $(srcdir)/extnet_vnic.py \ 13 | $(DESTDIR)$(vdsmhooksdir)/before_nic_hotplug/50_extnet 14 | 15 | uninstall-local: 16 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_device_create/50_extnet 17 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_nic_hotplug/50_extnet 18 | 19 | -------------------------------------------------------------------------------- /vdsm_hooks/extra_ipv4_addrs/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | extra_ipv4_addrs.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_network_setup 9 | $(INSTALL_SCRIPT) $(srcdir)/extra_ipv4_addrs.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/after_network_setup/40_extra_ipv4_addrs 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/after_network_setup/40_extra_ipv4_addrs 14 | 15 | install-data-sudoers: 16 | $(MKDIR_P) $(DESTDIR)$(sysconfdir)/sudoers.d 17 | $(INSTALL_DATA) $(srcdir)/sudoers \ 18 | $(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm_hook_extra_ipv4_addrs 19 | 20 | uninstall-data-sudoers: 21 | $(RM) $(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm_hook_extra_ipv4_addrs 22 | -------------------------------------------------------------------------------- /vdsm_hooks/extra_ipv4_addrs/README: -------------------------------------------------------------------------------- 1 | 5 | 6 | extra_ipv4_addrs vdsm hook 7 | ================================= 8 | This hook allows the user to set extra ipv4 addresses for vdsm networks. 9 | 10 | Requirements: 11 | * oVirt-3.5 12 | 13 | Usage: 14 | Configure the engine to enable setting the ipv4_addrs custom property by doing: 15 | 16 | $ engine-config -s 'UserDefinedNetworkCustomProperties=ipv4_addrs=.*' \ 17 | --cver='3.5' 18 | 19 | In the oVirt UI edit custom network properties and, for the key 'ipv4_addrs' 20 | set the extra addresses in the following format: 21 | 22 | 'addr/prefix, addr2/prefix2, ..., addrN/prefixN' 23 | -------------------------------------------------------------------------------- /vdsm_hooks/extra_ipv4_addrs/sudoers: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vdsm ALL=(ALL) NOPASSWD: /usr/sbin/ip, /sbin/ip, /usr/bin/ip 5 | -------------------------------------------------------------------------------- /vdsm_hooks/fakevmstats/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | CLEANFILES = \ 7 | config.log 8 | 9 | EXTRA_DIST = \ 10 | after_get_all_vm_stats.py 11 | 12 | install-data-local: 13 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_get_vm_stats 14 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_get_vm_stats 15 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_get_all_vm_stats 16 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_get_all_vm_stats 17 | $(INSTALL_SCRIPT) $(srcdir)/after_get_all_vm_stats.py \ 18 | $(DESTDIR)$(vdsmhooksdir)/after_get_all_vm_stats/10_fakevmstats 19 | 20 | uninstall-local: 21 | $(RM) $(DESTDIR)$(vdsmhooksdir)/after_get_all_vm_stats/10_fakevmstats 22 | -------------------------------------------------------------------------------- /vdsm_hooks/faqemu/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | CLEANFILES = \ 7 | config.log 8 | 9 | EXTRA_DIST = \ 10 | after_get_caps.py \ 11 | before_vm_start.py 12 | 13 | install-data-local: 14 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_get_caps 15 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 16 | $(INSTALL_SCRIPT) $(srcdir)/after_get_caps.py \ 17 | $(DESTDIR)$(vdsmhooksdir)/after_get_caps/10_faqemu 18 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 19 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/10_faqemu 20 | 21 | uninstall-local: 22 | $(RM) $(DESTDIR)$(vdsmhooksdir)/after_get_caps/10_faqemu 23 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/10_faqemu 24 | -------------------------------------------------------------------------------- /vdsm_hooks/fcoe/85-vdsm-hook-fcoe.preset: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # vdsm-hook-fcoe preset file enables services that it requires to run on boot 5 | 6 | enable lldpad.service 7 | enable fcoe.service 8 | 9 | -------------------------------------------------------------------------------- /vdsm_hooks/fcoe/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | 85-vdsm-hook-fcoe.preset \ 6 | fcoe_before_network_setup.py \ 7 | $(NULL) 8 | 9 | install-data-local: 10 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_network_setup 11 | $(INSTALL_SCRIPT) $(srcdir)/fcoe_before_network_setup.py \ 12 | $(DESTDIR)$(vdsmhooksdir)/before_network_setup/50_fcoe 13 | $(INSTALL_DATA) $(srcdir)/85-vdsm-hook-fcoe.preset \ 14 | $(DESTDIR)/usr/lib/systemd/system-preset/ 15 | 16 | uninstall-local: 17 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_network_setup/50_fcoe 18 | $(RM) $(DESTDIR)/usr/lib/systemd/system-preset/85-vdsm-hook-fcoe.preset 19 | -------------------------------------------------------------------------------- /vdsm_hooks/fileinject/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_fileinject 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_fileinject 14 | -------------------------------------------------------------------------------- /vdsm_hooks/httpsisoboot/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_httpsisoboot 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_httpsisoboot 14 | -------------------------------------------------------------------------------- /vdsm_hooks/localdisk/12-vdsm-localdisk.rules: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. and/or its affiliates. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # Vdsm udev rules for local lvs 5 | 6 | # "add" event is processed on coldplug only, so we need "change", too. 7 | ACTION!="add|change", GOTO="lvm_end" 8 | 9 | # Filter out vgs which do not look like an ovirt local vg 10 | ENV{DM_VG_NAME}!="ovirt-local", GOTO="lvm_end" 11 | 12 | # Volumes used as local disks lvs 13 | # WARNING: we cannot use OWNER, GROUP and MODE since using any of them will 14 | # change the selinux label to the default, causing vms to pause after refreshing the lv. 15 | # See https://bugzilla.redhat.com/1147910 16 | ENV{DM_LV_NAME}=="*", RUN+="/usr/bin/chown vdsm:qemu $env{DEVNAME}", GOTO="lvm_end" 17 | 18 | LABEL="lvm_end" 19 | -------------------------------------------------------------------------------- /vdsm_hooks/localdisk/before_vm_migrate_source: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | import hooking 9 | import os 10 | import sys 11 | 12 | if 'localdisk' in os.environ: 13 | hooking.log("localdisk-hook: Cannot migrate VM with local disk") 14 | sys.exit(2) 15 | -------------------------------------------------------------------------------- /vdsm_hooks/localdisk/sudoers.vdsm_hook_localdisk: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vdsm ALL=(ALL) NOPASSWD: /usr/libexec/vdsm/localdisk-helper 5 | Defaults:vdsm !requiretty 6 | Defaults:vdsm !syslog 7 | -------------------------------------------------------------------------------- /vdsm_hooks/log_console/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_log_console 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_log_console 14 | 15 | -------------------------------------------------------------------------------- /vdsm_hooks/log_firmware/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_log_firmware 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_log_firmware 14 | 15 | -------------------------------------------------------------------------------- /vdsm_hooks/macbind/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_macbind 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_macbind 14 | 15 | -------------------------------------------------------------------------------- /vdsm_hooks/nestedvt/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | include $(top_srcdir)/build-aux/Makefile.subs 5 | 6 | EXTRA_DIST = \ 7 | before_vm_start.py \ 8 | modprobe.conf 9 | 10 | install-data-local: 11 | $(MKDIR_P) $(DESTDIR)$(sysconfdir)/modprobe.d 12 | $(INSTALL_DATA) $(srcdir)/modprobe.conf \ 13 | $(DESTDIR)$(sysconfdir)/modprobe.d/vdsm-nestedvt.conf 14 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 15 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 16 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_nestedvt 17 | 18 | uninstall-local: 19 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_nestedvt 20 | -------------------------------------------------------------------------------- /vdsm_hooks/nestedvt/README: -------------------------------------------------------------------------------- 1 | 5 | 6 | VDSM Nested Virtualization 7 | ========================== 8 | This hook provides the support for nested virtualization in the guests managed 9 | by VDSM. After installing the hook it is recomended to reboot the host to make 10 | the new modprobe configuration effective, alternatively it is possible to try 11 | to reload the kvm module: 12 | 13 | # modprobe -r [kvm-intel|kvm-amd] 14 | # modprobe [kvm-intel|kvm-amd] 15 | 16 | The nested option should now be enabled: 17 | 18 | # cat /sys/module/kvm*/parameters/nested 19 | Y 20 | 21 | This hook assumes that your kernel supports nested virtualization. 22 | -------------------------------------------------------------------------------- /vdsm_hooks/nestedvt/before_vm_start.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | import hooking 9 | 10 | from vdsm import osinfo 11 | 12 | cpu_nested_features = { 13 | "kvm_intel": "vmx", 14 | "kvm_amd": "svm", 15 | } 16 | 17 | nestedvt = osinfo.nested_virtualization() 18 | 19 | if nestedvt.enabled: 20 | domxml = hooking.read_domxml() 21 | feature_vmx = domxml.createElement("feature") 22 | feature_vmx.setAttribute("name", cpu_nested_features[nestedvt.kvm_module]) 23 | feature_vmx.setAttribute("policy", "require") 24 | domxml.getElementsByTagName("cpu")[0].appendChild(feature_vmx) 25 | hooking.write_domxml(domxml) 26 | -------------------------------------------------------------------------------- /vdsm_hooks/nestedvt/modprobe.conf: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | # VDSM nestedvt modprobe configuration 5 | options kvm-intel nested=1 6 | options kvm-amd nested=1 7 | -------------------------------------------------------------------------------- /vdsm_hooks/openstacknet/sudoers.in: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vdsm ALL=(ALL) NOPASSWD: /usr/sbin/ip link set * nomaster 5 | vdsm ALL=(ALL) NOPASSWD: /usr/bin/ovs-vsctl 6 | -------------------------------------------------------------------------------- /vdsm_hooks/qemucmdline/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2012 IBM Corporation 2 | # SPDX-FileCopyrightText: Red Hat, Inc. 3 | # SPDX-License-Identifier: GPL-2.0-or-later 4 | 5 | EXTRA_DIST = \ 6 | before_vm_start.py 7 | 8 | install-data-local: 9 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 10 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 11 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_qemucmdline 12 | 13 | uninstall-local: 14 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_qemucmdline 15 | -------------------------------------------------------------------------------- /vdsm_hooks/qemucmdline/README: -------------------------------------------------------------------------------- 1 | 5 | 6 | qemu_cmdline hook: 7 | ================== 8 | libvirt provides support for passing QEMU cmdline options. 9 | With the help of this, one can inject QEMU options bypassing 10 | the libvirt's domain XML code. This can help immensely in 11 | testing and developing new qemu features, which are not yet in 12 | libvirt and/or injecting one-time or some-time kind of stuff :) 13 | 14 | The os environ 'qemu_cmdline' points to a json list, containing 15 | the qemu option followed by value as individual list entries. 16 | For qemu option that does not take any value, skip the value entry. 17 | 18 | Note that validation of the option and value list entries is NOT done, 19 | its passed as-is to qemu and in the same order as present in the list. 20 | 21 | For eg: qemu_cmdline='["-cdrom","", ...]' 22 | 23 | -------------------------------------------------------------------------------- /vdsm_hooks/scratchpad/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py \ 6 | before_vm_migrate_source.py \ 7 | after_vm_destroy.py 8 | 9 | install-data-local: 10 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 11 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 12 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_scratchpad 13 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_migrate_source 14 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_migrate_source.py \ 15 | $(DESTDIR)$(vdsmhooksdir)/before_vm_migrate_source/50_scratchpad 16 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_vm_destroy 17 | $(INSTALL_SCRIPT) $(srcdir)/after_vm_destroy.py \ 18 | $(DESTDIR)$(vdsmhooksdir)/after_vm_destroy/50_scratchpad 19 | 20 | uninstall-local: 21 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_scratchpad 22 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_migrate_source/50_scratchpad 23 | $(RM) $(DESTDIR)$(vdsmhooksdir)/after_vm_destroy/50_scratchpad 24 | -------------------------------------------------------------------------------- /vdsm_hooks/scratchpad/README: -------------------------------------------------------------------------------- 1 | 5 | 6 | scratchpad vdsm hook 7 | ==================== 8 | Hook creates a disk for a VM onetime usage, 9 | the disk will be erased when the VM destroyed. 10 | VM cannot be migrated when using scratchpad hook 11 | 12 | Hook explicitly adds scratch disk as virtio 13 | device and thus will not work on systems without 14 | virtio support. 15 | 16 | syntax: 17 | scratchpad=size,path 18 | ie: 19 | scratchpad=20G,/tmp/myimg 20 | 21 | size: Optional suffixes "k" or "K" (kilobyte, 1024) "M" (megabyte, 1024k) and 22 | "G" (gigabyte, 1024M) and T (terabyte, 1024G) are supported. "b" is ignored (default) 23 | 24 | note: more than one disk can be added: 25 | scratchpad=20G,/tmp/disk1:1T,/tmp/disk2 26 | -------------------------------------------------------------------------------- /vdsm_hooks/scratchpad/after_vm_destroy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | import os 9 | import sys 10 | import traceback 11 | 12 | if 'scratchpad' in os.environ: 13 | try: 14 | disks = os.environ['scratchpad'] 15 | 16 | for disk in disks.split(':'): 17 | arr = disk.split(',') 18 | if os.path.exists(arr[1]): 19 | os.remove(arr[1]) 20 | else: 21 | sys.stderr.write('scratchpad after_vm_destroy: ' 22 | 'cannot find image file %s\n' % arr[1]) 23 | except: 24 | sys.stderr.write('scratchpad after_vm_destroy: ' 25 | '[unexpected error]: %s\n' % traceback.format_exc()) 26 | sys.exit(2) 27 | -------------------------------------------------------------------------------- /vdsm_hooks/scratchpad/before_vm_migrate_source.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | import os 9 | import sys 10 | 11 | if 'scratchpad' in os.environ: 12 | sys.stderr.write('scratchpad bevort_vm_migrate_source: ' 13 | 'cannot migrate VM with scratchpad devices\n') 14 | sys.exit(2) 15 | -------------------------------------------------------------------------------- /vdsm_hooks/smbios/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_smbios 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_smbios 14 | -------------------------------------------------------------------------------- /vdsm_hooks/smbios/README: -------------------------------------------------------------------------------- 1 | 5 | 6 | smbios vdsm hook 7 | ================ 8 | adding/changing entries to smbios domain entry: 9 | 10 | syntax: 11 | smbios: smbios={'serial': '1234'}^{'vendor': 'oVirt'} 12 | add/edit 2 attributes to smbios: serial and vendor 13 | -------------------------------------------------------------------------------- /vdsm_hooks/spiceoptions/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | before_vm_start.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start 9 | $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_spiceoptions 11 | 12 | uninstall-local: 13 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_spiceoptions 14 | -------------------------------------------------------------------------------- /vdsm_hooks/vhostmd/after_vm_destroy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | from __future__ import absolute_import 7 | 8 | import os 9 | import subprocess 10 | import hooking 11 | 12 | from vdsm import client 13 | from vdsm.config import config 14 | from vdsm import utils 15 | 16 | 17 | if hooking.tobool(os.environ.get('sap_agent', False)): 18 | use_tls = config.getboolean('vars', 'ssl') 19 | 20 | cli = client.connect('localhost', use_tls=use_tls) 21 | with utils.closing(cli): 22 | res = cli.Host.getVMFullList() 23 | if not [v for v in res 24 | if v.get('vmId') != os.environ.get('vmId') 25 | and hooking.tobool( 26 | v.get('custom', {}).get('sap_agent', False))]: 27 | subprocess.call(['/usr/bin/sudo', '-n', '/sbin/service', 'vhostmd', 28 | 'stop']) 29 | -------------------------------------------------------------------------------- /vdsm_hooks/vhostmd/sudoers.vdsm_hook_vhostmd: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | vdsm ALL=(ALL) NOPASSWD: /sbin/service vhostmd * 5 | -------------------------------------------------------------------------------- /vdsm_hooks/vmfex_dev/Makefile.am: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: Red Hat, Inc. 2 | # SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | EXTRA_DIST = \ 5 | vmfex_vnic.py 6 | 7 | install-data-local: 8 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_device_create 9 | $(INSTALL_SCRIPT) $(srcdir)/vmfex_vnic.py \ 10 | $(DESTDIR)$(vdsmhooksdir)/before_device_create/50_vmfex 11 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_device_migrate_destination 12 | $(INSTALL_SCRIPT) $(srcdir)/vmfex_vnic.py \ 13 | $(DESTDIR)$(vdsmhooksdir)/before_device_migrate_destination/50_vmfex 14 | $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_nic_hotplug 15 | $(INSTALL_SCRIPT) $(srcdir)/vmfex_vnic.py \ 16 | $(DESTDIR)$(vdsmhooksdir)/before_nic_hotplug/50_vmfex 17 | 18 | uninstall-local: 19 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_device_create/50_vmfex 20 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_device_migrate_destination/50_vmfex 21 | $(RM) $(DESTDIR)$(vdsmhooksdir)/before_nic_hotplug/50_vmfex 22 | 23 | -------------------------------------------------------------------------------- /vdsm_log/vdsmlog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPDX-FileCopyrightText: Red Hat, Inc. 4 | # SPDX-License-Identifier: GPL-2.0-or-later 5 | 6 | ssh $1 "cat /var/log/vdsm/vdsm.log" | source-highlight -f esc --style-file=vdsmlog.style --lang-def=vdsmlog.lang | less -R 7 | 8 | -------------------------------------------------------------------------------- /vdsm_log/vdsmlog.style: -------------------------------------------------------------------------------- 1 | // SPDX-FileCopyrightText: Red Hat, Inc. 2 | // SPDX-License-Identifier: GPL-2.0-or-later 3 | 4 | thread, mainprocess, mainthread purple b; 5 | apierror, cmderror, error red b ; 6 | warning orange b ; 7 | cmdsuccess, info cyan ; 8 | date brightorange ; 9 | filename pink ; 10 | lineno darkblue ; 11 | apisuccess, logger green ; 12 | function darkred ; 13 | statechange yellow ; 14 | 15 | runandprotect purple ; 16 | runandprotectmethod green ; 17 | 18 | notice i, b ; 19 | 20 | --------------------------------------------------------------------------------