Class: Snapshot

Inherits:
Filer show all
Defined in:
lib/netapp.rb

Class Method Summary collapse

Methods inherited from Filer

#initialize, is_clustered?, is_ha?, is_secure?, set_vfiler

Constructor Details

This class inherits a constructor from Filer

Class Method Details

.create(name, volname) ⇒ Object



348
349
350
351
352
353
354
355
# File 'lib/netapp.rb', line 348

def self.create(name, volname)
    snapshot_create = @@filer.invoke("snapshot-create", 
                                     "snapshot", name, 
                                     "volume", volname)
    raise snapshot_create.results_reason \
          if snapshot_create.results_status == 'failed'
    return true
end

.delta(snap1, snap2, volname) ⇒ Object



373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/netapp.rb', line 373

def self.delta(snap1, snap2, volname)
    snapshot_delta = @@filer.invoke("snapshot-delta-info", 
                                    "volume", volname,
                                    "snapshot1", snap1,
                                    "snapshot2", snap2)
    raise snapshot_delta.results_reason \
          if snapshot_delta.results_status == 'failed'
    result = {}
    return result = {
        consumedsize:     snapshot_delta.child_get_string("consumed-size"),
        elapsedtime:      snapshot_delta.child_get_string("elapsed-time")
    }
end

.delta_to_volume(snap, volname) ⇒ Object



386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/netapp.rb', line 386

def self.delta_to_volume(snap, volname)
    snapshot_delta = @@filer.invoke("snapshot-delta-info", 
                                    "volume", volname,
                                    "snapshot1", snap)
    raise snapshot_delta.results_reason \
          if snapshot_delta.results_status == 'failed'
    result = {}
    return result = {
        consumedsize:     snapshot_delta.child_get_string("consumed-size"),
        elapsedtime:      snapshot_delta.child_get_string("elapsed-time")
    }
end

.info(volname) ⇒ Object



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/netapp.rb', line 424

def self.info(volname)
    snapshot_info = @@filer.invoke("snapshot-list-info", 
                                   "volume", volname)
    raise snapshot_info.results_reason \
          if snapshot_info.results_status == 'failed'
    result = {}
    snapshot_info.child_get("snapshots").children_get.each do |key|
        result = {
            name:                     key.child_get_string("name"),
            accesstime:               key.child_get_string("access-time"),
            busy:                     key.child_get_string("busy"),
            containslunclones:        key.child_get_string("contains-lun-clones"), 
            cumpercentageblockstotal: key.child_get_string("cumulative-percentage-of-total-blocks"),
            cumpercentageblocksused:  key.child_get_string("cumulative-percentage-of-used-blocks"),
            cumtotal:                 key.child_get_string("cumulative-total"),
            dependency:               key.child_get_string("dependency"),
            percentageblockstotal:    key.child_get_string("percentage-of-total-blocks"),
            percentageblocksused:     key.child_get_string("percentage-of-used-blocks"),
            total:                    key.child_get_string("total")
        }
    end
    return result
end

.purge(name, volname) ⇒ Object



356
357
358
359
360
361
362
363
# File 'lib/netapp.rb', line 356

def self.purge(name, volname)
    snapshot_delete = @@filer.invoke("snapshot-delete", 
                                     "snapshot", name,
                                     "volume", volname)
    raise snapshot_delete.results_reason \
          if snapshot_delete.results_status == 'failed'
    return true
end

.rename(volume, name, newname) ⇒ Object



364
365
366
367
368
369
370
371
372
# File 'lib/netapp.rb', line 364

def self.rename(volume, name, newname)
    snapshot_rename = @@filer.invoke("snapshot-rename", 
                                     "volume", volname,
                                     "current-name", name,
                                     "new-name", newname)
    raise snapshot_rename.results_reason \
          if snapshot_rename.results_status == 'failed'
    return true
end

.reserve(volname) ⇒ Object



398
399
400
401
402
403
404
405
406
407
408
# File 'lib/netapp.rb', line 398

def self.reserve(volname)
    snapshot_reserve = @@filer.invoke("snapshot-get-reserve", 
                                      "volume", volname)
    raise snapshot_reserve.results_reason \
          if snapshot_reserve.results_status == 'failed'
    result = {}
    return result = {
        blocksreserved:     snapshot_reserve.child_get_string("blocks-reserved"),
        percentreserved:    snapshot_reserve.child_get_string("percent-reserved")
    }
end

.schedule(volname) ⇒ Object



409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/netapp.rb', line 409

def self.schedule(volname)
    snapshot_schedule = @@filer.invoke("snapshot-get-schedule", 
                                       "volume", volname)
    raise snapshot_schedule.results_reason \
          if snapshot_schedule.results_status == 'failed'
    result = {}
    return result = {
        days:          snapshot_schedule.child_get_string("days"),
        hours:         snapshot_schedule.child_get_string("hours"),
        minutes:       snapshot_schedule.child_get_string("minutes"),
        weeks:         snapshot_schedule.child_get_string("weeks"),
        whichhours:    snapshot_schedule.child_get_string("which-hours"),
        whichminutes:  snapshot_schedule.child_get_string("which-minutes")
    }
end