Class: OvirtSDK4::StorageDomainService
- Inherits:
-
Service
- Object
- Service
- OvirtSDK4::StorageDomainService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary (collapse)
-
- (AssignedDiskProfilesService) disk_profiles_service
Locates the
disk_profiles
service. -
- (DiskSnapshotsService) disk_snapshots_service
Locates the
disk_snapshots
service. -
- (DisksService) disks_service
Locates the
disks
service. -
- (FilesService) files_service
Locates the
files
service. -
- (StorageDomain) get(opts = {})
Returns the representation of the object managed by this service.
-
- (ImagesService) images_service
Locates the
images
service. -
- (Object) is_attached(opts = {})
Executes the
is_attached
method. -
- (AssignedPermissionsService) permissions_service
Locates the
permissions
service. -
- (Object) refresh_luns(opts = {})
Executes the
refresh_luns
method. -
- (Object) remove(opts = {})
Removes the storage domain.
-
- (Service) service(path)
Locates the service corresponding to the given path.
-
- (StorageDomainServerConnectionsService) storage_connections_service
Locates the
storage_connections
service. -
- (StorageDomainTemplatesService) templates_service
Locates the
templates
service. -
- (String) to_s
Returns an string representation of this service.
-
- (Object) update(storage_domain)
Updates the object managed by this service.
-
- (Object) update_ovf_store(opts = {})
This operation forces the update of the
OVF_STORE
of this storage domain. -
- (StorageDomainVmsService) vms_service
Locates the
vms
service.
Instance Method Details
- (AssignedDiskProfilesService) disk_profiles_service
Locates the disk_profiles
service.
18905 18906 18907 |
# File 'lib/ovirtsdk4/services.rb', line 18905 def disk_profiles_service return AssignedDiskProfilesService.new(@connection, "#{@path}/diskprofiles") end |
- (DiskSnapshotsService) disk_snapshots_service
Locates the disk_snapshots
service.
18913 18914 18915 |
# File 'lib/ovirtsdk4/services.rb', line 18913 def disk_snapshots_service return DiskSnapshotsService.new(@connection, "#{@path}/disksnapshots") end |
- (DisksService) disks_service
Locates the disks
service.
18921 18922 18923 |
# File 'lib/ovirtsdk4/services.rb', line 18921 def disks_service return DisksService.new(@connection, "#{@path}/disks") end |
- (FilesService) files_service
Locates the files
service.
18929 18930 18931 |
# File 'lib/ovirtsdk4/services.rb', line 18929 def files_service return FilesService.new(@connection, "#{@path}/files") end |
- (StorageDomain) get(opts = {})
Returns the representation of the object managed by this service.
18699 18700 18701 18702 18703 18704 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 |
# File 'lib/ovirtsdk4/services.rb', line 18699 def get(opts = {}) query = {} value = opts[:filter] unless value.nil? value = Writer.render_boolean(value) query['filter'] = value end 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 |
- (ImagesService) images_service
Locates the images
service.
18937 18938 18939 |
# File 'lib/ovirtsdk4/services.rb', line 18937 def images_service return ImagesService.new(@connection, "#{@path}/images") end |
- (Object) is_attached(opts = {})
Executes the is_attached
method.
18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 |
# File 'lib/ovirtsdk4/services.rb', line 18724 def is_attached(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}/isattached", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) return action.is_attached else check_fault(response) end end |
- (AssignedPermissionsService) permissions_service
Locates the permissions
service.
18945 18946 18947 |
# File 'lib/ovirtsdk4/services.rb', line 18945 def return AssignedPermissionsService.new(@connection, "#{@path}/permissions") end |
- (Object) refresh_luns(opts = {})
Executes the refresh_luns
method.
18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 |
# File 'lib/ovirtsdk4/services.rb', line 18748 def refresh_luns(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}/refreshluns", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (Object) remove(opts = {})
Removes the storage domain.
Without any special parameters, the storage domain is detached from the system and removed fro the database. The storage domain can then be imported to the same or different setup, with all the data on it. If the storage isn’t accessible the operation will fail.
If the destroy
parameter is true
then the operation will always succeed, even if the storage isn’t
accessible, the failure is just ignored and the storage domain is removed from the database anyway.
If the format
parameter is true
then the actual storage is formatted, and the metadata is removed from the
LUN or directory, so it can no longer be imported to the same or a different setup.
18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 |
# File 'lib/ovirtsdk4/services.rb', line 18805 def remove(opts = {}) query = {} value = opts[:async] unless value.nil? value = Writer.render_boolean(value) query['async'] = value end value = opts[:destroy] unless value.nil? value = Writer.render_boolean(value) query['destroy'] = value end value = opts[:format] unless value.nil? value = Writer.render_boolean(value) query['format'] = value end value = opts[:host] unless value.nil? query['host'] = 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.
18980 18981 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 19011 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 |
# File 'lib/ovirtsdk4/services.rb', line 18980 def service(path) if path.nil? || path == '' return self end if path == 'diskprofiles' return disk_profiles_service end if path.start_with?('diskprofiles/') return disk_profiles_service.service(path[13..-1]) end if path == 'disksnapshots' return disk_snapshots_service end if path.start_with?('disksnapshots/') return disk_snapshots_service.service(path[14..-1]) end if path == 'disks' return disks_service end if path.start_with?('disks/') return disks_service.service(path[6..-1]) end if path == 'files' return files_service end if path.start_with?('files/') return files_service.service(path[6..-1]) end if path == 'images' return images_service end if path.start_with?('images/') return images_service.service(path[7..-1]) end if path == 'permissions' return end if path.start_with?('permissions/') return .service(path[12..-1]) end if path == 'storageconnections' return storage_connections_service end if path.start_with?('storageconnections/') return storage_connections_service.service(path[19..-1]) end if path == 'templates' return templates_service end if path.start_with?('templates/') return templates_service.service(path[10..-1]) end if path == 'vms' return vms_service end if path.start_with?('vms/') return vms_service.service(path[4..-1]) end raise Error.new("The path \"#{path}\" doesn't correspond to any service") end |
- (StorageDomainServerConnectionsService) storage_connections_service
Locates the storage_connections
service.
18953 18954 18955 |
# File 'lib/ovirtsdk4/services.rb', line 18953 def storage_connections_service return StorageDomainServerConnectionsService.new(@connection, "#{@path}/storageconnections") end |
- (StorageDomainTemplatesService) templates_service
Locates the templates
service.
18961 18962 18963 |
# File 'lib/ovirtsdk4/services.rb', line 18961 def templates_service return StorageDomainTemplatesService.new(@connection, "#{@path}/templates") end |
- (String) to_s
Returns an string representation of this service.
19046 19047 19048 |
# File 'lib/ovirtsdk4/services.rb', line 19046 def to_s return "#<#{StorageDomainService}:#{@path}>" end |
- (Object) update(storage_domain)
Updates the object managed by this service.
18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 18860 18861 |
# File 'lib/ovirtsdk4/services.rb', line 18836 def update(storage_domain) if storage_domain.is_a?(Hash) storage_domain = OvirtSDK4::StorageDomain.new(storage_domain) end request = Request.new(:method => :PUT, :path => @path) begin writer = XmlWriter.new(nil, true) StorageDomainWriter.write_one(storage_domain, writer, 'storage_domain') request.body = writer.string ensure writer.close end response = @connection.send(request) case response.code when 200 begin reader = XmlReader.new(response.body) return StorageDomainReader.read_one(reader) ensure reader.close end return result else check_fault(response) end end |
- (Object) update_ovf_store(opts = {})
This operation forces the update of the OVF_STORE
of this storage domain.
The OVF_STORE
is a disk image that contains the meta-data
of virtual machines and disks that reside in the
storage domain. This meta-data is used in case the
domain is imported or exported to or from a different
data center or a different installation.
By default the OVF_STORE
is updated periodically
(set by default to 60 minutes) but users might want to force an
update after an important change, or when the they believe the
OVF_STORE
is corrupt.
When initiated by the user, OVF_STORE
update will be performed whether
an update is needed or not.
18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 |
# File 'lib/ovirtsdk4/services.rb', line 18881 def update_ovf_store(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}/updateovfstore", :body => body, }) response = @connection.send(request) case response.code when 200 action = check_action(response) else check_fault(response) end end |
- (StorageDomainVmsService) vms_service
Locates the vms
service.
18969 18970 18971 |
# File 'lib/ovirtsdk4/services.rb', line 18969 def vms_service return StorageDomainVmsService.new(@connection, "#{@path}/vms") end |