Author: Brandon B. Jozsa
Updated: 03/09/22 - Updated tap source for MacOS Monterey w/potential error resolution
This will be a really quick post about how you can leverage
virt-viewer from MacOS to manage libvirt virtual machines running on Red Hat systems.
In all honesty, this blog doesn't even really need to exist because it's really straight forward. But I am writing a whole series on how users can deploy and manage libvirt systems more easily with Redfish, and this tooling came to mind as a GUI alternative.
You can install both
virt-viewer like this:
(Note: you must have homebrew installed first)
brew tap Krish-sysadmin/homebrew-virt-manager brew install virt-manager virt-viewer
If you are using MacOS Monterey, you may encounter an issue like the following:
==> Installing virt-manager from krish-sysadmin/virt-manager ==> Patching ==> python3 -m venv --system-site-packages /usr/local/Cellar/virt-manager/2.2.1_3/libexec ==> /usr/local/Cellar/virt-manager/2.2.1_3/libexec/bin/pip install -v --no-deps --no-binary :all: --ignore-installed /private/tmp/virt-manager--libvirt-python-20220309-64893-9iygho/libvirt-python-7.8.0 Last 15 lines from /Users/bjozsa/Library/Logs/Homebrew/virt-manager/02.pip: warnings.warn( running build /usr/local/Homebrew/Library/Homebrew/shims/mac/super/pkg-config --print-errors --atleast-version=0.9.11 libvirt /usr/local/Cellar/virt-manager/2.2.1_3/libexec/bin/python3.9 generator.py libvirt /usr/local/Cellar/libvirt/8.1.0/share/libvirt/api/libvirt-api.xml Found 493 functions in /usr/local/Cellar/libvirt/8.1.0/share/libvirt/api/libvirt-api.xml Found 0 functions in libvirt-override-api.xml Generated 403 wrapper functions Missing type converters: virTypedParameterPtr:1 ERROR: failed virDomainSetLaunchSecurityState error: command '/usr/local/Cellar/virt-manager/2.2.1_3/libexec/bin/python3.9' failed with exit code 1 Running setup.py install for libvirt-python: finished with status 'error' ERROR: Command errored out with exit status 1: /usr/local/Cellar/virt-manager/2.2.1_3/libexec/bin/python3.9 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv = '"'"'/private/tmp/virt-manager--libvirt-python-20220309-64893-9iygho/libvirt-python-7.8.0/setup.py'"'"'; __file__='"'"'/private/tmp/virt-manager--libvirt-python-20220309-64893-9iygho/libvirt-python-7.8.0/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-2f217mq7/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/Cellar/virt-manager/2.2.1_3/libexec/include/site/python3.9/libvirt-python Check the logs for full command output. WARNING: You are using pip version 21.3.1; however, version 22.0.4 is available. You should consider upgrading via the '/usr/local/Cellar/virt-manager/2.2.1_3/libexec/bin/python3.9 -m pip install --upgrade pip' command. If reporting this issue please do so at (not Homebrew/brew or Homebrew/core): https://github.com/krish-sysadmin/homebrew-virt-manager/issues
If you run into this issue, you will need to edit the
.rb file for the
virt-manager tap. This is according to an outstanding issue/PR in GitHub. So edit the following file, and make the following changes:
You are going to change out the following:
url "https://libvirt.org/sources/python/libvirt-python-7.8.0.tar.gz" sha256 "9d07416d66805bf1a17f34491b3ced2ac6c42b6a012ddf9177e0e3ae1b103fd5"
For the following lines:
url "https://libvirt.org/sources/python/libvirt-python-8.1.0.tar.gz" sha256 "a21ecfab6d29ac1bdd1bfd4aa3ef58447f9f70919aefecd03774613f65914e43"
This will update the
libvirt-python package to
8.1.0 from version
Next, make sure to clean up the brew cache, and attempt to re-install:
brew cleanup brew install virt-manager virt-viewer
And everything should work this time...
Once installed, you can run the following to leverage a qemu host over SSH.
virt-manager -c 'qemu+ssh://firstname.lastname@example.org/system?socket =/var/run/libvirt/libvirt-sock'
192.168.1.25 with your own values. That's it!