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

Xen support #40

Merged
merged 3 commits into from Aug 23, 2019
Merged

Xen support #40

merged 3 commits into from Aug 23, 2019

Conversation

meffie
Copy link
Contributor

@meffie meffie commented Aug 20, 2019

It is possible for kvm-install-vm to install cloud-init images on Xen as well, with just some minor tweaks to the virt-install arguments. Allow advanced users to customize the virt-install arguments for their hypervisor by adding settings in the ~/.kivrc file.

Thanks to Cheyenne Wills cwills@sinenomine.net for suggestions and testing on Xen.

Add a wrapper function to automatically print command arguments when
running in verbose mode. Currently, this is only done for the `virsh
pool-create-as` and `virt-install` commands, but more commands could
be added in the future.

Having the wrapper run the command removes the redundant command
arguments and will allow us to more easily support a variable number
of virt-install arguments

This commit introduces the following shell helper functions:

    join             Join strings into a single string, joined
                     by a delimiter.

    output_command   Print the command arguments for verbose mode,
                     formatted as one argument per line, with line
                     continuation characters as needed.

    run              Command execution wrapper to print the command
                     when running in verbose mode and to redirect
                     output to the current log file.
Typically, the `virt-install` user does not need to specify the
--graphics option. When the --graphics flag is not specified,
virt-install will try and choose a useful default and launch a suitable
connection.

Support graphics auto-detection by omitting the virt-install --grahics
option when the kvm-install-vm '-g' flag is set to 'auto' or the
GRAPHICS variable in the ~/.kivrc file is set to 'auto'.


#
# Advanced virt-install options.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


# Command wrapper to output the command to be run in verbose
# mode and redirect stdout and stderr to the vm log file.
function run ()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this a lot!

Copy link
Owner

@giovtorres giovtorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Just one comment.

@@ -714,6 +790,17 @@ function set_defaults ()

function set_custom_defaults ()
{
# Advanced hypervisor options. Override in ~/.kivrc if needed.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to set these defaults along with the rest in set_defaults ().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. I was unsure if it would be better to have them in set_defaults() or set_custom_defaults(). I will move them back to set_defaults().

Copy link
Contributor Author

@meffie meffie Aug 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patchset set has been updated (git commit --amend; git push --force)

--disk ${CI_ISO},device=cdrom \
--network ${NETWORK_PARAMS} \
--os-type=linux \
run "Installing the domain" \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Support custom virt-install parameters for advanced usage. This allows
for advanced customization and to support Xen and other non-KVM
hypervisors.

Users may specify hypervisor specific settings in the $HOME/.kivrc
customization file, without resorting to patching kvm-install-vm.

With this change, none of the virt-install parameters are hardcoded in
the script, values may be specified to be empty to avoid setting a given
parameter, and additional options may be provided as needed.

This commit adds the following custom virt-install options:

    NETWORK_MODEL       --network model value (default: virtio)
    NETWORK_EXTRA       extra --network options
    DISK_BUS            --disk bus type (default: virtio)
    DISK_EXTRA          extra --disk parameters
    CI_ISO_DEVICE       ci cdrom device type (default: cdrom)
    CI_ISO_EXTRA        extra ci cdrom parameters (default: "")
    GRAPHICS_LISTEN     --graphics listen value (default: localhost)
    GRAPHICS_EXTRA      extra graphics parameters
    VIRT_INSTALL_EXTRA  extra virt-install options

The following virt-install options are dependent on the image being
installed, and so are determined the value of -t command line option.

    OS_TYPE             --os-type (currently always "linux")
    DISK_FORMAT         --disk format (currently always "qcow2")
@giovtorres giovtorres merged commit d053064 into giovtorres:master Aug 23, 2019
@meffie
Copy link
Contributor Author

meffie commented Aug 23, 2019

Thank you giovtorres.

@meffie meffie deleted the xen-support branch August 23, 2019 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants