Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have libvirt.name = "libvirt_name_here" ability #1763

Open
LuisBL opened this issue Aug 19, 2023 · 1 comment
Open

have libvirt.name = "libvirt_name_here" ability #1763

LuisBL opened this issue Aug 19, 2023 · 1 comment

Comments

@LuisBL
Copy link

LuisBL commented Aug 19, 2023

Is your feature request related to a problem? Please describe.

I have the following Vagrantfile

$ cat Vagrantfile
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'

Vagrant.configure("2") do |config|
  config.vm.box = "debian/bullseye64"
  config.vm.provider :libvirt do |libvirt|
    # libvirt.name = "deb11_main"
    libvirt.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :target_type => 'virtio'
    libvirt.memory = 2048
    libvirt.cpus = 2
  end
$

With the bellow versions:

$ vagrant plugin list 
vagrant-faster (0.2.0, global)
vagrant-hostsupdater (1.2.4, global)
vagrant-libvirt (0.12.2, global)
$ 

Describe the solution you'd like
I would like to be able to name to name the libvirt VM e.g. # libvirt.name = "deb11_main" so I would be able to see with:

$ virsh list --all
 Id   Name                                  State
------------------------------------------------------
 -    deb11_ansible_vm_test_ansible_roles   shut off
 -    deb11_main                         shut off
$ 

Additional context
I thought this was available but when i try it I get:

$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

Libvirt Provider:
* The following settings shouldn't exist: name
$
@electrofelix
Copy link
Contributor

name is a VirtualBox provider option, don't know if it exists on any other provider. Vagrant does provide a standard way to set a guest name though, which is supported config.vm.define "deb11_main", combined with a provider option to set the prefix to an empty value using libvirt.default_prefix = "" will get you what you want.

Combining those into the example snippet you shared:

Vagrant.configure("2") do |config|
  config.vm.box = "debian/bullseye64"
  config.vm.define "deb11_main"
  config.vm.provider :libvirt do |libvirt|
    libvirt.default_prefix = ""
    libvirt.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :target_type => 'virtio'
    libvirt.memory = 2048
    libvirt.cpus = 2
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants