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

Virt states improvements #48421

Merged
merged 8 commits into from Jul 9, 2018

Conversation

Projects
None yet
4 participants
@cbosdo
Copy link
Contributor

commented Jul 3, 2018

What does this PR do?

This PR improves the virt states by using the new virt.init parameters in virt.running, rewriting virt.pool_define to handle more pool types, complete unit tests and documentation as well as some cleanup like some kwargs removal.

What issues does this PR fix or reference?

None

Tests written?

Yes

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

cbosdo added some commits Jun 22, 2018

Add test case for virt.running
Test virt.running when the domain needs to be edited and started. This
will prevent regressions when improving virt.running to handle the new
virt.init parameters.
virt.running support for all virt.init options
virt.running actually calls virt.init if the virtual machine doesn't
exist. Let the user define all the virt.init possible options in his
running states too.
Add connection parameters to virt states
Since the virt module allows the user to override the connection
parameters, bubble these changes to the non-deprecated virt states.
Align virt network definition functions with others
Rename execution module virt.net_define in virt.network_define and
state virt.network_define into virt.network_running. Also fix the
network_running state to match the virt.running implementation style.
Allow defining more virtual storage pool types
The virt.pool_define template is way too limited to handle all possible
libvirt pool types. Add some more parameters to cover them all.
Add missing virt states unit tests
So far only the virt.running state is unit tested. Add tests for the
other states. Deprecated virt states have been purposedly left untested.
Align virt.pool_define state with domains
Change the function name to pool_running since that state ensures the
pool is running, rather than just defining it. Also change the
implementation to match the one from virt.running() to keep consistent
across the module.
Remove unneeded kwargs in virt states
Avoid using kwargs to get the states parameters, perfer documented
named parameters with default value.
@cbosdo

This comment has been minimized.

Copy link
Contributor Author

commented Jul 3, 2018

@rallytime @gtmanfred Could someone have a look at this PR?

@rallytime rallytime requested review from rallytime and gtmanfred Jul 3, 2018

'''
Create libvirt pool.
:param name: Pool name
:param ptype: Pool type
:param target: Pool path target
:param source: Pool dev source

This comment has been minimized.

Copy link
@gtmanfred

gtmanfred Jul 3, 2018

Contributor

I don't like the idea of removing source.

At the very least, we should go through a deprecation process of this, and allow all of the other source_* things to still be defined in source.

This comment has been minimized.

Copy link
@cbosdo

cbosdo Jul 4, 2018

Author Contributor

@gtmanfred I know, but I removed that one without deprecating because it hasn't been released yet.

@homolkad could you check that these changes too since you are the one who introduced the pool and net define functions?

This comment has been minimized.

Copy link
@gtmanfred

gtmanfred Jul 5, 2018

Contributor

cool, if it hasn't been released yet, then I am ok with it if @homolkad is.

This comment has been minimized.

Copy link
@homolkad

homolkad Jul 9, 2018

Contributor

It is ok. Nice job.

vport = kwargs.pop('vport', None)
tag = kwargs.pop('tag', None)
autostart = kwargs.pop('autostart', True)
start = kwargs.pop('start', True)

This comment has been minimized.

Copy link
@rallytime

rallytime Jul 5, 2018

Contributor

Does start need to be deprecated? I don't see this option used below and people might be passing this through still.

This comment has been minimized.

Copy link
@cbosdo

cbosdo Jul 5, 2018

Author Contributor

@rallytime This one and the other one you've spot are two states that haven't been published yet... that's why start hasn't been deprecated and removed directly. And after all, what's the point in telling we want the network / pool to be started in the *_running state?

target = kwargs.pop('target', None)
source = kwargs.pop('source', None)
autostart = kwargs.pop('autostart', True)
start = kwargs.pop('start', True)

This comment has been minimized.

Copy link
@rallytime

rallytime Jul 5, 2018

Contributor

Same question here.

@rallytime rallytime merged commit 2f2a0ee into saltstack:develop Jul 9, 2018

12 of 17 checks passed

jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #20261 — ABORTED
Details
codeclimate 25 issues to fix
Details
default Build finished.
Details
jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #11178 — FAILURE
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has failed
Details
WIP ready for review
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #26419 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #18456 — SUCCESS
Details
jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #6208 — SUCCESS
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #24136 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #23091 — SUCCESS
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has passed
Details
jenkins/pr/py3-centos-7 The py3-centos-7 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.