class Aggregate

function definitions to interface with NetApp filers

Public Class Methods

add(aggr) click to toggle source
# File lib/netapp.rb, line 118
def self.add(aggr)
    # implement me!
    return false
end
create(aggr, diskcount, raidtype="raid_dp") click to toggle source
# File lib/netapp.rb, line 102
def self.create(aggr, diskcount, raidtype="raid_dp")
    aggr_create = @@filer.invoke("aggr-create", 
                                 "aggregate", aggr, 
                                 "disk-count", diskcount,
                                 "raid-type", raidtype)
    raise aggr_create.results_reason \
          if aggr_create.results_status == 'failed'
    return true
end
info(aggr, verbose=true) click to toggle source
# File lib/netapp.rb, line 154
def self.info(aggr, verbose=true)
    aggr_list_info = @@filer.invoke("aggr-list-info", 
                                    "aggregate", aggr,
                                    "verbose", verbose)
    raise aggr_list_info.results_reason \
          if aggr_list_info.results_status == 'failed'
    result = {}
    aggr_list_info.child_get("aggregates").children_get.each do |key|
        volumes = []
        key.child_get("volumes").children_get.each { |vol| 
            volumes << vol.child_get_string("name")
        }
        plexes = {}
        key.child_get("plexes").children_get.each { |plx| 
            plexes[name: plx.child_get_string("name")] = { 
                isonline:         plx.child_get_string("is-online"),
                isresyncing:      plx.child_get_string("is-resyncing"),
                resyncpercentage: plx.child_get_string("resyncing-percentage")
            }
        }
        result = {
            name:               key.child_get_string("name"),
            uuid:               key.child_get_string("uuid"),
            state:              key.child_get_string("state"),
            type:               key.child_get_string("type"),
            haslocalroot:       key.child_get_string("has-local-root"),
            haspartnerroot:     key.child_get_string("has-partner-root"),
            checksumstatus:     key.child_get_string("checksum-status"),
            isinconsistent:     key.child_get_string("is-inconsistent"),
            sizetotal:          key.child_get_string("size-total"),
            sizeused:           key.child_get_string("size-used"),
            sizeavail:          key.child_get_string("size-available"),
            sizepercentage:     key.child_get_string("size-percentage-used"),
            filestotal:         key.child_get_string("files-total"),
            filesused:          key.child_get_string("files-used"),
            isnaplock:          key.child_get_string("is-snaplock"),
            snaplocktype:       key.child_get_string("snaplock-type"),
            mirrorstatus:       key.child_get_string("mirror-status"),
            raidsize:           key.child_get_string("raid-size"),
            raidstatus:         key.child_get_string("raid-status"),
            diskcount:          key.child_get_string("disk-count"),
            volumecount:        key.child_get_string("volume-count"),
            volstripeddvcount:  key.child_get_string("volume-count-striped-dv"),
            volstripedmdvcount: key.child_get_string("volume-count-striped-mdv"),
            volumes:            volumes,
            plexcount:          key.child_get_string("plex-count"),
            plexes:             plexes
        }
    end
    return result
end
list() click to toggle source
# File lib/netapp.rb, line 144
def self.list
    aggr_list_info = @@filer.invoke("aggr-list-info")
    raise aggr_list_info.results_reason \
          if aggr_list_info.results_status == 'failed'
    result = []
    aggr_list_info.child_get("aggregates").children_get.each do |key|
        result << key.child_get_string("name")
    end
    return result
end
offline(aggr) click to toggle source
# File lib/netapp.rb, line 129
def self.offline(aggr)
    aggr_offline = @@filer.invoke("aggr-offline", 
                                  "aggregate", aggr)
    raise aggr_offline.results_reason \
          if aggr_offline.results_status == 'failed'
    return true
end
online(aggr) click to toggle source
# File lib/netapp.rb, line 122
def self.online(aggr)
    aggr_online = @@filer.invoke("aggr-online", 
                                 "aggregate", aggr)
    raise aggr_online.results_reason \
          if aggr_online.results_status == 'failed'
    return true
end
purge(aggr) click to toggle source
# File lib/netapp.rb, line 111
def self.purge(aggr)
    aggr_destroy = @@filer.invoke("aggr-destroy", 
                                  "aggregate", aggr)
    raise aggr_destroy.results_reason \
          if aggr_destroy.results_status == 'failed'
    return true
end
rename(aggr, newname) click to toggle source
# File lib/netapp.rb, line 136
def self.rename(aggr, newname)
    aggr_rename = @@filer.invoke("aggr-rename", 
                                 "aggregate", aggr,
                                 "new-aggregate-name", newname)
    raise aggr_rename.results_reason \
          if aggr_rename.results_status == 'failed'
    return true
end