Whether you are a brand new startup working on the next hot mobile app or an established Enterprise or Consumer brand company, development and testing of Apple iOS and/or MacOS is simply a reality in todays world. The vast majority of these customers accomplish this by running Apple MacOS on vSphere, either within their own on-premises datacenter or leveraging MacStadium, the largest MacOS Cloud hosting provider, who also runs their Mac infrastructure using VMware vSphere.
The ability to quickly build/test and deploy your application (Continuous Integration and Continuous Delivery) can mean the difference of having an edge over you competitor or being able to keep up with the demands of your business. Many customers have benefited from using vSphere platform and with technologies like Linked Clones, which allows you to quickly spin up a new VM without having to perform a complete full clone, it means you can build and test your application even faster.
In vSphere 6.7, we introduced a major enhancement to Instant Clone, which you can read more about here and here. One of the questions I have been seeing lately is whether Instant Clone can be applied to MacOS guests? The answer is absolutely! In fact, Matt Moriarity, who works for TravisCI, recently shared some tidbits on how to get a MacOS Mojave guests to see the updated MAC Address to ensure that there are no network conflicts when performing an Instant Clone.
The majority of the "hard" work to use Instant Clone is really from within the GuestOS and the customization script that needs to be developed. In fact, Instant Clone is pretty OS agnostics and you can even Instant Clone Microsoft Windows 98 and 2000, if you really wanted to 😀
With Matt's contributions of figuring out how to reload the MAC Address, I thought it would be useful to share a reference implementation on how to Instant Clone the latest MacOS Mojave (10.14) running on vSphere 6.7 Update 1. You can find both the OS customization script along with a PowerCLI driver script here. The script supports both DHCP and Static IP assignment of the Instant Clone. If you do not have a need to statically assign an address to your VMs, simply pass an empty guest customization spec for DHCP.
After you have created and updated your base MacOS Mojave VM, you will need to install the latest VMware Tools and then run the customize.sh shell script which will then prep the VM for Instant Cloning as shown in the screenshot below.
Next, you can either use my Instant Clone PowerCLI module or you can develop your own application against the vSphere API to create your MacOS Instant Clones. Here I am creating 5 Instant Clones and as you can see, it took about 40secs! Not only are they up and running, but they are completely ready to start executing instructions!
If we take a look at our vSphere H5 Client UI, we can see all 5 of our Instant Clones are on the network and ready to start doing some work!
One thing to be aware of if you are relying on VMware Tools to provide guest information such as IP Address, especially if you are using DHCP, the default polling period is 30seconds. This means that it can take up to 30secs after the Instant Clone before the networking information is reflected in the vSphere API.
You can change the default polling period by adding this to the VMware Tools configuration file, which for MacOS is under /Library/Application\ Support/VMware\ Tools/tools.conf (you need to create this file as it may not exists by default) and specify the number of seconds for the new polling interval.
[guestinfo]
poll-interval = XX
In general, it is not recommended to change this default value as this information is usually pretty static for most environments. In the Instant Clone use case, depending on how long it takes the networking information to be populated, you could update the base VM with a shorter polling interval and once the Instant Clone is up and running, as part of the post-clone operation you can simply remove the tools.conf and VMware Tools will automatically default back to the original polling interval without requiring a restart of VMware Tools or the GuestOS.
Tim says
Hey William,
This is a great post, I kept wondering about MacOS.
Question for you, during the Instant Cloning process can you target other hosts? What command (powercli) is there to target other host?
ex. Instant Clone
Host 1 -> vm1_temp | Datastore 1
Host 2 -> vm1_ic_1 | Datastore 1
Host 3 -> vm1_ic_2 | Datastore 2
Thank you