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

edit domain.xml before VM launch #791

Open
brianjmurrell opened this issue Jun 16, 2017 · 3 comments
Open

edit domain.xml before VM launch #791

brianjmurrell opened this issue Jun 16, 2017 · 3 comments

Comments

@brianjmurrell
Copy link
Contributor

It would be useful to have a hook in the Vagrantfile for doing arbitrary edits to the resulting domain.xml file before VM launch for those situations where there is no support for a libvirt feature in vagrant-libvirt, such as virtio-scsi support.

@brianjmurrell
Copy link
Contributor Author

If I were interested in hacking this in, where would be a good place to put it?

@electrofelix
Copy link
Contributor

Have a look at

begin
server = env[:machine].provider.driver.connection.servers.create(
xml: to_xml('domain')
)
, the to_xml('domain') call returns the XML document as a string defining the domain.

You could wrap that with a callback to a function that calls a custom command defined by you the user to transform it and return back a suitable string.

@electrofelix
Copy link
Contributor

This has come up again recently around also packaging boxes with a domain XML definition so that custom devices maybe specified as part of the VM box instead of being needed to be implemented in every case.

Essentially I think the solution would need to involve providing a callback for a function defined in the Vagrantfile that can operate on the XML tree elements during the create or start domain phases, with some validation performed and then controlled passed back to create/start the domain.

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

No branches or pull requests

3 participants