Skip to content

"default" network pool won't apply #25

Open
@velis74

Description

@velis74

I ran into an issue configuring the default network pool where qemu won't modify the subnet like I want.
The playbook runs just fine, but doesn't change anything.

- name: Basic provisioning of VM hosts
  hosts: vm_hosts
  roles:
    - role: stackhpc.libvirt-host
      libvirt_host_pools:
        - name: default
          type: dir
          path: /var/lib/libvirt/images
          mode: 755
          owner: libvirt-qemu
          group: kvm
      libvirt_host_networks:
        - name: default
          mode: nat
          bridge: virbr0
          domain: qemu.local
          ip: 192.168.123.254
          netmask: 255.255.255.0
          dhcp_start: 192.168.123.100
          dhcp_end: 192.168.123.250

Note the different subnet from default .122 and a different DHCP pool.

But if I change the name and bridge parameters, a new network will be created with my desired parameters.

I have found that stopping and deleting the default network from within Virtual Machine Manager GUI will leave qemu open for provisioning like I want (stopping alone is not enough). So this is currently work-around-able, clumsy-like.

It would seem that the task for provisioning the network only checks for its existence, but not its parameters.

I also tried changing virt_net command from define to modify, but that failed because it's not supported.

I think it should be possible (info, facts, list_nets?) to retrieve current configuration, determine that it doesn't match, then deactivate and delete the network. Only after that, create it anew from given parameters.

But, there's a catch:
I'm pretty sure this would be impossible with running guests (at least I HOPE qemu would not allow deleting a network in use), so this approach would only work while provisioning a host from scratch. I'm talking about scenario where the parameters would be found to differ, of course.

Still worth investigating / trying, IMO.

If you feel so too, let me know, I'll try to whip up a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions