Chapter 8 Creating a Virtual Machine
This section gives you the syntax and examples to use to create a virtual machine from a number of sources.
8.1 Creating a virtual machine from a virtual appliance
-
When you import a virtual appliance, each virtual machine in the virtual appliance file is unpacked and stored as an VirtualApplianceVm object. The VirtualApplianceVm object is then used to create a virtual machine, not the virtual appliance itself. Use the show VirtualAppliance command to find the name or ID of the new VirtualApplianceVm objects in a virtual appliance.
OVM>
show VirtualAppliance name=myappliance.ova
Origin = http://example.com/myappliance.ova Repository =ID
[Name
] Virtual Appliance Vm 1 =ID
[Name
] Assembly VirtualDisk 1 =ID
[Name
] Id =ID
[Name
] Name = myappliance.ova Description = Import URL: http://example.com/myappliance.ova Locked = false -
Create a virtual machine from a VirtualApplianceVm object using the syntax:
createVmFromVirtualApplianceVm
VirtualApplianceVm
instance
Make sure you use the name of the VirtualApplianceVm object created when you imported the virtual appliance, not the name of the VirtualAppliance object.
For example:
OVM> createVmFromVirtualApplianceVm VirtualApplianceVm name=MyVm
For more information on the syntax and usage, see Section A.33, “createVmFromVirtualApplianceVm” .
-
The previous step creates a virtual machine with the name
virtualappliance_name
_vm_name
, for example:myappliance.ova_myvm
8.2 Creating a virtual machine from a template
Clone a virtual machine from a template, using the syntax:
clone Vm
instance
destType=
{
Vm
|
VmTemplate
}
[
destName=
]
value
serverPool=
[
value
cloneCustomizer=
] [
value
targetRepository=
]value
For example:
OVM> clone Vm name=MyVMTemplate.tgz destType=Vm destName=MyNewVM serverPool=MyServerPool
For more information on the syntax and usage, see Section A.24, “clone Vm” .
8.3 Creating a virtual machine from an ISO
-
Create a virtual machine using the syntax:
create Vm
[memory=
] [value
memoryLimit=
] [value
cpuCount=
] [value
cpuCountLimit=
] [value
cpuPriority=
] [value
cpuUtilizationCap=
] [value
highAvailability=
{Yes
|No
} ] [hugePagesEnabled=
{Yes
|No
} ] [osType=
] [value
restartActionOnCrash=
{RESTART
|STOP
|RESTART_AFTER_DUMP
|STOP_AFTER_DUMP
} ] [mouseType=
{OS_DEFAULT
|PS2_MOUSE
|USB_MOUSE
|USB_TABLET
} ]domainType=
{XEN_HVM
|XEN_HVM_PV_DRIVERS
|XEN_PVM
|LDOMS_PVM
|UNKNOWN
} [keymapName=
{en-us
|ar
|da
|de
|de-ch
|en-gb
|es
|et
|fi
|fo
|fr
|fr-be
|fr-ca
|fr-ch
|hr
|hu
|is
|it
|ja
|lt
|lv
|mk
|nl
|nl-be
|No
|pl
|pt
|pt-br
|ru
|sl
|sv
|th
|tr
} ] [bootOrder=
{PXE
|DISK
|CDROM
} ] [networkInstallPath=
]value
repository=
[value
server=
] [value
startPolicy=
{BEST_SERVER
|BALANCE_SERVER
|CURRENT_SERVER
|USE_POOL_POLICY
} ] [viridian=
{Yes
|No
} ]name=
[value
description=
]value
on
ServerPool
instance
For example:
OVM> create Vm name=MyVM repository=MyRepository domainType=XEN_HVM \ server=MyServer startPolicy=USE_POOL_POLICY on ServerPool name=MyServerPool
For more information on the syntax and usage, see Section A.53, “create Vm” .
-
Create a virtual disk to use as the boot disk using the syntax:
create VirtualDisk
size=
value
shareable=
{Yes
|No
}sparse=
{Yes
|No
}name=
[value
description=
]value
on Repository
instance
For example:
OVM> create VirtualDisk name=MyVMDisk size=10 sparse=Yes shareable=No on Repository \ name=MyRepository
For more information on the syntax and usage, see Section A.51, “create VirtualDisk” .
-
Map the virtual disk to the virtual machine using the syntax:
create VmDiskMapping
slot=
{value
physicalDisk=
|value
virtualDisk=
|value
virtualCd=
{
|value
EMPTY_CDROM
} }name=
[value
description=
]value
on Vm
instance
For example:
OVM> create VmDiskMapping slot=0 virtualDisk=MyVMDisk name="Boot Disk" on Vm name=MyVM
For more information on the syntax and usage, see Section A.57, “create VmDiskMapping” .
-
Map an ISO file to the virtual machine using the syntax:
create VmDiskMapping
slot=
{value
physicalDisk=
|value
virtualDisk=
|value
virtualCd=
{
|value
EMPTY_CDROM
} }name=
[value
description=
]value
on Vm
instance
For example:
OVM> create VmDiskMapping slot=1 virtualCd=OracleLinux-dvd.iso \ name="CDROM Drive" on Vm name=MyVM
For more information on the syntax and usage, see Section A.57, “create VmDiskMapping”.
-
Set up the disk boot order as the CDROM (ISO file) as the first disk, then the virtual disk as the secondary disk, using the syntax:
edit Vm
[instance
memory=
] [value
memoryLimit=
] [value
cpuCount=
] [value
cpuCountLimit=
] [value
cpuPriority=
] [value
cpuUtilizationCap=
] [value
highAvailability=
{Yes
|No
} ] [hugePagesEnabled=
{Yes
|No
} ] [osType=
] [value
restartActionOnCrash=
{RESTART
|STOP
|RESTART_AFTER_DUMP
|STOP_AFTER_DUMP
} ] [mouseType=
{OS_DEFAULT
|PS2_MOUSE
|USB_MOUSE
|USB_TABLET
} ] [domainType=
{XEN_HVM
|XEN_HVM_PV_DRIVERS
|XEN_PVM
|LDOMS_PVM
|UNKNOWN
} ] [keymapName=
{en-us
|ar
|da
|de
|de-ch
|en-gb
|es
|et
|fi
|fo
|fr
|fr-be
|fr-ca
|fr-ch
|hr
|hu
|is
|it
|ja
|lt
|lv
|mk
|nl
|nl-be
|No
|pl
|pt
|pt-br
|ru
|sl
|sv
|th
|tr
} ] [bootOrder=
{PXE
|DISK
|CDROM
} ] [networkInstallpath=
] [value
startPolicy=
{BEST_SERVER
|BALANCE_SERVER
|CURRENT_SERVER
|USE_POOL_POLICY
} ] [viridian=
{Yes
|No
} ] [name=
] [value
description=
]value
For example:
OVM> edit Vm name=MyVM bootOrder='CDROM,DISK' startPolicy=BEST_SERVER
For more information on the syntax and usage, see Section A.95, “edit Vm”.
-
Create a VNIC and add it to the virtual machine using the syntax:
create Vnic
network=
value
name=
[value
macAddress=
] [value
description=
]value
on Vm
instance
For example:
OVM> create Vnic name=MyVNIC network=MyVMNetwork on Vm name=MyVM
For more information on the syntax and usage, see Section A.58, “create Vnic”.
8.4 Starting a virtual machine
Start the virtual machine, using the syntax:
start
{
Server
|
Vm
}
instance
For example:
OVM> start Vm name=MyVM
For more information on the syntax and usage, see Section A.177, “start” .