Class: OvirtSDK4::VmGraphicsConsolesService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#add(console, opts = {}) ⇒ GraphicsConsole

Add new graphics console to the virtual machine.

For example, to add a new graphics console to the virtual machine 123 send a request as follows:

POST /ovirt-engine/api/vms/123/graphicsconsoles HTTP/1.1

With a request body as follows:

<graphics_console> <protocol>type</protocol> </graphics_console>

Where type can be spice or vnc.

Important
Currently there is no check if the protocol is supported by the operating system the engine is running on.

Parameters:

  • console (GraphicsConsole)

    The console to add.

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :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:



33082
33083
33084
# File 'lib/ovirtsdk4/services.rb', line 33082

def add(console, opts = {})
  internal_add(console, GraphicsConsole, ADD, opts)
end

#console_service(id) ⇒ VmGraphicsConsoleService

Returns a reference to the service that manages a specific virtual machine graphics console.

Parameters:

  • id (String)

    The identifier of the console.

Returns:



33150
33151
33152
# File 'lib/ovirtsdk4/services.rb', line 33150

def console_service(id)
  VmGraphicsConsoleService.new(self, id)
end

#list(opts = {}) ⇒ Array<GraphicsConsole>

Lists all the configured graphics consoles of the virtual machine.

Important
By default, when the current parameter is not specified, the data returned corresponds to the next execution of the virtual machine. In the current implementation of the system this means that the address and port attributes will not be populated because the system does not know what address and port will be used for the next execution. Since in most cases those attributes are needed, it is strongly advised to aways explicitly include the current parameter with the value true.

The order of the returned list of graphics consoles is not guaranteed.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :current (Boolean)

    Specifies if the data returned should correspond to the next execution of the virtual machine, or to the current execution.

    Important
    The address and port attributes will not be populated unless the value is true.

    For example, to get data for the current execution of the virtual machine, including the address and port attributes, send a request like this:

    GET /ovirt-engine/api/vms/123/graphicsconsoles?current=true HTTP/1.1

    The default value is false.

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :max (Integer)

    Sets the maximum number of consoles to return. If not specified all the consoles are returned.

  • :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:



33139
33140
33141
# File 'lib/ovirtsdk4/services.rb', line 33139

def list(opts = {})
  internal_get(LIST, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.



33161
33162
33163
33164
33165
33166
33167
33168
33169
33170
# File 'lib/ovirtsdk4/services.rb', line 33161

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return console_service(path)
  end
  return console_service(path[0..(index - 1)]).service(path[(index + 1)..-1])
end