Method: OvirtSDK4::VmsService#add_from_scratch
- Defined in:
- lib/ovirtsdk4/services.rb
#add_from_scratch(vm, opts = {}) ⇒ Vm
add a virtual machine to the system from scratch
Parameters:
-
vm
(Vm)
—
The
vm
to add. -
opts
(Hash)
(defaults to: {})
—
Additional options.
Options Hash (opts):
-
:clone
(Boolean)
—
Specifies if the virtual machine should be independent of the template.
When a virtual machine is created from a template by default the disks of the virtual machine depend on the disks of the template, they are using the copy on write mechanism so that only the differences from the template take up real storage space. If this parameter is specified and the value is
true
then the disks of the created virtual machine will be cloned, and independent of the template. For example, to create an independent virtual machine, send a request like this:POST /ovirt-engine/vms?clone=true
With a request body like this:
<vm> <name>myvm<name> <template> <name>mytemplate<name> </template> <cluster> <name>mycluster<name> </cluster> </vm>
NoteWhen this parameter is true
the permissions of the template will also be copied, as when usingclone_permissions=true
. -
:clone_permissions
(Boolean)
—
Specifies if the permissions of the template should be copied to the virtual machine.
If this optional parameter is provided, and its values is
true
then the permissions of the template (only the direct ones, not the inherited ones) will be copied to the created virtual machine. For example, to create a virtual machine from themytemplate
template copying its permissions, send a request like this:POST /ovirt-engine/api/vms?clone_permissions=true
With a request body like this:
<vm> <name>myvm<name> <template> <name>mytemplate<name> </template> <cluster> <name>mycluster<name> </cluster> </vm>
-
:filter
(Boolean)
—
Relevant for admin users only. Indicates whether to assign UserVmManager role on the created Virtual Machine for this user. This will enable the user to later access the Virtual Machine as though he were a non-admin user, foregoing his admin permissions (by providing filter=true).
Noteadmin-as-user (meaning providing filter=true) POST requests on an existing Virtual Machine will fail unless the Virtual Machine has been previously created by the admin as a user (meaning with filter=true). -
:seal
(Boolean)
—
Specifies if the virtual machine should be sealed after creation.
If this optional parameter is provided, and its value is
true
, the virtual machine will be sealed after creation. If the value is 'false', the virtual machine will not be sealed. If the parameter is not provided, the virtual machine will be sealed, only if it is created from a sealed template and its guest OS is not set to Windows.For example, to create a virtual machine from the
mytemplate
template and to seal it, send a request like this:POST /ovirt-engine/api/vms?seal=true
With a request body like this:
<vm> <name>myvm<name> <template> <name>mytemplate<name> </template> <cluster> <name>mycluster<name> </cluster> </vm>
-
:headers
(Hash)
— default:
{}
—
Additional HTTP headers.
-
:query
(Hash)
— default:
{}
—
Additional URL query parameters.
-
:timeout
(Integer)
— default:
nil
—
The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.
-
:wait
(Boolean)
— default:
true
—
If
true
wait for the response.
Returns:
- (Vm)
36160 36161 36162 |
# File 'lib/ovirtsdk4/services.rb', line 36160 def add_from_scratch(vm, opts = {}) internal_add(vm, Vm, ADD_FROM_SCRATCH, opts) end |