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

Adds Instant Clone Support to vmware_guest Module #61014

Open
wants to merge 12 commits into
base: devel
from

Conversation

@PDQDakota
Copy link

commented Aug 21, 2019

SUMMARY

Adds support for the instant clone API in vSphere to the vmware_guest module.

Instant Cloning is a method of cloning a running or frozen VM that uses Copy on Write for both disk and RAM allocation in order to reduce the amount of resources used by a cloned VM and to reduce the time required for the clone to become available. It requires a vSphere instance for the API to be available, it doesn't work with only an ESXi host.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

vmware_guest module

ADDITIONAL INFORMATION

I don't think I have more to add here but please request anything further you'd need of me!

@ansibot

This comment has been minimized.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2019

@PDQDakota, just so you are aware we have a dedicated Working Group for vmware.
You can find other people interested in this in #ansible-vmware on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2019

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except No exception type(s) specified

The test ansible-test sanity --test ansible-doc [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module vcenter_extension vcenter_extension_facts vcenter_folder vcenter_license vmware_about_facts vmware_cfg_backup vmware_cluster vmware_cluster_drs vmware_cluster_facts vmware_cluster_ha vmware_cluster_vsan vmware_content_deploy_template vmware_content_library_manager vmware_datacenter vmware_datastore_cluster vmware_datastore_facts vmware_datastore_maintenancemode vmware_deploy_ovf vmware_dns_config vmware_drs_group vmware_drs_group_facts vmware_drs_rule_facts vmware_dvs_host vmware_dvs_portgroup vmware_dvs_portgroup_facts vmware_dvs_portgroup_find vmware_dvswitch vmware_dvswitch_lacp vmware_dvswitch_nioc vmware_dvswitch_pvlans vmware_dvswitch_uplink_pg vmware_evc_mode vmware_export_ovf vmware_folder_info vmware_guest vmware_guest_boot_facts vmware_guest_boot_manager vmware_guest_custom_attribute_defs vmware_guest_custom_attributes vmware_guest_customization_facts vmware_guest_disk vmware_guest_disk_facts vmware_guest_facts vmware_guest_file_operation vmware_guest_find vmware_guest_move vmware_guest_network vmware_guest_powerstate vmware_guest_screenshot vmware_guest_sendkey vmware_guest_snapshot vmware_guest_snapshot_facts vmware_guest_tools_upgrade vmware_guest_tools_wait vmware_guest_video vmware_guest_vnc vmware_host vmware_host_acceptance vmware_host_active_directory vmware_host_capability_facts vmware_host_config_facts vmware_host_config_manager vmware_host_datastore vmware_host_dns_facts vmware_host_facts vmware_host_feature_facts vmware_host_firewall_facts vmware_host_firewall_manager vmware_host_hyperthreading vmware_host_ipv6 vmware_host_kernel_manager vmware_host_lockdown vmware_host_ntp vmware_host_ntp_facts vmware_host_package_facts vmware_host_powermgmt_policy vmware_host_powerstate vmware_host_scanhba vmware_host_service_facts vmware_host_service_manager vmware_host_snmp vmware_host_ssl_facts vmware_host_vmhba_facts vmware_host_vmnic_facts vmware_local_role_facts vmware_local_role_manager vmware_local_user_facts vmware_local_user_manager vmware_maintenancemode vmware_migrate_vmk vmware_object_role_permission vmware_portgroup vmware_portgroup_facts vmware_resource_pool vmware_resource_pool_facts vmware_tag_manager vmware_target_canonical_facts vmware_vcenter_settings vmware_vcenter_statistics vmware_vm_facts vmware_vm_host_drs_rule vmware_vm_shell vmware_vm_storage_policy_info vmware_vm_vm_drs_rule vmware_vm_vss_dvs_migrate vmware_vmkernel vmware_vmkernel_facts vmware_vmkernel_ip_config vmware_vmotion vmware_vsan_cluster vmware_vspan_session vmware_vswitch vmware_vswitch_facts vsphere_copy" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/cloud/vmware/vmware_guest.py, line 32, column
3, found a duplicate dict key (instant_clone). Using last defined value only.

The test ansible-test sanity --test pep8 [explain] failed with 5 errors:

lib/ansible/module_utils/vmware.py:327:5: E722 do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303 too many blank lines (2)
lib/ansible/modules/cloud/vmware/vmware_guest.py:381:161: E501 line too long (178 > 160 characters)
lib/ansible/modules/cloud/vmware/vmware_guest.py:382:161: E501 line too long (181 > 160 characters)
lib/ansible/modules/cloud/vmware/vmware_guest.py:384:161: E501 line too long (260 > 160 characters)

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest.py:379:3: key-duplicates DOCUMENTATION: duplication of key "instant_clone" in mapping

click here for bot help

@pgbidkar

This comment has been minimized.

Copy link
Contributor

commented Aug 21, 2019

My suggestion on this PR would be, change looks big, create separate module something like vmware_guest_instant_clone, instead of adding it to vmware_guest.
vmware_guest is already over loaded and vulnerable to breakages.

Thanks

@ansibot ansibot removed the needs_triage label Aug 21, 2019

@PDQDakota

This comment has been minimized.

Copy link
Author

commented Aug 21, 2019

@pgbidkar I'll see about moving it out into a separate module then.

@ansibot ansibot removed the module label Aug 22, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 23, 2019

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except No exception type(s) specified

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/module_utils/vmware.py:327:5: E722 do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303 too many blank lines (2)

click here for bot help

@ansibot ansibot added the ci_verified label Aug 23, 2019

@goneri

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

Hi @PDQDakota, thanks for the contribution and welcome in the community! We try to cover all the new features with little test playbooks.
See: https://docs.ansible.com/ansible/devel/dev_guide/platforms/vmware_guidelines.html

Do you think you can extend the existing functional tests to cover this new use-case? This way will be able to react faster in the future if something breaks your code. This will also speed up the review process. For the record, the other tests are located in this directory: https://github.com/ansible/ansible/tree/devel/test/integration/targets/vmware_guest/tasks

@PDQDakota

This comment has been minimized.

Copy link
Author

commented Aug 26, 2019

@goneri Yes, I'll be including additional functional tests to cover the use cases. Once I've split the feature into its own module I'll start on that. Once the module split is complete and the tests added I'll update this PR.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Aug 29, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 5 errors:

lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: invalid-documentation: DOCUMENTATION.module: not a valid value for dictionary value @ data['module']. Got 'vmware_guest_snapshot'
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'customvalues' in argument_spec defines type as 'list' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'source_vm' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'customvalues' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'source_vm' is listed in the argument_spec, but not documented in the module documentation

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except: No exception type(s) specified

The test ansible-test sanity --test docs-build [explain] failed with 3 errors:

docs/docsite/rst/modules/list_of_all_modules.rst:3107:0: undefined-label: undefined label: vmware_guest_instantclone_module (if the link has no caption the label must precede a section header)
docs/docsite/rst/modules/list_of_cloud_modules.rst:1289:0: undefined-label: undefined label: vmware_guest_instantclone_module (if the link has no caption the label must precede a section header)
docs/docsite/rst/modules/vmware_guest_snapshot_module.rst:9:0: duplicate-label: duplicate label vmware_guest_snapshot_module, other instance in /root/ansible/docs/docsite/rst/modules/vmware_guest_instantclone_module.rst

The test ansible-test sanity --test pep8 [explain] failed with 4 errors:

lib/ansible/module_utils/vmware.py:327:5: E722: do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303: too many blank lines (2)
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:56:1: E302: expected 2 blank lines, found 1
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:157:1: E302: expected 2 blank lines, found 1

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Sep 3, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: module-incorrect-version-added: version_added should be '2.10'. Currently 2.9

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except: No exception type(s) specified

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/module_utils/vmware.py:327:5: E722: do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303: too many blank lines (2)

click here for bot help

@ansibot ansibot added the ci_verified label Sep 3, 2019

@ansibot ansibot removed the ci_verified label Sep 5, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 19 errors:

lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: doc-choices-do-not-match-spec: Argument 'name_match' in argument_spec defines choices as (['first', 'last']) but documentation defines choices as ([])
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: doc-default-does-not-match-spec: Argument 'name_match' in argument_spec defines default as ('first') but documentation defines default as (None)
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: module-incorrect-version-added: version_added should be '2.10'. Currently 2.9
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: nonexistent-parameter-documented: Argument 'source_vm' is listed in DOCUMENTATION.options, but not accepted by the module argument_spec
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: nonexistent-parameter-documented: Argument 'state' is listed in DOCUMENTATION.options, but not accepted by the module argument_spec
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'clone_name' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'datacenter' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'folder' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'moid' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'name_match' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'use_instance_uuid' in argument_spec defines type as 'bool' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'uuid' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'clone_name' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'datacenter' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'folder' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'moid' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'name_match' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'use_instance_uuid' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'uuid' is listed in the argument_spec, but not documented in the module documentation

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except: No exception type(s) specified

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/module_utils/vmware.py:327:5: E722: do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303: too many blank lines (2)

click here for bot help

@ansibot ansibot added the ci_verified label Sep 5, 2019

@ansibot ansibot removed the ci_verified label Sep 5, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 19 errors:

lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: doc-choices-do-not-match-spec: Argument 'name_match' in argument_spec defines choices as (['first', 'last']) but documentation defines choices as ([])
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: doc-default-does-not-match-spec: Argument 'name_match' in argument_spec defines default as ('first') but documentation defines default as (None)
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: module-incorrect-version-added: version_added should be '2.10'. Currently 2.9
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: nonexistent-parameter-documented: Argument 'source_vm' is listed in DOCUMENTATION.options, but not accepted by the module argument_spec
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: nonexistent-parameter-documented: Argument 'state' is listed in DOCUMENTATION.options, but not accepted by the module argument_spec
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'clone_name' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'datacenter' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'folder' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'moid' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'name_match' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'use_instance_uuid' in argument_spec defines type as 'bool' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: parameter-type-not-in-doc: Argument 'uuid' in argument_spec defines type as 'str' but documentation doesn't define type
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'clone_name' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'datacenter' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'folder' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'moid' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'name_match' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'use_instance_uuid' is listed in the argument_spec, but not documented in the module documentation
lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: undocumented-parameter: Argument 'uuid' is listed in the argument_spec, but not documented in the module documentation

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except: No exception type(s) specified

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/module_utils/vmware.py:327:5: E722: do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303: too many blank lines (2)

click here for bot help

@ansibot ansibot added the ci_verified label Sep 5, 2019

@ansibot ansibot added support:core and removed ci_verified labels Sep 11, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: module-incorrect-version-added: version_added should be '2.10'. Currently 2.9

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except: No exception type(s) specified

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/module_utils/vmware.py:327:5: E722: do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303: too many blank lines (2)

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: module-incorrect-version-added: version_added should be '2.10'. Currently 2.9

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except: No exception type(s) specified

The test ansible-test sanity --test integration-aliases [explain] failed with 1 error:

test/integration/targets/vmware_guest_instantclone/aliases:0:0: missing alias `shippable/posix/group[1-4]` or `unsupported`

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/module_utils/vmware.py:327:5: E722: do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303: too many blank lines (2)

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

test/integration/targets/vmware_guest_instantclone/tasks/main.yml:3:19: error: syntax error: mapping values are not allowed here

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/cloud/vmware/vmware_guest_instantclone.py:0:0: module-incorrect-version-added: version_added should be '2.10'. Currently 2.9

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/module_utils/vmware.py:327:4: bare-except: No exception type(s) specified

The test ansible-test sanity --test integration-aliases [explain] failed with 1 error:

test/integration/targets/vmware_guest_instantclone/aliases:0:0: missing alias `shippable/posix/group[1-4]` or `unsupported`

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/module_utils/vmware.py:327:5: E722: do not use bare 'except'
lib/ansible/module_utils/vmware.py:334:5: E303: too many blank lines (2)

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

test/integration/targets/vmware_guest_instantclone/tasks/main.yml:3:19: error: syntax error: mapping values are not allowed here

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.