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

govc: Use unique searchFlagKey when calling NewSearchFlag #2850

Merged
merged 1 commit into from May 18, 2022

Conversation

makelarisjr
Copy link
Contributor

Description

When cloning a VM if you specify the -host.dns flag it throws the error expected VirtualMachine entity, got HostSystem, this is because the SearchFlag instance is saved in the context with a static searchFlagKey

Closes: #2849

Type of change

Please mark options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update
  • Build related change

How Has This Been Tested?

I successfully cloned a VM by using this command:
./govc vm.clone -vm "TestDHCP" -host.dns "esxi-eu-dev-01.example.com" testvm

Checklist:

  • My code follows the CONTRIBUTION guidelines of
    this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

@vmwclabot
Copy link
Member

@makelarisjr, you must sign our contributor license agreement before your changes are merged. Click here to sign the agreement. If you are a VMware employee, read this for further instruction.

govc/flags/search.go Outdated Show resolved Hide resolved
@makelarisjr makelarisjr requested a review from dougm May 18, 2022 21:05
dougm
dougm previously approved these changes May 18, 2022
Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @makelarisjr ! Please go ahead and squash the commits and I will merge

@dougm dougm merged commit 28fe19b into vmware:master May 18, 2022
dougm added a commit to dougm/govmomi that referenced this pull request Jun 1, 2022
PR vmware#2850 fix a search flag issue with the vm.clone command, but caused an issue with the vm.migrate command.
Rather than embed the SearchFlag directly, vm.migrate needs to embed the VirtualMachineFlag

Issue vmware#2849
@vmwclabot
Copy link
Member

@makelarisjr, VMware has rejected your signed contributor license agreement. The change has already been merged, but it will be backed out by the project maintainers if the agreement is not resigned in a timely manner. Click here to resign the agreement.

@vmwclabot
Copy link
Member

@makelarisjr, VMware has rejected your signed contributor license agreement. The change has already been merged, but it will be backed out by the project maintainers if the agreement is not resigned in a timely manner. Click here to resign the agreement.

@vmwclabot
Copy link
Member

@makelarisjr, VMware has approved your signed contributor license agreement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] govc: Unable to clone a vm when using the -host.dns flag
3 participants