Skip to content

Make salt.states.virt consistent with salt.modules.virt and add virt.reset #64955

@ngaugler

Description

@ngaugler

salt.states.virt has inconsistencies making it difficult to appropriately interface with libvirt. Within libvirt one can perform both a soft and hard shutdown or reboot/reset of a guest domain. The module salt.modules.virt functions seem to appropriately reflect these features, but the state salt.states.virt functions are inconsistent and intermingle terminology. Documentation is also inconsistent as well adding more confusion.

Below is a mapping showing some basic inconsistencies:

Type Task libvirt Module State
soft shutdown shutdown salt.modules.virt.shutdown salt.states.virt.stopped
hard power off destroy salt.modules.virt.stop salt.states.virt.powered_off
soft reboot reboot salt.modules.virt.reboot salt.states.virt.rebooted
hard reset reset salt.modules.virt.reset N/A

It's inconsistency makes it difficult to anticipate what command will be sent to libvirt. It's so difficult that even the documentation for salt.states.virt.powered_off shows the wrong example in the SLS YAML and lists virt.stopped https://docs.saltproject.io/en/latest/ref/states/all/salt.states.virt.html#salt.states.virt.powered_off

It would be easy to add the missing salt.states.virt.reset function, but ideally this entire state would be revamped to be consistent with the module. Also, the documentation should be fixed to reflect the right command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Featurenew functionality including changes to functionality and code refactors, etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions