jetbrains-infra / packer-builder-vsphere

Packer plugin for remote builds on VMware vSphere
Mozilla Public License 2.0
541 stars 175 forks source link

Is it possible to storage vMotion a VM after creation? #90

Open akshunj opened 6 years ago

akshunj commented 6 years ago

Hello,

This is more of a question than an issue. I'm able to clone an existing VM and get my build together flawlessly (thanks, nice piece of software you guys built here). Part of my finalization is to zero out the disk and then punch zeroes to shrink/reclaim free space on the LUN. After zeroing the disk I need to storage vMotion the VM to a different datastore. Is there someway to do this using an existing builder? I'd like to get away from my power CLI scripts and just do it all through Jenkins and Packer.

Thanks!

mkuzmin commented 6 years ago

This sounds like ami_regions parameter - a kind of postprocessing action.

I welcome a PR for this.

ghost commented 6 years ago

So you're only looking to vMotion it to a different datastore and not a complete move to a new datastore and host? If you're looking to move instead of copying why not target the different datastore in the first place? Thought of something similar for my use case (copying the template to multiple datacenters [in order to reduce time of bootstrapping VMs, else it needs to copy the template across dc's via esx host's]) but in my case starting multiple packers in parallel should be sufficient.

mkuzmin commented 6 years ago

Parallel builds would work, and will be even faster, but they generate more traffic and workload on external repos, and don’t guarantee the resulted VMs are identical. I also have cases, where it becomes important.

Another reason mentioned above - data store space cleanup. Thin disks are downsized in time of moving between different datastores.

akshunj commented 6 years ago

Yes in this case we need to move it to a different datastore with a different block size in order to reclaim the free space from a thin-provisioned disk.

ghost commented 6 years ago

Understood, was wondering whether moving/relocating and not copying really was the intention (as is the case in ami_regions if I understand it right).

Since vMotion also supports moving to a new host in the same step, do you want to support this as well? Would probably make the user input a bit different or introduce another complementary param.

akshunj commented 6 years ago

I don't have a specific need to use a different host, but I can see where other VMware users might want the option.

mkuzmin commented 6 years ago

Good point. Copying and moving are two separate features

HeroCC commented 4 years ago

If jetbrains is now contributing to the main packer repo, could this ticket be moved over there?