Class: RightScale::PlannedVolume

Inherits:
Object
  • Object
show all
Includes:
Serializable
Defined in:
lib/right_agent/core_payload_types/planned_volume.rb

Overview

Represents any details of a planned volume which are needed by the instance for volume management purposes. A planned volume is a blank, snapshotted or existing volume which is associated with a server at launch time. It could also represent a volume which is planned dynamically by the instance itself as part of a script and which is then guaranteed to be properly managed if the instance is stopped/started.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Serializable

included

Constructor Details

#initialize(*args) ⇒ PlannedVolume

Returns a new instance of PlannedVolume.



55
56
57
58
59
60
# File 'lib/right_agent/core_payload_types/planned_volume.rb', line 55

def initialize(*args)
  @volume_id     = args[0] if args.size > 0
  @device_name   = args[1] if args.size > 1
  @mount_points  = args[2] if args.size > 2
  @volume_status = args[3] if args.size > 3
end

Instance Attribute Details

#device_nameObject

(String) cloud-specific device name for volume (relative to instance)



46
47
48
# File 'lib/right_agent/core_payload_types/planned_volume.rb', line 46

def device_name
  @device_name
end

#mount_pointsObject

(Array of String) instance platform-specific mount point(s) for the physical or virtual disk (which could have multiple partitions) associated with the planned volume. not all partitions are formatted and/or have a file system which is compatible with the instance’s platform so only valid partitions are associated with mount points.



53
54
55
# File 'lib/right_agent/core_payload_types/planned_volume.rb', line 53

def mount_points
  @mount_points
end

#volume_idObject

(String) cloud-specific unique identifier for volume (relative to account or global)



38
39
40
# File 'lib/right_agent/core_payload_types/planned_volume.rb', line 38

def volume_id
  @volume_id
end

#volume_statusObject

(String) cloud-agnostic current known status of the volume. must be nil or else one of the following:

'pending', 'attached', 'attaching', 'detached', 'detaching', 'deleted'


43
44
45
# File 'lib/right_agent/core_payload_types/planned_volume.rb', line 43

def volume_status
  @volume_status
end

Instance Method Details

#is_valid?Boolean

Determines if this object is valid.

Return

result(Boolean)

true if this object is valid, false if required fields are nil or empty

Returns:

  • (Boolean)


71
72
73
74
75
76
77
78
# File 'lib/right_agent/core_payload_types/planned_volume.rb', line 71

def is_valid?
  result = false == is_blank?(@volume_id) &&
           false == is_blank?(@device_name) &&
           false == is_blank?(@volume_status) &&
           false == is_blank?(@mount_points) &&
           nil == @mount_points.find { |mount_point| is_blank?(mount_point) }
  return result
end

#serialized_membersObject

Array of serialized fields given to constructor



63
64
65
# File 'lib/right_agent/core_payload_types/planned_volume.rb', line 63

def serialized_members
  [ @volume_id, @device_name, @mount_points, @volume_status ]
end