vamboo 1.1.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/vamboo/domainlist.rb +15 -6
- data/lib/vamboo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53ed8ee8cc83376ebbfd43f0546b118085dc62c8
|
4
|
+
data.tar.gz: f47ef0ea0c06e6c0819cbda6d39471f48adc57d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01c4a48325d2d8eb4d185797d171cb5f4c167e2888563e109a3f48284d0172d96f8a9f8697b42ddf4aa8ace03257bf7ef3846144ded3c173195e9a63a289a925
|
7
|
+
data.tar.gz: c94d6160e0d57a3d48f94dabf14054fbed0c61216378638e5b1e9caddd09c0adc43e3aef0494622ce519cf6496e34b8832a7f0cbcd6291d31799baaa8015f18c
|
data/README.md
CHANGED
data/lib/vamboo/domainlist.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "date"
|
1
2
|
require "libvirt"
|
2
3
|
require "zlib"
|
3
4
|
require "logger"
|
@@ -17,16 +18,17 @@ class DomainList
|
|
17
18
|
instance_eval(&block)
|
18
19
|
end
|
19
20
|
|
20
|
-
def add(name)
|
21
|
-
@list.push(Domain.new(name))
|
21
|
+
def add(name, rotation)
|
22
|
+
@list.push(Domain.new(name, rotation))
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
26
|
class Domain
|
26
|
-
attr_reader :name, :vmhd_pathes
|
27
|
+
attr_reader :name, :rotation, :vmhd_pathes
|
27
28
|
|
28
|
-
def initialize(name)
|
29
|
+
def initialize(name, rotation)
|
29
30
|
@name = name
|
31
|
+
@rotation = rotation
|
30
32
|
conn = Libvirt::open("qemu:///system")
|
31
33
|
domain = conn.lookup_domain_by_name(@name)
|
32
34
|
xml = REXML::Document.new(domain.xml_desc)
|
@@ -98,7 +100,8 @@ class Domain
|
|
98
100
|
end
|
99
101
|
|
100
102
|
log.info("Archive")
|
101
|
-
|
103
|
+
file_name = "#{@name}.#{Date.today.strftime("%Y%m%d")}.tar.gz"
|
104
|
+
Zlib::GzipWriter.open("#{target_path}/#{file_name}") do |archive|
|
102
105
|
out = Archive::Tar::Minitar::Output.new(archive)
|
103
106
|
Find.find("#{tmp_path}") do |file|
|
104
107
|
Archive::Tar::Minitar::pack_file(file, out)
|
@@ -106,7 +109,13 @@ class Domain
|
|
106
109
|
out.close
|
107
110
|
end
|
108
111
|
FileUtils.rm_rf("#{tmp_path}")
|
109
|
-
|
112
|
+
|
113
|
+
if @rotation > 0
|
114
|
+
old = Date.today - @rotation
|
115
|
+
old_file = "#{@name}.#{old}.tar.gz"
|
116
|
+
log.info("Remove old file #{target_path}/#{old}")
|
117
|
+
FileUtils.rm_rf("#{target_path}/#{old}")
|
118
|
+
end
|
110
119
|
log.info("Complete backup")
|
111
120
|
end
|
112
121
|
|
data/lib/vamboo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vamboo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- numa08
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.4.5
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: virtual machine backup util
|