-
Notifications
You must be signed in to change notification settings - Fork 25
/
.travis.yml
230 lines (215 loc) · 6.4 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
---
language: python
python: "2.7"
sudo: required
dist: xenial
install:
# Install dependencies
- sudo apt-get -y update
#- sudo apt-get install --reinstall -y -o Dpkg::Options::="--force-confnew" fontconfig fontconfig-config
- sudo apt-get install --reinstall -y -o Dpkg::Options::="--force-confnew" libvirt-bin virtinst qemu-kvm qemu-utils
# Configure libvirt qemu
- sudo sh -c 'echo "security_driver = \"none\"" >> /etc/libvirt/qemu.conf'
- sudo service libvirt-bin restart
- sudo service qemu-kvm restart
- sleep 2
#See if we can setup a VM
- sudo virsh net-list
# Uncomment for more details
#- sudo virsh --connect qemu:///system capabilities
#install Shellcheck
#- sudo apt-get install -y -o Dpkg::Options::="--force-confnew" cabal-install
#- sudo cabal update
#- sudo cabal install shellcheck
- sudo apt-get install -y -o Dpkg::Options::="--force-confnew" shellcheck
# Download cirros image and setup disks
- >
wget --no-check-certificate
https://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
-O /tmp/cirros.img
- mkdir /tmp/test\ disks /tmp/backup\ dir
- sudo chmod 0777 /tmp/backup\ dir
- cp /tmp/cirros.img /tmp/test\ disks/test1\ 1.img
- cp /tmp/cirros.img /tmp/test\ disks/test2\ 1.img
- cp /tmp/cirros.img /tmp/test\ disks/test2\ 2.img
# Create VMS
- >
sudo virt-install --connect qemu:///system --os-type linux
--os-variant generic --debug --import --name t1d --ram 512 --vcpus 1
--noautoconsole --nographics --virt-type qemu --nonetworks
--disk path=/tmp/test\ disks/test1\ 1.img,device=disk,format=qcow2
- >
sudo virt-install --connect qemu:///system --os-type linux
--os-variant generic --debug --import --name t2d --ram 512 --vcpus=1
--noautoconsole --nographics --virt-type qemu --nonetworks
--disk path=/tmp/test\ disks/test2\ 1.img,device=disk,format=qcow2
--disk path=/tmp/test\ disks/test2\ 2.img,device=disk,format=qcow2
- sudo virsh list --all
script:
# Check fi-backup.sh syntax
- shellcheck --exclude=SC2181 --exclude=SC2034 --exclude=SC2178 fi-backup.sh
# Test0: stop VMs and see if offline backup works, then restart domains
# shutdown can't be monitored from within virsh. Wait to ensure full start/stop
- mkdir /tmp/backup_off\ dir
- sudo chmod 0777 /tmp/backup_off\ dir
- sleep 20
- sudo virsh shutdown t1d
- sleep 15
- sudo virsh -r list --all
- sudo virsh shutdown t2d
- sleep 15
- sudo virsh -r list --all
- sudo ./fi-backup.sh -d -b /tmp/backup_off\ dir all
- ls -la /tmp/backup_off\ dir/test*
- sleep 2
- sudo virsh start t1d
- sudo virsh start t2d
- sleep 2
# Test1 1 disk, spaces in filenames
## 1st Backup
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir t1d
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir t1d
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Consolidate
- sudo ./fi-backup.sh -dc t1d
## 2nd Backup
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir t1d
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir t1d
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Consolidate
- sudo ./fi-backup.sh -dc t1d
# Test2 2 disks, spaces in filenames
## 1st Backup
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir t2d
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir t2d
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Consolidate
- sudo ./fi-backup.sh -dc t2d
## 2nd Backup
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir t2d
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir t2d
### Consolidate
- sudo ./fi-backup.sh -dc t2d
- sleep 2
# Test3 all domains
## 1st Backup
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir all
### Consolidate
- sudo ./fi-backup.sh -dc all
## 2nd Backup
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Consolidate
- sudo ./fi-backup.sh -dc all
- sleep 2
# Test4 all domains, snapshot + consolidate
## 1st Backup
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Consolidate
- sudo ./fi-backup.sh -dC all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
## 2nd Backup
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -b /tmp/backup\ dir all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Consolidate
- sudo ./fi-backup.sh -dC all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
# Test5 all domains, dump state, snapshot, consolidate
## 1st Backup
### Backup
- sudo ./fi-backup.sh -d -s /tmp/backup\ dir -b /tmp/backup\ dir all
- sudo virsh list --all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -s /tmp/backup\ dir -b /tmp/backup\ dir all
- sudo virsh list --all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Consolidate
- sudo ./fi-backup.sh -dc all
- sudo virsh list --all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
## 2nd Backup
### Backup
- sudo ./fi-backup.sh -d -s /tmp/backup\ dir -b /tmp/backup\ dir all
- sudo virsh list --all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Backup
- sudo ./fi-backup.sh -d -s /tmp/backup\ dir -b /tmp/backup\ dir all
- sudo virsh list --all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks
- sleep 2
### Consolidate
- sudo ./fi-backup.sh -dc all
- sudo virsh list --all
- ls -la /tmp/backup\ dir
- ls -la /tmp/test\ disks