...
Source Virtual Machine
A source virtual machine can be either a powered on or off virtual machine. However, the power state is relevant in terms of deployment time. This is because when cloning a running virtual machine, first it creates a snapshot and then starts copying the data. Even though the memory data is not kept, it takes time to generate the snapshot. For this example, we will be using a powered on virtual machine with Ubuntu installed.
...
Code Block |
---|
language | bash |
---|
linenumbers | false |
---|
|
Usage: vss-cli compute vm mk from-clone [OPTIONS] [NAME]
Clone virtual machine from running or powered off vm.
If name argument is not specified, -clone suffix will be added to
resulting virtual machine.
Options:
-s, --source TEXT Source virtual machine or template MOREF or
UUID. [required]
-d, --description TEXT A brief description. [required]
-b, --client TEXT Client department.
-a, --admin TEXT Admin name, phone number and email separated
by `:` i.e. "John
Doe:416-123-1234:john.doe@utoronto.ca"
-r, --inform TEXT Informational contact emails in comma
separated
-u, --usage [Test|Prod|Dev|QA] Vm usage.
-o, --os TEXT Guest operating system id.
-m, --memory INTEGER Memory in GB.
-c, --cpu INTEGER Cpu count.
--cores-per-socket INTEGER Cores per socket.
-f, --folder TEXT Logical folder moref name or path.
--scsi TEXT SCSI Controller Spec <type>=<sharing>.
-i, --disk TEXT Disk spec
<capacity>=<backing_mode>=<backing_sharing>.
optional: backing_mode, backing_sharing
-n, --net TEXT Network adapter <moref-or-name>=<nic-type>.
-t, --domain TEXT Target fault domain name or moref.
--notes TEXT Custom notes.
-p, --custom-spec TEXT Guest OS custom specification in JSON
format.
-e, --extra-config TEXT Extra configuration key=value format.
--power-on Power on after successful deployment.
--template Mark the VM as template after deployment.
--vss-service TEXT VSS Service related to VM
--instances INTEGER Number of instances to deploy [default: 1]
-w, --firmware TEXT Firmware type.
--tpm Add Trusted Platform Module device.
--storage-type TEXT Storage type.
--snapshot TEXT Snapshot to clone.
--retire-type [timedelta|datetime]
Retirement request type.
--retire-warning INTEGER Days before retirement date to notify
--retire-value TEXT Value for given retirement type. i.e.
<hours>,<days>,<months>
--help Show this message and exit. |
Anchor |
---|
| DeployandreconfigureInstancefromClone-Network |
---|
| DeployandreconfigureInstancefromClone-Network |
---|
|
NetworkRun vss-cli compute net ls
to list available network segments to your account. You must have at least VL-1584-VSS-PUBLIC
which is our public network.
...
Code Block |
---|
language | bash |
---|
linenumbers | false |
---|
|
export NET=dvportgroup-11052=e1000e |
Anchor |
---|
| DeployandreconfigureInstancefromClone-Folder |
---|
| DeployandreconfigureInstancefromClone-Folder |
---|
|
FolderLogical folders can be listed by running vss-cli compute folder ls
. Select the target moref
folder to store the virtual machine on:
...
The vss-cli compute vm mk from-clone
command provides the option -p/--custom-spec
to pass the guest os customization spec, which is structured as follows:
Code Block |
---|
language | pythonjson |
---|
linenumbers | false |
---|
|
{
"hostname": "string",
"domain": "string",
"dns": [
"string"
],
"dns_suffix": [
"string"
],
"interfaces": [{"dhcp": "bool",
"ip": "string",
"mask": "string",
"gateway": ["string"]
}]
} |
Since we are running on a DHCP-enabled network, we will just update the hostname and domain. The customization spec added will be:
Code Block |
---|
language | pythonjson |
---|
linenumbers | false |
---|
|
{
"hostname": "fe1",
"domain": "eis.utoronto.ca",
"interfaces": [{"dhcp": true}]
} |
...
Info |
---|
Passing above JSON data structure to --custom-spec in Linux, macOS, or Unix and Windows PowerShell use the single quote ' to enclose it. On the Windows command prompt, use the double quote " to enclose the data structure and escape the double quotes from the data structure using the backslash \ . |
Anchor |
---|
| DeployandreconfigureInstancefromClone-Deployment |
---|
| DeployandreconfigureInstancefromClone-Deployment |
---|
|
DeploymentAt this point, we have all requirements to run vss-cli compute vm mk from-clone
command to submit a deployment request. For this example, the request is made for 2GB of memory, 2 vCPU, 2x40GB disks and to reconfigure the hostname and domain.
...