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

Rightly take the host parameter into account while cloning a VM on a cluster #2496

Merged
merged 1 commit into from Jun 21, 2021

Conversation

jpillon
Copy link
Contributor

@jpillon jpillon commented Jun 16, 2021

Description

Just set the Dest Host properly in the clone task

Closes: #2495

Type of change

Please mark options that are relevant:

  • [ X] 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

How Has This Been Tested?

  • [X ] Test with packer (after a bug fix in it)

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

@jpillon, 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.

@vmwclabot
Copy link
Member

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

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 @jpillon ! Looks good, 2 minor suggestions

@@ -1701,8 +1701,16 @@ func (vm *VirtualMachine) CloneVMTask(ctx *Context, req *types.CloneVM_Task) soa
pool = vm.ResourcePool
}
}

DestHost := vm.Runtime.Host
Copy link
Member

Choose a reason for hiding this comment

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

Non-exported variable names should start with lowercase, can you rename to destHost ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commit amended ;-)

DestHost := vm.Runtime.Host

if req.Spec.Location.Host != nil {
hostRef := req.Spec.Location.Host.Reference()
Copy link
Member

Choose a reason for hiding this comment

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

req.Spec.Location.Host is already a pointer, so there's no need for hostRef here, can do the following instead:

	if req.Spec.Location.Host != nil {
		destHost = req.Spec.Location.Host
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for that, I'm not extremely familiar with Go.
I amended my commit for that (since I also needed to change the commit message)

@dougm
Copy link
Member

dougm commented Jun 19, 2021

@jpillon one other request, can you prefix the commit message with vcsim: ? This helps the CHANGELOG generator:
https://github.com/vmware/govmomi/blob/master/CONTRIBUTING.md#format-of-the-commit-message

vcsim: take the host parameter into account while cloning a VM on a cluster

@dougm dougm added this to the 0.27 milestone Jun 19, 2021
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 @jpillon

@dougm dougm merged commit 93851bd into vmware:master Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] vcsim: The spec.location.host SOAP parameter is ignored when cloning
3 participants