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

VMware: Change to fix issue found while cloning template with opaque network #54588

Closed
wants to merge 0 commits into from

Conversation

@pgbidkar
Copy link

commented Mar 29, 2019

SUMMARY

Change to fix issue found while cloning template with opaque network will get disconnected network. config paramter in cloneSpec is deprecated post 6.0. which was causing the issue
Issue was observed due to usage of deprecated API in Opaque network. Ultimately all references to configSpec needs to replaced.
Made relospec and object variable like self.configSpec.
Appending network change paramter nic to relospec instead of config spec

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vmware_guest

ADDITIONAL INFORMATION

VMs cloned from a template with opaque network will get disconnected network, which is a pretty common workflow. The issue only occurs when a deprecated API is used(though we still supposed to support today AFAIU).
The deprecated object is “config” in VirtualMachineCloneSpec: https://code.vmware.com/doc/preview?id=4206#/doc/vim.vm.CloneSpec.html

ansible 2.8.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/vmware/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vmware/Ansible/ansible/lib/ansible
  executable location = /home/vmware/Ansible/ansible/bin/ansible
  python version = 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609]

@pgbidkar pgbidkar changed the title Change to fix issue fould while cloning template with opaque network Change to fix issue found while cloning template with opaque network Mar 29, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Mar 29, 2019

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

test/integration/targets/vmware_guest/tasks/clone_customize_guest_test.yml:0:0: use "\n" for line endings instead of "\r\n"

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

lib/ansible/modules/cloud/vmware/vmware_guest.py:1417:17: E265 block comment should start with '# '
lib/ansible/modules/cloud/vmware/vmware_guest.py:1418:17: E265 block comment should start with '# '
lib/ansible/modules/cloud/vmware/vmware_guest.py:1419:17: E265 block comment should start with '# '

click here for bot help

@ansibot

This comment has been minimized.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Mar 29, 2019

@pgbidkar, 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

@Akasurde
Copy link
Member

left a comment

I am taking look into why other testcases are failing.

Show resolved Hide resolved lib/ansible/modules/cloud/vmware/vmware_guest.py Outdated
Show resolved Hide resolved test/integration/targets/vmware_guest/tasks/clone_customize_guest_test.yml Outdated
@Akasurde

This comment has been minimized.

Copy link
Member

commented Mar 29, 2019

@pgbidkar Do you think this will solve - #40564 ?

@Akasurde Akasurde changed the title Change to fix issue found while cloning template with opaque network VMware: Change to fix issue found while cloning template with opaque network Mar 29, 2019

@Akasurde Akasurde removed the needs_triage label Mar 29, 2019

@Akasurde Akasurde self-assigned this Mar 29, 2019

@Akasurde

This comment has been minimized.

Copy link
Member

commented Mar 29, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 1, 2019

@pgbidkar this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 1, 2019

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

test/integration/targets/vmware_guest/tasks/clone_customize_guest_test.yml:0:0: use "\n" for line endings instead of "\r\n"

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

lib/ansible/modules/cloud/vmware/vmware_guest.py:1417:17: E265 block comment should start with '# '
lib/ansible/modules/cloud/vmware/vmware_guest.py:1418:17: E265 block comment should start with '# '
lib/ansible/modules/cloud/vmware/vmware_guest.py:1419:17: E265 block comment should start with '# '

click here for bot help

@pgbidkar pgbidkar reopened this Apr 1, 2019

@pgbidkar

This comment has been minimized.

Copy link
Author

commented Apr 1, 2019

@Akasurde Due to conflict issue, I messed my commits. Hence did hard reset and pushed again. Few references might not work here. Sorry for the confusions

Also regarding query: Do you think this will solve - #40564 ? Yes! issue which was raised internally looks similar to this. This should fix the issue

Please review and let me know any more changes or comments.
Thanks

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 1, 2019

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

test/integration/targets/vmware_guest/tasks/clone_customize_guest_test.yml:0:0: use "\n" for line endings instead of "\r\n"

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

test/integration/targets/vmware_guest/tasks/clone_customize_guest_test.yml:55:1: empty-lines too many blank lines (1 > 0)
test/integration/targets/vmware_guest/tasks/main.yml:32:1: empty-lines too many blank lines (1 > 0)

click here for bot help

@pgbidkar pgbidkar force-pushed the pgbidkar:devel branch to 21fbb0e Apr 1, 2019

@pgbidkar

This comment has been minimized.

Copy link
Author

commented Apr 1, 2019

I fixed all format issues and re verified. Not really sure why check https://app.shippable.com/github/ansible/ansible/runs/117050/1/console is failing.
Please suggest

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 1, 2019

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

test/integration/targets/vmware_guest/tasks/clone_customize_guest_test.yml:0:0: use "\n" for line endings instead of "\r\n"

click here for bot help

@mattclay mattclay added the ci_verified label Apr 2, 2019

@pgbidkar

This comment has been minimized.

Copy link
Author

commented Apr 4, 2019

Hi, Any updates on this PR?

@Akasurde

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

@pgbidkar There is CI failure -

01:01 ERROR: Found 1 line-endings issue(s) which need to be resolved:
01:01 ERROR: test/integration/targets/vmware_guest/tasks/clone_customize_guest_test.yml:0:0: use "\n" for line endings instead of "\r\n" (75%)

in https://app.shippable.com/github/ansible/ansible/runs/117050/1/console

@pgbidkar

This comment has been minimized.

Copy link
Author

commented Apr 9, 2019

@pgbidkar There is CI failure -

01:01 ERROR: Found 1 line-endings issue(s) which need to be resolved:
01:01 ERROR: test/integration/targets/vmware_guest/tasks/clone_customize_guest_test.yml:0:0: use "\n" for line endings instead of "\r\n" (75%)

