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

check if existing network is VDS and has port attribute #31322

Merged
merged 1 commit into from
Nov 19, 2017
Merged

check if existing network is VDS and has port attribute #31322

merged 1 commit into from
Nov 19, 2017

Conversation

strattner
Copy link
Contributor

SUMMARY

When checking to see if the guest network has changed, attributes of the existing and new network are compared. However, the current check assumes that if the new network is associated with a VDS, the existing network must be as well - the end result that it tries to compare a "port" attribute, which fails when the existing network is not associated with a VDS.

For example, when a VM has existing network 'VM Network' (the default), and an attempt is made to change it to a portgroup that is associated to a VDS, the following error is generated:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'vim.vm.device.VirtualEthernetCard.NetworkBackingIn' object has no attribute 'port'
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_UkXVTS/ansible_module_vmware_guest.py\", line 1503, in <module>\n    main()\n  File \"/tmp/ansible_UkXVTS/ansible_module_vmware_guest.py\", line 1479, in main\n    result = pyv.reconfigure_vm()\n  File \"/tmp/ansible_UkXVTS/ansible_module_vmware_guest.py\", line 1351, in reconfigure_vm\n    self.configure_network(vm_obj=self.current_vm_obj)\n  File \"/tmp/ansible_UkXVTS/ansible_module_vmware_guest.py\", line 727, in configure_network\n    (nic.device.backing.port.portgroupKey != pg_obj.key or\nAttributeError: '**vim.vm.device.VirtualEthernetCard.NetworkBackingIn' object has no attribute 'port'**\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

The change that was made was to check whether the existing network was a VDS first, before attempting to compare VDS-related attributes.

Fixes #30524 that I had opened, and fix was based on recommended change by @nrwahl2

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

cloud/vmware/vmware_guest.py

ANSIBLE VERSION
ansible 2.5.0 (issue30524 9fe65e0420) last updated 2017/10/04 17:44:35 (GMT +000)
  config file = None
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /root/ansible/lib/ansible
  executable location = /root/ansible/bin/ansible
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
ADDITIONAL INFORMATION

@ansibot
Copy link
Contributor

ansibot commented Oct 4, 2017

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bugfix_pull_request cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community labels Oct 4, 2017
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Oct 4, 2017
@Akasurde
Copy link
Member

Akasurde commented Oct 5, 2017

@strattner Could you please add integration test for this change ?

@mattclay
Copy link
Member

mattclay commented Oct 5, 2017

Closing and re-opening to trigger CI.

@mattclay mattclay closed this Oct 5, 2017
@mattclay mattclay reopened this Oct 5, 2017
@ansibot ansibot removed the needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. label Oct 5, 2017
@ansibot
Copy link
Contributor

ansibot commented Oct 14, 2017

@ansibot ansibot added stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. new_contributor This PR is the first contribution by a new community member. labels Oct 14, 2017
@ansibot ansibot removed the new_contributor This PR is the first contribution by a new community member. label Nov 3, 2017
@Akasurde
Copy link
Member

@strattner Are you still working on this ?

@strattner
Copy link
Contributor Author

@Akasurde I am not sure what else needs to be done. I submitted this change, is there something specific I should do?

@Akasurde Akasurde closed this Nov 17, 2017
@Akasurde Akasurde reopened this Nov 17, 2017
@Akasurde
Copy link
Member

Closing and re-opening for CI.

@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 17, 2017
@l3m
Copy link
Contributor

l3m commented Nov 17, 2017

This solved my problem (#32975), so please:

shipit !

@Akasurde Akasurde merged commit 0334b3f into ansible:devel Nov 19, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. vmware VMware community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing 'port' AttributeError when modifying existing VM network
6 participants