Welcome to mirror list, hosted at ThFree Co, Russian Federation.

plugins-vmware-plugin.tex « main « en « manuals - github.com/bareos/bareos-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f02a24bbd50b0a66df6893340769cf5410a1690d (plain)
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
\subsection{VMware Plugin}
\label{VMwarePlugin}
\index[general]{Plugin!VMware}
\index[general]{VMware Plugin}

The \vmware\ Plugin can be
used for agentless backups of virtual machines running on
\vSphere.
It makes use of CBT (Changed Block Tracking) to do space efficient
full and incremental backups, see below for mandatory requirements.

It is included in Bareos since \sinceVersion{fd}{VMware Plugin}{15.2.0}.

\subsubsection{Status}

The Plugin can do full, differential and incremental backup and restore of VM disks.

Current limitations amongst others are:

\limitation*{VMware Plugin}{Normal VM disks can not be excluded from the backup}{%
    It is not yet possible to exclude normal (dependent) VM disks from backups.
    However, independent disks are excluded implicitly because they are not affected
    by snapshots which are required for CBT based backup.}

\limitation*{VMware Plugin}{VM configuration is not backed up}{%
    The VM configuration is not backed up, so that it is not yet possible to recreate a completely deleted VM.}

\limitation*{VMware Plugin}{Virtual Disks have to be smaller than 2TB}{%
    Virtual Disks have to be smaller than 2 TB, see \ticket{670}.}

\limitation*{VMware Plugin}{Restore can only be done to the same VM or to local VMDK files}{%
    Until Bareos Version 15.2.2, the restore has only be possible to the same existing VM with existing virtual disks.
    Since \sinceVersion{fd}{VMware Plugin: restore to VMDK files}{15.2.3}
    %\package{bareos-vadp-dumper} \sinceVersion{fd}{bareos-vadp-dumper}{15.2.2-15} and 
    %\package{bareos-vmware-plugin} \sinceVersion{fd}{bareos-vmware-plugin}{15.2.2-27}
    it is also possible to restore to local VMDK files, see below for more details.}

\subsubsection{Requirements}
As the Plugin is based on the \vSphere Storage APIs for Data Protection,
which requires at least a \vSphere Essentials License.
It is tested against \vSphere Storage APIs for Data Protection of \vmware 5.x.
It does not work with standalone unlicensed \vmware ESXi\trademark.

