Comments (8)
Hi @yajo,
I initially started with qemu:///session
and this was working great with Fedora. But it was not the case for the other Linux distributions. And a lot of manual configuration steps were required to grant the user the right to spawn VM. In addition, the network was a problem. As far as I remember, you cannot create new network with qemu:///session
.
The situation may have change thus, and I would be happy to accept a patch to give the ability to use user session.
from virt-lightning.
In addition, the network was a problem. As far as I remember, you cannot create new network with
qemu:///session
.
In https://wiki.qemu.org/Features/HelperNetworking it explains that you can use /usr/local/libexec/qemu-bridge-helper
to create networks, as long as they are allowed in the /etc/qemu/bridge.conf
file. In vagrant-libvirt you can also gather more details.
In Fedora, that file contains allow virbr0
, which means that, as long as the network is named virbr0
, you can create and use it. I use Fedora, and yes it seems to be one of the 1st distros defaulting to qemu:///session
, and it works just fine.
I initially started with
qemu:///session
and this was working great with Fedora. But it was not the case for the other Linux distributions.
I understand that, if it is more difficult for other distros, the default is qemu:///system
(which, BTW, will still give more freedom in Fedora too). However, it would be very nice if there were a way to force use the session URL, so one could configure vl
to talk to session, then provide the proper network name, and then have the perfect replacement for Vagrant, all running rootless.
from virt-lightning.
In addition, the network was a problem. As far as I remember, you cannot create new network with
qemu:///session
.In https://wiki.qemu.org/Features/HelperNetworking it explains that you can use
/usr/local/libexec/qemu-bridge-helper
to create networks, as long as they are allowed in the/etc/qemu/bridge.conf
file. In vagrant-libvirt you can also gather more details.In Fedora, that file contains
allow virbr0
, which means that, as long as the network is namedvirbr0
, you can create and use it. I use Fedora, and yes it seems to be one of the 1st distros defaulting toqemu:///session
, and it works just fine.
Virt-Lightning uses a network called virt-lightning by default. If the network does not exist yet, it will create it. The users may also want to add extra NIC and define yet another network. In this case, virt-lightning will also create them on the fly.
This obviously would not work as expected with qemu:///session
, but with a clear message it should be fine IMO.
You want to use a network that does not exist yet. You can either connect with the system account or create the network manually with the following commands. yadi yada
.
Would you like to work on a PR?
from virt-lightning.
Virt-Lightning uses a network called virt-lightning by default
But by reading the docs, it seems to me that you can change the network_name
in the configuration, so setting virbr0
should make it compatible, isn't it?
What I can't find is how to make it connect to qemu:///session
🤔
Would you like to work on a PR?
I'd like but TBH I don't think I'll can. 😕
from virt-lightning.
Virt-Lightning uses a network called virt-lightning by default
But by reading the docs, it seems to me that you can change the
network_name
in the configuration, so settingvirbr0
should make it compatible, isn't it?
Yes it should as soon it's the only network to use. You can also set libvirt_uri
to qemu:///session
in the configuration. You will also need to adjust the storage pool (storage_pool
key).
https://github.com/virt-lightning/virt-lightning/blob/master/virt_lightning/configuration.py#L10
What I can't find is how to make it connect to
qemu:///session
Would you like to work on a PR?
I'd like but TBH I don't think I'll can.
Well, I will be happy to assist you :-).
from virt-lightning.
I have added this config:
[main]
network_name = virbr0
storage_pool = /var/home/yajo/prodevel/tecnativa-infrastructure/molecule/virt-lightning-storage
libvirt_uri = qemu:///session
up
fails with:
Traceback (most recent call last):
File "/var/home/yajo/.local/pipx/.cache/7c2286de99a2ac5/bin/virt-lightning", line 8, in <module>
sys.exit(main())
File "/var/home/yajo/.local/pipx/.cache/7c2286de99a2ac5/lib64/python3.9/site-packages/virt_lightning/shell.py", line 362, in main
action_func(configuration=configuration, **vars(args))
File "/var/home/yajo/.local/pipx/.cache/7c2286de99a2ac5/lib64/python3.9/site-packages/virt_lightning/api.py", line 181, in up
hv.init_network(configuration.network_name, configuration.network_cidr)
File "/var/home/yajo/.local/pipx/.cache/7c2286de99a2ac5/lib64/python3.9/site-packages/virt_lightning/virt_lightning.py", line 553, in init_network
self.network_obj = self.create_network(network_name, network_cidr)
File "/var/home/yajo/.local/pipx/.cache/7c2286de99a2ac5/lib64/python3.9/site-packages/virt_lightning/virt_lightning.py", line 592, in create_network
return self.conn.networkCreateXML(xml)
File "/var/home/yajo/.local/pipx/.cache/7c2286de99a2ac5/lib64/python3.9/site-packages/libvirt.py", line 4902, in networkCreateXML
raise libvirtError('virNetworkCreateXML() failed')
libvirt.libvirtError: error creating bridge interface virbr0: Operation not permitted
Any clues on why it's failing? 🤔
from virt-lightning.
The init_network()
tries to do things it's not allowed to do. You can try to add a return
statement at the beginning of the block to avoid that. A better fix that you can introduce later is to figure out if we're in user session mode.
diff --git a/virt_lightning/virt_lightning.py b/virt_lightning/virt_lightning.py
index 349994f..c790444 100644
--- a/virt_lightning/virt_lightning.py
+++ b/virt_lightning/virt_lightning.py
@@ -543,6 +543,7 @@ class LibvirtHypervisor:
raise Exception("Failed to find %s in %s", ":".join(ISO_BINARIES), paths)
def init_network(self, network_name, network_cidr):
+ return
try:
self.network_obj = self.conn.networkLookupByName(network_name)
except libvirt.libvirtError as e:
from virt-lightning.
Done, and now it fails with:
❯ vl --config virt-lightning.ini distro_list
Traceback (most recent call last):
File "/var/home/yajo/.local/bin/vl", line 8, in <module>
sys.exit(main())
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/virt_lightning/shell.py", line 286, in main
for distro_name in virt_lightning.api.distro_list(
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/virt_lightning/api.py", line 434, in distro_list
hv.init_storage_pool(configuration.storage_pool)
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/virt_lightning/virt_lightning.py", line 604, in init_storage_pool
self.storage_pool_obj = self.create_storage_pool(
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/virt_lightning/virt_lightning.py", line 634, in create_storage_pool
pool = self.conn.storagePoolDefineXML(xml, 0)
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/libvirt.py", line 5424, in storagePoolDefineXML
raise libvirtError('virStoragePoolDefineXML() failed')
libvirt.libvirtError: XML error: name /var/home/yajo/prodevel/tecnativa-infrastructure/molecule/virt-lightning-storage cannot contain '/'
If I remove storage_pool
from the config file, it says:
❯ vl --config virt-lightning.ini distro_list
You need root privilege to create the storage pool, please do:
sudo mkdir -p /var/lib/virt-lightning/pool/upstream
sudo chown -R qemu:qemu /var/lib/virt-lightning/pool
sudo chown -R yajo /var/lib/virt-lightning/pool/upstream
sudo chmod 775 /var/lib/virt-lightning
sudo chmod 775 /var/lib/virt-lightning/pool /var/lib/virt-lightning/pool/upstream
If I add it, but without any /
character (just storage_pool = vls
):
❯ vl --config virt-lightning.ini distro_list
Traceback (most recent call last):
File "/var/home/yajo/.local/bin/vl", line 8, in <module>
sys.exit(main())
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/virt_lightning/shell.py", line 286, in main
for distro_name in virt_lightning.api.distro_list(
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/virt_lightning/api.py", line 434, in distro_list
hv.init_storage_pool(configuration.storage_pool)
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/virt_lightning/virt_lightning.py", line 604, in init_storage_pool
self.storage_pool_obj = self.create_storage_pool(
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/virt_lightning/virt_lightning.py", line 634, in create_storage_pool
pool = self.conn.storagePoolDefineXML(xml, 0)
File "/var/home/yajo/.local/pipx/venvs/virt-lightning/lib64/python3.9/site-packages/libvirt.py", line 5424, in storagePoolDefineXML
raise libvirtError('virStoragePoolDefineXML() failed')
libvirt.libvirtError: operation failed: Storage source conflict with pool: 'virt-lightning'
😖
from virt-lightning.
Related Issues (20)
- pip 21.3 fails to resolve test requirements HOT 2
- Add delete function HOT 2
- CLI confusion HOT 1
- Snapshots / restore? HOT 2
- Use python2 in inventory for Trusty VM HOT 2
- Allow specifiying the video model HOT 7
- Libvirt network config doesn't handle DHCP section HOT 1
- Failed to connect socket to '/opt/homebrew/var/run/libvirt/virtqemud-sock' HOT 2
- Mounts ? HOT 1
- setting staitc ip with ivp4 dosen't work HOT 3
- New release on pypi HOT 1
- testing the app locally without installing it each time HOT 1
- wrong resolve.conf values when using new libvirt network HOT 2
- 'vl start' has no option for disk configuration HOT 2
- vl doesn't seem to work with Python 3.10 HOT 1
- Live snapshot is not supported
- asyncio.Event loop parameter removal in Python 3.10 HOT 1
- pip3 install --user virt-lightning error: externally-managed-environment Debian-12 HOT 3
- better support VM image file extensions for config.ini private_hub= HOT 2
- How do I add my own images ? or better yet can we get debian-13 on the list ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from virt-lightning.