Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

In SmartOS, virtual machines are created using the "create-machine" tool. This tool takes a JSON payload and creates either a 'kvm' or 'joyent' brand zone with the properties specified in the input JSON. Normal output is a series of single-line JSON objects with type set to one of:

success, failure, update, notice

each object having at least the 'type' and 'message' fields. A message of type 'success' or 'failure' will be followed by the process exiting with the exit status 0 indicating success and all other exits indicating failure.

Getting Started

You will need

The Machine JSON Description

Save the code snippet below to a file called "vmspec.json". You can make changes to the networks and other variables as appropriate. This is by no means an exhaustive list of all options. For all options see the create-machine tool. (Sizes are listed in MiB)

Note: the default_gateway in the root must match the gateway in the nic for the gateway_ip option to get passed on to qemu for it's dhcp magic.

Create the Empty Virtual Machine

Create the empty virtual machine using the create-machine tool. Please note that the virtual machine will not be running.

Note the UUID in the last step. This UUID is the ID of the VM and will be used to reference it for the rest of its lifecycle.

Copy your OS ISO to the zone

Boot the VM from the ISO Image

vmadm is the virtual machine administration tool. It is used to manage the lifecycle of a virtual machine after it already exists. We will boot the virtual machine we have just created, but tell it to boot off of the ISO image the first time it comes up.

Please note that the path for the ISO image will be the relative path of the ISO to the zone you are in. This is why it starts with the '/'

Use VNC to Connect to the VM

The vmadm tool can print out the information on the VM. You can also append a section to print specificially.

$ vmadm info b8ab5fc1-8576-45ef-bb51-9826b52a4651 vnc

Your VM is now running. You can shutdown your virtual machine and it will still remain on disk. To learn more about managing the lifecycle of a virtual machine, run 'vmadm --help'

Further Reading

Those versed in JavaScript can learn a lot more by reading the machine-create.js source.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.