-
Notifications
You must be signed in to change notification settings - Fork 69
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
Domain xml template doesn't include guest agent channel #17
Comments
Would be happy to see a PR for this if it helps you. I've not knowingly used guest agents before, is that something we should always enable or should it be optional? |
If defaulted, the VM guest should work fine if the channel is added but not used - i.e. agent not installed. So it would be fine to default. As per Red Hat docs:
I believe it can help let libvirt gracefully shut down guests instead of suspending them between host reboots, etc. By the way, I'll expand on other differences I noticed. To default power management features or not?Also not sure, noticed ACPI features weren't included in the default template, e.g.: <features>
<acpi/>
<apic/>
</features> Would need to dig in source code/docs more to find out libvirt manages guests via the agent or ACPI to get them shutdown via libvirt. Clock optimisationsI think the default may or may not be missing some clock optimizations
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
</clock> Allow using own XML template?Regardless, I think it might be good to allow the play calling the role to overwrite the default xml template the role supplies to the I find Would be painful, but could try see how virt-install creates/uses different templates depending on OS family and variant. |
Sounds reasonable.
ACPI seems like a reasonable request.
Just looking at what OpenStack nova does here, it only adds timer config for KVM. It does add those timers, with the same config, with an optional HPET.
I like this idea. Trying to support every libvirt feature is never going to work, so a bring your own template approach would make this role very flexible. |
I was hoping that simply having a custom template at Ansible docs aren't that clear to me about how this behaves either after reading Documentation of which directories a template is searched for and Search paths in Ansible. So I'm working on a PR to allow overriding the default via an option More about using guest agent and clock time settingsSee KVM GUEST TIMING MANAGEMENT
Also Recommended default clock/timer settings has |
Okay, so PR for custom xml done. Should we enhance the current default template? Before submitting another PR, wanted to confirm if the following adaptations of the current default template are desirable - including an extra switch for interfaces to handle bridged mode. I think 1 to 3 are okay, but unsure about 4 - clock settings. 1. Guest agent supportAdd guest agent channel - as above, no risk/issue if VM guest doesn't have the agent installed. In the devices section: <!-- support qemu guest agent -->
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
</controller>
<channel type='unix'>
<target type='virtio' name='org.qemu.guest_agent.0'/>
<address type='virtio-serial' controller='0'/>
</channel> 2. ACPI <features>
<acpi/>
<apic/>
</features> 3. Bridged interface type/modeAs per libvirt wiki: Bridged networking (aka "shared physical device") - Guest configuration Proposed example config: interfaces:
- type: bridge
source:
bridge: br0 Proposed new interfaces jinja2 templating:
And builds this:
FYI, above isn't essential. Technically, it's also possible for users to externally define and configured bridged interfaces and a libvirt network in bridged mode such that the This for domain xml:
And this for network xml: <network>
<name>uat</name>
<forward mode='bridge'/>
<bridge name='br0' macTableManager='libvirt'/>
</network> However, doesn't seem like 4. clock (but unsure):Linux guestsAssuming linux VMs, this is how
Adding Windows guests?All of the above clock settings aim at linux guests - if a safe default is wanted for windows, not sure that's doable given Current default Maybe have two balanced default options and switch between the templates if guest is Linux vs Windows? For windows guests, I've used this:
|
LGTM
LGTM
We typically use the latter approach you've described here, with libvirt networks in the bridge forwarding mode. The network config required for
If using guest bridged networking is useful to you, I'd be happy to accept support for it.
We're not currently Windows users, but happy to accept anything (within reason) that improves the role for those who are. Perhaps each VM could take an optional attibute that describes the OS type (linux, windows, etc). |
We might not have to add an extra switch... Since we've added the option to specify custom XML domain definitions, perhaps a safer way is to leave just your minimal template as the default and pre-package 2 other templates in the template folder, one optimized for Linux, the other Windows, both with more optimal clock settings and update the README to point users who care for the details. |
Thanks, will try it - missed that somehow and did my own config outside of the role. |
Suggestion: Include guest channel when appropriate?
Noticed from some testing that
vm.xml.j2
differs to avirt-install --os_varient rhe7
in that the template does not include guest agent channel, where virt-install creates a domain definition which affectivly has:In addition, some virtio serial controller and channel options are not set.
Full example for
virt-install
command:Tested on Red Hat 7.6.
The text was updated successfully, but these errors were encountered: