Class: OvirtSDK4::AttachedStorageDomainService

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) activate(opts = {})

Executes the activate method.



3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
# File 'lib/ovirtsdk4/services.rb', line 3296

def activate(opts = {})
  action = Action.new(opts)
  writer = XmlWriter.new(nil, true)
  ActionWriter.write_one(action, writer)
  body = writer.string
  writer.close
  request = Request.new({
  :method => :POST,
  :path => "#{@path}/activate",
  :body => body,
  })
  response = @connection.send(request)
  case response.code
  when 200
    action = check_action(response)
  else
    check_fault(response)
  end
end

- (Object) deactivate(opts = {})

Executes the deactivate method.



3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
# File 'lib/ovirtsdk4/services.rb', line 3319

def deactivate(opts = {})
  action = Action.new(opts)
  writer = XmlWriter.new(nil, true)
  ActionWriter.write_one(action, writer)
  body = writer.string
  writer.close
  request = Request.new({
  :method => :POST,
  :path => "#{@path}/deactivate",
  :body => body,
  })
  response = @connection.send(request)
  case response.code
  when 200
    action = check_action(response)
  else
    check_fault(response)
  end
end

- (DisksService) disks_service

Locates the disks service.

Returns:



3388
3389
3390
# File 'lib/ovirtsdk4/services.rb', line 3388

def disks_service
  return DisksService.new(@connection, "#{@path}/disks")
end

- (StorageDomain) get(opts = {})

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Returns:



3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
# File 'lib/ovirtsdk4/services.rb', line 3346

def get(opts = {})
  query = {}
  request = Request.new(:method => :GET, :path => @path, :query => query)
  response = @connection.send(request)
  case response.code
  when 200
    begin
      reader = XmlReader.new(response.body)
      return StorageDomainReader.read_one(reader)
    ensure
      reader.close
    end
  else
    check_fault(response)
  end
end

- (Object) remove(opts = {})

Deletes the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.



3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
# File 'lib/ovirtsdk4/services.rb', line 3370

def remove(opts = {})
  query = {}
  value = opts[:async]
  unless value.nil?
    value = Writer.render_boolean(value)
    query['async'] = value
  end
  request = Request.new(:method => :DELETE, :path => @path, :query => query)
  response = @connection.send(request)
  unless response.code == 200
    check_fault(response)
  end
end

- (Service) service(path)

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.

Raises:

  • (Error)


3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
# File 'lib/ovirtsdk4/services.rb', line 3399

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

- (String) to_s

Returns an string representation of this service.

Returns:

  • (String)


3417
3418
3419
# File 'lib/ovirtsdk4/services.rb', line 3417

def to_s
  return "#<#{AttachedStorageDomainService}:#{@path}>"
end