Class: OvirtSDK4::JobService

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

#clear(opts = {}) ⇒ Object

Set an external job execution to be cleared by the system.

For example, to set a job with identifier 123 send the following request:

POST /ovirt-engine/api/jobs/clear

With the following request body:

<action/>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the action should be performed asynchronously.

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



13587
13588
13589
# File 'lib/ovirtsdk4/services.rb', line 13587

def clear(opts = {})
  internal_action(:clear, nil, CLEAR, opts)
end

#end_(opts = {}) ⇒ Object

Marks an external job execution as ended.

For example, to terminate a job with identifier 123 send the following request:

POST /ovirt-engine/api/jobs/end

With the following request body:

<action>
  <force>true</force>
  <status>finished</status>
</action>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the action should be performed asynchronously.

  • :force (Boolean)

    Indicates if the job should be forcibly terminated.

  • :succeeded (Boolean)

    Indicates if the job should be marked as successfully finished or as failed.

    This parameter is optional, and the default value is true.

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



13638
13639
13640
# File 'lib/ovirtsdk4/services.rb', line 13638

def end_(opts = {})
  internal_action(:end, nil, END_, opts)
end

#get(opts = {}) ⇒ Job

Retrieves a job.

GET /ovirt-engine/api/jobs/123

You will receive response in XML like this one:

<job href="/ovirt-engine/api/jobs/123" id="123">
  <actions>
    <link href="/ovirt-engine/api/jobs/123/clear" rel="clear"/>
    <link href="/ovirt-engine/api/jobs/123/end" rel="end"/>
  </actions>
  <description>Adding Disk</description>
  <link href="/ovirt-engine/api/jobs/123/steps" rel="steps"/>
  <auto_cleared>true</auto_cleared>
  <end_time>2016-12-12T23:07:29.758+02:00</end_time>
  <external>false</external>
  <last_updated>2016-12-12T23:07:29.758+02:00</last_updated>
  <start_time>2016-12-12T23:07:26.593+02:00</start_time>
  <status>failed</status>
  <owner href="/ovirt-engine/api/users/456" id="456"/>
</job>

Parameters:

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

    Additional options.

Options Hash (opts):

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

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



13693
13694
13695
# File 'lib/ovirtsdk4/services.rb', line 13693

def get(opts = {})
  internal_get(GET, 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.

Raises:



13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
# File 'lib/ovirtsdk4/services.rb', line 13715

def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'steps'
    return steps_service
  end
  if path.start_with?('steps/')
    return steps_service.service(path[6..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end

#steps_serviceStepsService

List all the steps of the job.

The order of the returned list of steps isn’t guaranteed.

Returns:



13704
13705
13706
# File 'lib/ovirtsdk4/services.rb', line 13704

def steps_service
  @steps_service ||= StepsService.new(self, 'steps')
end