Since Bareos \sinceVersion{fd}{VMware Plugin: VDDK 6.5.2}{17.2.4} the Plugin is using
the Virtual Disk Development Kit (VDDK) 6.5.2, as of the VDDK 6.5 release notes, it
should be compatible with vSphere 6.5 and the next major release (except new features)
and backward compatible with vSphere 5.5 and 6.0, see VDDK release notes at
\url{https://code.vmware.com/web/sdk/65/vddk} for details.

\subsubsection{Installation}

Install the package \package{bareos-vmware-plugin} including its requirments
by using an appropriate package management tool
(eg. \command{yum}, \command{zypper}, \command{apt})

The \elink{FAQ}{http://www.bareos.org/en/faq.html} may have additional
useful information.

\subsubsection{Configuration}

First add a user account in vCenter that has full privileges by assigning
the account to an administrator role or by adding the account to a group
that is assigned to an administrator role. While any user account
with full privileges could be used, it is better practice to create a separate
user account, so that the actions by this account logged in vSphere are clearly
distinguishable. In the future a more detailed set of required role privilges
may be defined.

When using the vCenter appliance with embedded SSO, a user account usually has the
structure \command{<username>@vsphere.local}, it may be different when using
Active Directory as SSO in vCenter. For the examples here, we will use
\command{bakadm@vsphere.local} with the password \command{Bak.Adm-1234}.

For more details regarding users and permissions in vSphere see
\begin{itemize}
    \item \url{http://pubs.vmware.com/vsphere-55/topic/com.vmware.vsphere.security.doc/GUID-72BFF98C-C530-4C50-BF31-B5779D2A4BBB.html} and
    \item \url{http://pubs.vmware.com/vsphere-55/topic/com.vmware.vsphere.security.doc/GUID-5372F580-5C23-4E9C-8A4E-EF1B4DD9033E.html}
\end{itemize}

Make sure to add or enable the following settings in \file{/etc/bareos/bareos-fd.conf}:

\begin{bconfig}{bareos-fd.conf: Plugin Settings}
...
FileDaemon {
...
  Plugin Directory = /usr/lib/bareos/plugins
  Plugin Names = python
...
}
\end{bconfig}

Note: Depending on Platform, the Plugin Directory may also be \path|/usr/lib64/bareos/plugins|

To define the backup of a VM in Bareos, a job definition and a fileset
resource must be added to the Bareos director confguration.
In vCenter, VMs are usually organized in datacenters and folders.
The following example shows how to configure the backup of the VM
named \textit{websrv1} in the datacenter \textit{mydc1}
folder \textit{webservers} on the vCenter server \command{vcenter.example.org}:

\begin{bconfig}{bareos-dir.conf: VMware Plugin Job and FileSet definition}
Job {
  Name = "vm-websrv1"
  JobDefs = "DefaultJob"
  FileSet = "vm-websrv1_fileset"
}

FileSet {
  Name = "vm-websrv1_fileset"

  Include {
    Options {
         signature = MD5
         Compression = GZIP
    }
    Plugin = "python:module_path=/usr/lib64/bareos/plugins/vmware_plugin:module_name=bareos-fd-vmware:dc=mydc1:folder=/webservers:vmname=websrv1:vcserver=vcenter.example.org:vcuser=bakadm@vsphere.local:vcpass=Bak.Adm-1234"
  }
}
\end{bconfig}

For VMs defined in the root-folder, \command{folder=/} must be specified
in the Plugin definition.

New since Bareos \sinceVersion{fd}{VMware Plugin: vcthumbprint}{17.2.4}: As the Plugin is using
the Virtual Disk Development Kit (VDDK) 6.5, it is required to pass the thumbprint
of the vCenter SSL Certificate, which is the SHA1 checksum of the SSL Certificate.
The thumbprint can be retrieved like this:

\begin{commands}{Example Retrieving vCenter SSL Certificate Thumbprint}
echo -n | openssl s_client -connect vcenter.example.org:443 2>/dev/null | openssl x509 -noout -fingerprint -sha1
\end{commands}

The result would look like this:

\begin{commands}{Example Result Thumbprint}
SHA1 Fingerprint=CC:81:81:84:A3:CF:53:ED:63:B1:46:EF:97:13:4A:DF:A5:9F:37:89
\end{commands}

For additional security, there is a now plugin option \command{vcthumbprint}, that can optionally
be added. It must be given without colons like in the following example:

\begin{bconfig}{bareos-dir.conf: VMware Plugin Options with vcthumbprint}
    ...
    Plugin = "python:module_path=/usr/lib64/bareos/plugins/vmware_plugin:module_name=bareos-fd-vmware:dc=mydc1:folder=/webservers:vmname=websrv1:vcserver=vcenter.example.org:vcuser=bakadm@vsphere.local:vcpass=Bak.Adm-1234:vcthumbprint=56F597FE60521773D073A2ED47CE07282CE6FE9C"
    ...
\end{bconfig}

For ease of use (but less secure) when the \command{vcthumbprint} is not given, the plugin
will retrieve the thumbprint.

Also since \sinceVersion{fd}{VMware Plugin: transport=nbdssl}{17.2.4} another optional plugin option has
been added that can be used for trying to force a given transport method. Normally, when
no transport method is given, VDDK will negotiate available transport methods and select
the best one. For a description of transport methods, see

\url{https://code.vmware.com/doc/preview?id=4076#/doc/vddkDataStruct.5.5.html}

When the plugin runs in a VMware virtual machine which has access to datastore where the
virtual disks to be backed up reside, VDDK will use the hotadd transport method.
On a physical server without SAN access, it will use the NBD transport method, hotadd
transport is not available in this case.

To try forcing a given transport method, the plugin option \command{transport} can
be used, for example

\begin{bconfig}{bareos-dir.conf: VMware Plugin options with transport}
    ...
    Plugin = "python:module_path=/usr/lib64/bareos/plugins/vmware_plugin:module_name=bareos-fd-vmware:dc=mydc1:folder=/webservers:vmname=websrv1:vcserver=vcenter.example.org:vcuser=bakadm@vsphere.local:vcpass=Bak.Adm-1234:transport=nbdssl"
    ...
\end{bconfig}

Note that the backup will fail when specifying a transport method that is not available.

\subsubsection{Backup}

Before running the first backup, CBT (Changed Block Tracking) must be
enabled for the VMs to be backed up.

As of \url{http://kb.vmware.com/kb/2075984} manually enabling CBT is
currently not working properly. The API however works properly.
To enable CBT use the Script \command{vmware_cbt_tool.py}, it is packaged
in the bareos-vmware-plugin package:

\begin{commands}{usage of vmware\_cbt\_tool.py}
# <parameter>vmware_cbt_tool.py --help</parameter>
usage: vmware_cbt_tool.py [-h] -s HOST [-o PORT] -u USER [-p PASSWORD] -d
                          DATACENTER -f FOLDER -v VMNAME [--enablecbt]
                          [--disablecbt] [--resetcbt] [--info]

Process args for enabling/disabling/resetting CBT

optional arguments:
  -h, --help            show this help message and exit
  -s HOST, --host HOST  Remote host to connect to
  -o PORT, --port PORT  Port to connect on
  -u USER, --user USER  User name to use when connecting to host
  -p PASSWORD, --password PASSWORD
                        Password to use when connecting to host
  -d DATACENTER, --datacenter DATACENTER
                        DataCenter Name
  -f FOLDER, --folder FOLDER
                        Folder Name
  -v VMNAME, --vmname VMNAME
                        Names of the Virtual Machines
  --enablecbt           Enable CBT
  --disablecbt          Disable CBT
  --resetcbt            Reset CBT (disable, then enable)
  --info                Show information (CBT supported and enabled or
                        disabled)
\end{commands}

For the above configuration example, the command to enable CBT would be

\begin{commands}{Example using vmware\_cbt\_tool.py}
# <parameter>vmware_cbt_tool.py -s vcenter.example.org -u bakadm@vsphere.local -p Bak.Adm-1234 -d mydc1 -f /webservers -v websrv1 --enablecbt</parameter>
\end{commands}

Note: CBT does not work if the virtual hardware version is 6 or earlier.

After enabling CBT, Backup Jobs can be run or scheduled as usual,
for example in \command{bconsole}:

\bcommand{run}{job=vm-websrv1 level=Full}

\subsubsection{Restore}

For restore, the VM must be powered off and no snapshot must exist.
In \command{bconsole} use the restore menu 5, select the correct FileSet
and enter \bcommand{mark}{*}, then \bcommand{}{done}. After restore has finished,
the VM can be powered on.

\subsubsection{Restore to local VMDK File}
\index[general]{VMware Plugin!VMDK files}

%Since \package{bareos-vadp-dumper} \sinceVersion{fd}{bareos-vadp-dumper}{15.2.2-15} and
%\package{bareos-vmware-plugin} \sinceVersion{fd}{bareos-vmware-plugin}{15.2.2-27}
Since \sinceVersion{fd}{VMware Plugin: restore to VMDK files}{15.2.3}
it is possible to restore to local VMDK files. That means, instead of directly
restoring a disk that belongs to the VM, the restore creates VMDK disk image files
on the filesystem of the system that runs the \bareosFd. As the VM that the backup
was taken from is not affected by this, it can remain switched on while restoring
to local VMDK. Such a restored VMDK file can then be uploaded to a \vSphere datastore
or accessed by tools like \elink{guestfish}{http://libguestfs.org/guestfish.1.html} to extract single files.

For restoring to local VMDK, the plugin option \argument{localvmdk=yes} must be passed.
The following example shows how to perform such a restore using \command{bconsole}:

\begin{commands}{Example restore to local VMDK}
*<input>restore</input>
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"

First you select one or more JobIds that contain files
to be restored. You will be presented several methods
of specifying the JobIds. Then you will be allowed to
select which files from those JobIds are to be restored.

To select the JobIds, you have the following choices:
     1: List last 20 Jobs run
     ...
     5: Select the most recent backup for a client
     ...
    13: Cancel
Select item:  (1-13): <input>5</input>
Automatically selected Client: vmw5-bareos-centos6-64-devel-fd
The defined FileSet resources are:
     1: Catalog
     ...
     5: PyTestSetVmware-test02
     6: PyTestSetVmware-test03
     ...
Select FileSet resource (1-10): <input>5</input>
+-------+-------+----------+---------------+---------------------+------------------+
| jobid | level | jobfiles | jobbytes      | starttime           | volumename       |
+-------+-------+----------+---------------+---------------------+------------------+
|   625 | F     |        4 | 4,733,002,754 | 2016-02-18 10:32:03 | Full-0067        |
...
You have selected the following JobIds: 625,626,631,632,635

Building directory tree for JobId(s) 625,626,631,632,635 ...  
10 files inserted into the tree.

You are now entering file selection mode where you add (mark) and
remove (unmark) files to be restored. No files are initially added, unless
you used the "all" keyword on the command line.
Enter "done" to leave this mode.

cwd is: /
$ <input>mark *</input>
10 files marked.
$ <input>done</input>
Bootstrap records written to /var/lib/bareos/vmw5-bareos-centos6-64-devel-dir.restore.1.bsr

The job will require the following
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
   
    Full-0001                 File                      FileStorage
    ...
    Incremental-0078          File                      FileStorage

Volumes marked with "*" are online.

10 files selected to be restored.

Using Catalog "MyCatalog"
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/lib/bareos/vmw5-bareos-centos6-64-devel-dir.restore.1.bsr
Where:           /tmp/bareos-restores
Replace:         Always
FileSet:         Linux All
Backup Client:   vmw5-bareos-centos6-64-devel-fd
Restore Client:  vmw5-bareos-centos6-64-devel-fd
Format:          Native
Storage:         File
When:            2016-02-25 15:06:48
Catalog:         MyCatalog
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no): <input>mod</input>
Parameters to modify:
     1: Level
     ...
    14: Plugin Options
Select parameter to modify (1-14): <input>14</input>
Please enter Plugin Options string: <input>python:localvmdk=yes</input>
Run Restore job
JobName:         RestoreFiles
Bootstrap:       /var/lib/bareos/vmw5-bareos-centos6-64-devel-dir.restore.1.bsr
Where:           /tmp/bareos-restores
Replace:         Always
FileSet:         Linux All
Backup Client:   vmw5-bareos-centos6-64-devel-fd
Restore Client:  vmw5-bareos-centos6-64-devel-fd
Format:          Native
Storage:         File
When:            2016-02-25 15:06:48
Catalog:         MyCatalog
Priority:        10
Plugin Options:  python: module_path=/usr/lib64/bareos/plugins/vmware_plugin: module_name=bareos-fd-vmware: dc=dass5:folder=/: vmname=stephand-test02: vcserver=virtualcenter5.dass-it:vcuser=bakadm@vsphere.local: vcpass=Bak.Adm-1234: localvmdk=yes
OK to run? (yes/mod/no): <input>yes</input>
Job queued. JobId=639
\end{commands}

Note: Since Bareos \sinceVersion{fd}{Add additional python plugin options}{15.2.3} it is sufficient to add Python plugin options, e.g. by

\argument{python:localvmdk=yes}

Before, all Python plugin must be repeated and the additional be added, like:
\path|python:module_path=/usr/lib64/bareos/plugins/vmware_plugin:module_name=bareos-fd-vmware:dc=dass5:folder=/:vmname=stephand-test02:vcserver=virtualcenter5.dass-it:vcuser=bakadm@vsphere.local:vcpass=Bak.Adm-1234:localvmdk=yes|


After the restore process has finished, the restored VMDK files can be found
under \path{/tmp/bareos-restores/}:

\begin{commands}{Example result of restore to local VMDK}
# <input>ls -laR /tmp/bareos-restores</input>
/tmp/bareos-restores:
total 28
drwxr-x--x.  3 root root  4096 Feb 25 15:47 .
drwxrwxrwt. 17 root root 20480 Feb 25 15:44 ..
drwxr-xr-x.  2 root root  4096 Feb 25 15:19 [ESX5-PS100] stephand-test02

/tmp/bareos-restores/[ESX5-PS100] stephand-test02:
total 7898292
drwxr-xr-x. 2 root root       4096 Feb 25 15:19 .
drwxr-x--x. 3 root root       4096 Feb 25 15:47 ..
-rw-------. 1 root root 2075197440 Feb 25 15:19 stephand-test02_1.vmdk
-rw-------. 1 root root 6012731392 Feb 25 15:19 stephand-test02.vmdk
\end{commands}