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

"default" network pool won't apply #25

Open
velis74 opened this issue Jan 29, 2020 · 1 comment
Open

"default" network pool won't apply #25

velis74 opened this issue Jan 29, 2020 · 1 comment

Comments

@velis74
Copy link

velis74 commented Jan 29, 2020

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

@jovial
Copy link
Contributor

jovial commented Jan 29, 2020

Sounds like a good enhancement me. I guess we should just fail in the case where there are VMs running and a change is requested to the network.

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