in https://app.shippable.com/github/ansible/ansible/runs/117050/1/console

Hi @Akasurde Yes! I did all formatting changes. Compared with existing .yaml files in the folder. Could not find any issue. Please can you suggest? Do I need to add extra line at the end of the file?

Thanks

@pgbidkar pgbidkar force-pushed the pgbidkar:devel branch from 21fbb0e to d74dccf Apr 9, 2019

@ansibot ansibot removed the ci_verified label Apr 9, 2019

@pgbidkar pgbidkar force-pushed the pgbidkar:devel branch from d74dccf to b1b78d9 Apr 9, 2019

@Akasurde

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

@jillr @goneri Could you please review this ? Thanks in advance.

@pdellaert
Copy link
Contributor

left a comment

One small language comment, rest i'm in line with @Akasurde reviewed/suggested

Show resolved Hide resolved lib/ansible/modules/cloud/vmware/vmware_guest.py Outdated

@pgbidkar pgbidkar force-pushed the pgbidkar:devel branch from b1b78d9 to 4129793 Apr 10, 2019

@Akasurde Akasurde force-pushed the pgbidkar:devel branch 2 times, most recently from 5b9dec3 to 45eb909 Apr 16, 2019

@Akasurde

This comment has been minimized.

Copy link
Member

commented Apr 16, 2019

@pgbidkar I am facing issue with this patch. https://app.shippable.com/github/ansible/ansible/runs/119408/121/console

Mac address and related facts are not generated as network is not created for new VM.

With Patch -

TASK [deploy vm] *******************************************************************************************
task path: /Volumes/data/src/ansible/playbooks/vmware_related/vcsim_hw_version.yml:10
changed: [localhost] => {
    "changed": true,
    "instance": {
        "annotation": null,
        "current_snapshot": null,
        "customvalues": {},
        "guest_consolidation_needed": false,
        "guest_question": null,
        "guest_tools_status": "guestToolsNotRunning",
        "guest_tools_version": "0",
        "hw_cluster": null,
        "hw_cores_per_socket": 1,
        "hw_datastores": [
            "LocalDS_0"
        ],
        "hw_esxi_host": "DC0_H0",
        "hw_files": [
            "[LocalDS_0] VM_6043/VM_6043.vmx",
            "[LocalDS_0] VM_6043/VM_6043.nvram",
            "[LocalDS_0] VM_6043/vmware.log",
            "[LocalDS_0] VM_6043/VM_6043.vmdk"
        ],
        "hw_folder": "/DC0/vm",
        "hw_guest_full_name": null,
        "hw_guest_ha_state": null,
        "hw_guest_id": "rhel7_64guest",
        "hw_interfaces": [],
        "hw_is_template": false,
        "hw_memtotal_mb": 512,
        "hw_name": "VM_6043",
        "hw_power_status": "poweredOff",
        "hw_processor_count": 1,
        "hw_product_uuid": "2426b85c-6a2c-4682-81c9-52471435afc9",
        "hw_version": "vmx-13",
        "instance_uuid": "8affc8ca-524b-4f49-8e2b-3901db2e5dae",
        "ipv4": null,
        "ipv6": null,
        "module_hw": true,
        "snapshots": [],
        "vnc": {}
    }
}

Without patch

TASK [deploy vm] *******************************************************************************************
task path: /Volumes/data/src/ansible/playbooks/vmware_related/vcsim_hw_version.yml:10
changed: [localhost] => {
    "changed": true,
    "instance": {
        "annotation": null,
        "current_snapshot": null,
        "customvalues": {},
        "guest_consolidation_needed": false,
        "guest_question": null,
        "guest_tools_status": "guestToolsNotRunning",
        "guest_tools_version": "0",
        "hw_cluster": null,
        "hw_cores_per_socket": 1,
        "hw_datastores": [
            "LocalDS_0"
        ],
        "hw_esxi_host": "DC0_H0",
        "hw_eth0": {
            "addresstype": "generated",
            "ipaddresses": [],
            "label": "Network Adapter 1",
            "macaddress": "00:0c:29:98:75:5a",
            "macaddress_dash": "00-0c-29-98-75-5a",
            "portgroup_key": null,
            "portgroup_portkey": null,
            "summary": "VM Network"
        },
        "hw_files": [
            "[LocalDS_0] VM_9904/VM_9904.vmx",
            "[LocalDS_0] VM_9904/VM_9904.nvram",
            "[LocalDS_0] VM_9904/vmware.log",
            "[LocalDS_0] VM_9904/VM_9904.vmdk"
        ],
        "hw_folder": "/DC0/vm",
        "hw_guest_full_name": null,
        "hw_guest_ha_state": null,
        "hw_guest_id": "rhel7_64guest",
        "hw_interfaces": [
            "eth0"
        ],
        "hw_is_template": false,
        "hw_memtotal_mb": 512,
        "hw_name": "VM_9904",
        "hw_power_status": "poweredOff",
        "hw_processor_count": 1,
        "hw_product_uuid": "3f1f3b2a-bf2b-40b5-a431-85c286452eba",
        "hw_version": "vmx-13",
        "instance_uuid": "a5c9bc5c-14ad-45ad-882e-f2ea7dfbc5ff",
        "ipv4": null,
        "ipv6": null,
        "module_hw": true,
        "snapshots": [],
        "vnc": {}
    }
}
@Akasurde
Copy link
Member

left a comment

Testcase failed

@Akasurde Akasurde closed this Apr 16, 2019

@Akasurde Akasurde force-pushed the pgbidkar:devel branch from 45eb909 to 521e62a Apr 16, 2019

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.