Class: Fog::Compute::XenServer::StorageRepository
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::XenServer::StorageRepository
- Defined in:
- lib/fog/xenserver/models/compute/storage_repository.rb
Instance Method Summary collapse
- #destroy ⇒ Object
- #pbds ⇒ Object
- #save ⇒ Object
- #scan ⇒ Object
- #set_attribute(name, *val) ⇒ Object
- #vdis ⇒ Object
Instance Method Details
#destroy ⇒ Object
45 46 47 |
# File 'lib/fog/xenserver/models/compute/storage_repository.rb', line 45 def destroy service.destroy_sr reference end |
#pbds ⇒ Object
36 37 38 |
# File 'lib/fog/xenserver/models/compute/storage_repository.rb', line 36 def pbds __pbds.map { |pbd| service.pbds.get pbd } end |
#save ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/fog/xenserver/models/compute/storage_repository.rb', line 49 def save requires :name requires :type # host is not a model attribute (not in XAPI at least), # but we need it here host = attributes[:host] raise ArgumentError.new('host is required for this operation') unless host # Not sure if this is always required, so not raising exception if nil device_config = attributes[:device_config] # create_sr request provides sane defaults if some attributes are # missing attr = service.get_record( service.create_sr( host.reference, name, type, description || '', device_config || {}, physical_size || '0', content_type || 'user', shared || false, sm_config || {}), 'SR' ) merge_attributes attr true end |
#scan ⇒ Object
40 41 42 43 |
# File 'lib/fog/xenserver/models/compute/storage_repository.rb', line 40 def scan service.scan_sr reference reload end |
#set_attribute(name, *val) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/fog/xenserver/models/compute/storage_repository.rb', line 80 def set_attribute(name, *val) data = service.set_attribute( 'SR', reference, name, *val ) # Do not reload automatically for performance reasons # We can set multiple attributes at the same time and # then reload manually #reload end |
#vdis ⇒ Object
32 33 34 |
# File 'lib/fog/xenserver/models/compute/storage_repository.rb', line 32 def vdis __vdis.map { |vdi| service.vdis.get vdi } end |