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

For cloning Virtual Machine has been powered off #746

Closed
chuanran opened this issue Apr 17, 2019 · 4 comments
Closed

For cloning Virtual Machine has been powered off #746

chuanran opened this issue Apr 17, 2019 · 4 comments
Labels
enhancement Type: Enhancement

Comments

@chuanran
Copy link

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform
issue trackers reserved for bug reports and feature requests. For general usage
questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v0.11.11

vSphere Provider Version

vsphere_v1.9.1_x4

Affected Resource(s)

vsphere_virtual_machine

If this issue appears to affect multiple resources, it may be an issue with
Terraform's core, so please mention this.

Terraform Configuration Files

Works with any config. Nothing specific.

Debug Output

vsphere_virtual_machine.vm: virtual machine must be powered off to be used as a source for cloning. code is here:
https://github.com/terraform-providers/terraform-provider-vsphere/blob/master/vsphere/internal/vmworkflow/virtual_machine_clone_subresource.go#L73

Expected Behavior

It should allow end users to clone a VM even if it is running.

The PowerCLI cmdlet New-VM allows us to have VMs/Templates that are powered on when we create clones.

For example, if we want to clone an existing production environment, where we cannot power off the VMs before cloning, is it expected that terraform should support that?

From Vsphere Client, actually when you right click any running VM, and choose Clone -> Clone to virtual machine, it can work pretty well. We know the best practice is always NOT cloning a running vm to avoid edge cases, but at least terraform should provide the possibility to ask end users to decide

Actual Behavior

What actually happened?

Steps to Reproduce

It does not allow you to create a clone

References

https://github.com/terraform-providers/terraform-provider-vsphere/blob/master/vsphere/internal/vmworkflow/virtual_machine_clone_subresource.go#L73

@chuanran
Copy link
Author

@bill-rich could you please help evaluate above? thanks a lot.

@chuanran
Copy link
Author

chuanran commented May 5, 2019

@bill-rich any thoughts? thanks

@bill-rich bill-rich added the enhancement Type: Enhancement label May 13, 2019
@bill-rich
Copy link
Contributor

Hi @chuanran,

I looked into this and I don't see an issue with allowing the cloning of running VMs. I'm not certain on the time frame to get this enhancement added, but I'll get it on the backlog.

@chuanran
Copy link
Author

Hi @bill-rich thanks for response. To allow cloning running vms is very easy, just comment out the following 3 lines code, and I already tested it and it works pretty good without any issues.
https://github.com/terraform-providers/terraform-provider-vsphere/blob/master/vsphere/internal/vmworkflow/virtual_machine_clone_subresource.go#L72-L74

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Type: Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants