Module: Dopv
- Extended by:
- DopCommon::NodeFilter
- Defined in:
- lib/dopv/state_store.rb,
lib/dopv.rb,
lib/dopv/cli.rb,
lib/dopv/log.rb,
lib/dopv/plan.rb,
lib/dopv/version.rb,
lib/dopv/infrastructure.rb,
lib/dopv/cli/command_add.rb,
lib/dopv/cli/command_run.rb,
lib/dopv/persistent_disk.rb,
lib/dopv/cli/command_list.rb,
lib/dopv/cli/command_export.rb,
lib/dopv/cli/command_import.rb,
lib/dopv/cli/command_remove.rb,
lib/dopv/cli/command_update.rb,
lib/dopv/cli/command_validate.rb,
lib/dopv/infrastructure/providers/base.rb,
lib/dopv/infrastructure/providers/ovirt.rb,
lib/dopv/infrastructure/providers/vsphere.rb,
lib/dopv/infrastructure/providers/baremetal.rb,
lib/dopv/infrastructure/providers/openstack.rb
Overview
This is the DOPv disk state store
Defined Under Namespace
Modules: Cli, Infrastructure, PersistentDisk
Classes: Plan, StateStore, StateStoreObserver
Constant Summary
collapse
- DEFAULT_MAX_IN_FLIGHT =
5
- VERSION =
'0.14.8'
Class Method Summary
collapse
-
.add(plan_file) ⇒ Object
-
.deploy(plan_name, options = {}) ⇒ Object
-
.export_state(plan_name) ⇒ Object
-
.export_state_file(plan_name, state_file) ⇒ Object
-
.import_state(plan_name, data_volumes_db) ⇒ Object
-
.import_state_file(plan_name, state_file) ⇒ Object
-
.list ⇒ Object
-
.log ⇒ Object
-
.logger=(logger) ⇒ Object
-
.refresh(plan_name, options = {}) ⇒ Object
-
.remove(plan_name, remove_dopi_state = true, remove_dopv_state = false) ⇒ Object
-
.undeploy(plan_name, options = {}) ⇒ Object
-
.update_plan(plan_file, options = {}) ⇒ Object
-
.update_state(plan_name, options = {}) ⇒ Object
-
.valid?(plan_file) ⇒ Boolean
Class Method Details
.add(plan_file) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/dopv.rb', line 22
def self.add(plan_file)
raise StandardError, 'Plan not valid; did not add' unless valid?(plan_file)
plan_name = plan_store.add(plan_file)
Dopv.update_state(plan_name)
plan_name
end
|
.deploy(plan_name, options = {}) ⇒ Object
51
52
53
|
# File 'lib/dopv.rb', line 51
def self.deploy(plan_name, options = {})
run(:deploy, plan_name, options)
end
|
.export_state(plan_name) ⇒ Object
63
64
65
66
67
|
# File 'lib/dopv.rb', line 63
def self.export_state(plan_name)
ensure_plan_exists(plan_name)
state_store = Dopv::StateStore.new(plan_name, plan_store)
state_store.export
end
|
.export_state_file(plan_name, state_file) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/dopv.rb', line 69
def self.export_state_file(plan_name, state_file)
ensure_plan_exists(plan_name)
File.open(state_file, 'w+') do |diskdb|
diskdb << YAML.dump(Dopv.export_state(plan_name))
end
end
|
.import_state(plan_name, data_volumes_db) ⇒ Object
76
77
78
79
80
81
82
|
# File 'lib/dopv.rb', line 76
def self.import_state(plan_name, data_volumes_db)
ensure_plan_exists(plan_name)
plan_store.run_lock(plan_name) do
state_store = Dopv::StateStore.new(plan_name, plan_store)
state_store.import(data_volumes_db)
end
end
|
.import_state_file(plan_name, state_file) ⇒ Object
84
85
86
87
|
# File 'lib/dopv.rb', line 84
def self.import_state_file(plan_name, state_file)
ensure_plan_exists(plan_name)
Dopv.import_state(plan_name, YAML.load_file(state_file))
end
|
.list ⇒ Object
47
48
49
|
# File 'lib/dopv.rb', line 47
def self.list
plan_store.list
end
|
.log ⇒ Object
5
6
7
|
# File 'lib/dopv/log.rb', line 5
def self.log
@log ||= DopCommon.log
end
|
.logger=(logger) ⇒ Object
9
10
11
12
|
# File 'lib/dopv/log.rb', line 9
def self.logger=(logger)
@log = logger
DopCommon.logger = logger
end
|
.refresh(plan_name, options = {}) ⇒ Object
59
60
61
|
# File 'lib/dopv.rb', line 59
def self.refresh(plan_name, options = {})
run(:refresh, plan_name, options)
end
|
.remove(plan_name, remove_dopi_state = true, remove_dopv_state = false) ⇒ Object
43
44
45
|
# File 'lib/dopv.rb', line 43
def self.remove(plan_name, remove_dopi_state = true, remove_dopv_state = false)
plan_store.remove(plan_name, remove_dopi_state, remove_dopv_state)
end
|
.undeploy(plan_name, options = {}) ⇒ Object
55
56
57
|
# File 'lib/dopv.rb', line 55
def self.undeploy(plan_name, options = {})
run(:undeploy, plan_name, options)
end
|
.update_plan(plan_file, options = {}) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/dopv.rb', line 29
def self.update_plan(plan_file, options = {})
raise StandardError, 'Plan not valid; did not add' unless valid?(plan_file)
plan_name = plan_store.update(plan_file)
update_state(plan_name, options)
plan_name
end
|
.update_state(plan_name, options = {}) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/dopv.rb', line 36
def self.update_state(plan_name, options = {})
plan_store.run_lock(plan_name) do
state_store = Dopv::StateStore.new(plan_name, plan_store)
state_store.update(options)
end
end
|
.valid?(plan_file) ⇒ Boolean
16
17
18
19
20
|
# File 'lib/dopv.rb', line 16
def self.valid?(plan_file)
hash, _ = plan_store.read_plan_file(plan_file)
plan = DopCommon::Plan.new(hash)
plan.valid?
end
|