I had many questions, especially on homemade VDI environment, on how to save space without using dedup and compression on the storage backend and how to create a quick clone on a VM.
There is a VMware API call we can use for this purpose which can also be used in a lab environment when you want to test your customization wizard or specific boot up scripts.
The name of this feature is called “linked clone”. Note that it is not the same technology as the “instant clone” way of cloning VMs. This post will cover how it works and how to use this.
This way of creating VMs can only be done through APIs. There is no way of doing this using the WebClient. This is the same way Horizon View creates the VMs in a dynamic pool. The clone is not based on the VM but on a snapshot of the VM. Yes, you understood well. This means you do not clone the full VMDK anymore, you just clone the snapshot, which uses only a few KBytes. This is why this is so fast, and this is why it consumes so few space.
Continue reading “Use linked clone instead of full clone to create VMs”
This post will show you how to deploy a VM fully operational in a few seconds in a vSphere environment. You must have a working template to use this script.
You will have to install VMware Tools on this template, or OVT (OpenVMwareTools). They are now fully supported by VMware. I would recommand to use them, just for an ease of use during your weekly vulnerability review 😉 Ideed during your OS upgrade, the OVT package will also be updated. More details on VMware knowledge base. (kb.vmware.com/kb/2073803)
You need to install vSphere SDK for perl on your work station to be able to follow this post.
During the deployment you will not only clone the VM with all the template configuration, you will also configure IPs, gateway, hostname, DNS, Timezone and you will choose on which cluster, datastore and folder you will deploy your VM. We are going to use the VMware “Configuration Wizard” to deploy your VM.
You understood well, one of the biggest part of the job is not to write the script, you have to configure a working template. You need to have VMware Tools installed (OVT) or VMware Tools themselves. After the cloning operation, the VM will be powered on and the customization process will apply.
Continue reading “Deploy a Linux VM using Customization Wizard using Perl SDK”
Here is my first API post on this blog. I used to post some API scripts on OVH forums and I want to use this media to share more of them and show you how easy it is to run scripts on top on VMware infrastructure. I had a chance to present VMware Perl SDK and how it helps sysadmin on VMworld a couple of years ago.
First of all, I’m going to show you how to connect to a vSphere infrastructure and then how to list all your virtual machines. This is a quick introduction but I think it is required to understand how it works.
Thanks for reading and I hope it will be useful for your internal needs.
I run my scripts on top on a OVH Dedicated Cloud, which is basically a vSphere infrastructure. If you need anything about VMware APIs and SDKs, you can find everything here. One of the best argument on this Perl SDK is that it can run on Linux box. You can also find a python SDK, but it is less powerful than the perl one, there are a lot of call missing.
All my scripts will require one connection to a vCenter, so you need to have a login and a password with the rights you need to perform all the operations you want. For this particular use case, “read only” rights are sufficient.
Continue reading “Use VMware Perl SDK to manage a vSphere infrastructure”