packer-builder-vsphere icon indicating copy to clipboard operation
packer-builder-vsphere copied to clipboard

Is it possible to storage vMotion a VM after creation?

Open akshunj opened this issue 6 years ago • 8 comments

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!

akshunj avatar Apr 25 '18 15:04 akshunj

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

I welcome a PR for this.

mkuzmin avatar May 03 '18 03:05 mkuzmin

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.

ghost avatar May 04 '18 08:05 ghost

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.

mkuzmin avatar May 04 '18 11:05 mkuzmin

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.

akshunj avatar May 04 '18 12:05 akshunj

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.

ghost avatar May 04 '18 12:05 ghost

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

akshunj avatar May 04 '18 12:05 akshunj

Good point. Copying and moving are two separate features

mkuzmin avatar May 04 '18 12:05 mkuzmin

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

HeroCC avatar Jun 19 '20 20:06 HeroCC