Class: ChefBackup::Strategy::LvmBackup

Inherits:
TarBackup
  • Object
show all
Defined in:
lib/chef_backup/strategy/backup/lvm.rb

Overview

ChefBackup::Lvm class. Class used when Enterprise Chef’s stateful services are on an LVM logical volume. This may allow us to not require a pg_dump, instead relying on pg_crash recovery. Not doing a pg_dump will greatly speed up backups.

Constant Summary

Constants inherited from TarBackup

TarBackup::DEFAULT_STATEFUL_SERVICES

Constants included from Helpers

Helpers::DEFAULT_PG_OPTIONS, Helpers::SERVER_ADD_ONS

Instance Attribute Summary

Attributes inherited from TarBackup

#backup_time

Instance Method Summary collapse

Methods inherited from TarBackup

#add_ha_services, #ask_to_go_offline, #chpst, #config_directories, #config_only?, #create_tarball, #data_map, #dump_db, #export_dir, #export_filename, #export_tarball, #external_pg?, #initialize, #manifest, #not_implemented, #offline_permission_granted?, #pg_dump?, #pg_dumpall, #populate_data_map, #populate_versions, #project_names, #service_enabled?, #stateful_services, #write_manifest

Methods included from Helpers

#addon_install_dir, #all_services, #backend?, #base_config_dir, #base_install_dir, #chpst, #cleanup, #config, #config_base, #ctl_command, #database_name, #disabled_services, #enabled_addons, #enabled_services, #ensure_file!, #frontend?, #ha?, #log, #marketplace?, #online?, #pg_options, #pgsql, #project_name, #reconfigure_add_ons, #reconfigure_marketplace, #restart_add_ons, #restart_chef_server, #running_filepath, #service_config, #service_enabled?, #shell_out, #shell_out!, #shell_timeout, #standalone?, #start_chef_server, #start_service, #stop_chef_server, #stop_service, #strategy, #tier?, #tmp_dir, #topology, #version_from_manifest_file

Constructor Details

This class inherits a constructor from ChefBackup::Strategy::TarBackup

Instance Method Details

#backupObject

  • verify config

    • Verify lv and vg existence

    • Warn if space is low in vg for an lvm snapshot

    • Ensure backup directory exists

    • Create temp backup dir

    • Do DB dump (if we have to)

    • Create backup manifest

    • Take LVM snapshot

    • Mount LVM snapshot

    • Create a gzipped tarball of all required files

      • db dump (if we have to)

      • /etc/opscode

      • Backup manifest

      • mounted LVM snapshot

    • Cleanup tmp directories



21
22
23
24
25
26
27
28
29
30
# File 'lib/chef_backup/strategy/backup/lvm.rb', line 21

def backup
  ensure_tmp_dir
  verify_lvm
  dump_db if pg_dump?
  create_manifest
  take_lvm_snapshot
  mount_lvm_snapshot
  create_tarball
  cleanup
end

#mount_lvm_snapshotObject



39
# File 'lib/chef_backup/strategy/backup/lvm.rb', line 39

def mount_lvm_snapshot; end

#take_lvm_snapshotObject



37
# File 'lib/chef_backup/strategy/backup/lvm.rb', line 37

def take_lvm_snapshot; end

#verify_lvmObject



32
33
34
35
# File 'lib/chef_backup/strategy/backup/lvm.rb', line 32

def verify_lvm
  # verify lv and vg are available
  # warn if vg space is low
end