1VDSMD(8) VDSMD(8)
2
3
4
6 vdsmd - Virtual Desktops and Servers Manager
7 @ENGINENAME@ host agent
8
10 service vdsmd start
11
13 The VDSM service is required by a @ENGINENAME@ to manage oVirt Nodes
14 and Linux hosts. Currently, only Fedora and Red Hat Enterprise Linux
15 are supported. VDSM manages and monitors the host's storage, memory and
16 networks as well as virtual machine creation, other host administration
17 tasks, statistics gathering, and log collection.
18
19 VDSM should be run as a daemon on each node managed by @ENGINENAME@.
20 It answers XML-RPC calls from clients (mostly @ENGINENAME@).
21
22
24 VDSM is extendible: it has hooks in strategic locations, where it exe‐
25 cutes external scripts. Hooks API is new and is subject to future
26 changes. Currently-supported hooks have self-explanatory names:
27 before_vm_start, after_vm_start,
28 before_vm_cont, after_vm_cont,
29 before_vm_pause, after_vm_pause,
30 before_vm_hibernate, after_vm_hibernate,
31 before_vm_dehibernate, after_vm_dehibernate,
32 before_vm_migrate_source, after_vm_migrate_source,
33 before_vm_migrate_destination, after_vm_migrate_destination,
34 before_device_migrate_source, after_device_migrate_source,
35 before_device_migrate_destination, after_device_migrate_destina‐
36 tion,
37 before_vm_destroy, after_vm_destroy,
38 before_vm_set_ticket, after_vm_set_ticket,
39 before_device_create, after_device_create,
40 before_device_destroy, after_device_destroy,
41 before_nic_hotplug, after_nic_hotplug, after_nic_hotplug_fail,
42 before_nic_hotunplug, after_nic_hotunplug, after_nic_hotun‐
43 plug_fail,
44 before_update_device, after_update_device,
45 after_update_device_fail,
46 before_disk_hotplug, after_disk_hotplug,
47 before_disk_hotunplug, after_disk_hotunplug,
48 before_vdsm_start, after_vdsm_stop,
49 before_network_setup, after_network_setup, after_network_set‐
50 up_fail,
51 before_set_num_of_cpus, after_set_num_of_cpus,
52 before_get_vm_stats, after_get_vm_stats,
53 before_get_all_vm_stats, after_get_all_vm_stats,
54 before_get_caps, after_get_caps,
55 before_get_stats, after_get_stats,
56 after_hostdev_list_by_caps,
57 before_memory_hotplug, after_memory_hotplug,
58 before_ifcfg_write, after_ifcfg_write.
59
60 Each hook executes the scripts under /usr/libexec/vdsm/hooks/<hook-
61 name>/ in lexicographic order.
62
63
64 Hook environment
65 Each hook script (except before_vdsm_start, after_vdsm_stop,
66 before_network_setup, after_network_setup and after_network_setup_fail,
67 before_get_vm_stats, after_get_vm_stats, before_get_all_vm_stats,
68 after_get_all_vm_stats, before_get_caps, after_get_caps,
69 before_get_stats, after_get_stats, after_hostdev_list_by_caps,
70 before_ifcfg_write and after_ifcfg_write) inherit the environment of
71 the VDSM process, with an additional variable _hook_domxml which holds
72 the path of libvirt's domain xml representation of the relevant virtual
73 machine. The uuid of the virtual machine may be deduced from that xml,
74 but it is also available as the environment variable vmId.
75
76 The before_network_setup, after_network_setup, after_network_set‐
77 up_fail, before_ifcfg_write and after_ifcfg_write hooks do also include
78 an extra environment variable _hook_json which holds a pointer to a
79 file with the network parameters that vdsm is setting up ( request ) ,
80 the request may be modified by the before_network_setup hook as thus
81 affect the operation ultimately taken place by Vdsm.
82
83 The JSON format of this file for before_network_setup, after_net‐
84 work_setup and after_network_setup_fail has one section: request, this
85 section contains networks, bondings and options, those parameters are
86 specified in the setupNetworks VDSM API call.
87
88 {"request":
89 {
90 "networks": {"virtnet": {"bonding" : "bond0", "bridged": true, "vlan":27}},
91 "bondings": {"bond0": {"nics":["eth1","eth2"]}},
92 "options": {"conectivityCheck":false}
93 }
94 }
95
96 The JSON format of this file for before_ifcfg_write and
97 after_ifcfg_write has the following parameters: ifcfg_file and config.
98
99 {
100 "ifcfg_file": "/etc/sysconfig/network-scripts/ifcfg-eth0",
101 "config": "IPADDR=192.168.1.20ETMASK=255.255.255.0"
102 }
103
104 Hooks that handle NIC hotplug, hotunplug and update device have the
105 _hook_domxml variable but it contains the representation of the NIC
106 rather than the VM. Hotplug/hotunplug disk hooks also have the
107 _hook_dom_xml variable, which contains the drive definition (not the
108 VM). All hook points that are device specific get the xml of the
109 device instead of the entire VM. Such hooks are listed below.
110
111 On top of these, @ENGINENAME@ allows to set a collection of "custom
112 parameters" for each virtual machine. Each of these parameters is pro‐
113 vided to hooks as an environment variable.
114
115 before_migration_destination (and before_dehibernation) hooks currently
116 receive the xml of the domain from the source host. The xml of the
117 domain at the destination will differ in various details.
118
119 The environment of before_vm_set_ticket and after_vm_set_ticket hooks
120 is augmented with a set of params passed by the caller of setVmTicket.
121
122 The environment of before_vm_dehibernate and after_vm_dehibernate hooks
123 have FROM_SNAPSHOT variable set to True if the VM is being restored
124 from a live snapshot.
125
126 The environment of hooks specific to devices:
127 before_nic_hotplug, after_nic_hotplug, after_nic_hotplug_fail,
128 before_nic_hotunplug, after_nic_hotunplug, after_nic_hotun‐
129 plug_fail,
130 before_update_device, after_update_device,
131 after_update_device_fail,
132 before_disk_hotplug, after_disk_hotplug,
133 before_disk_hotunplug, after_disk_hotunplug,
134 before_device_create, after_device_create,
135 before_device_destroy, after_device_destroy,
136 before_device_migrate_source, after_device_migrate_source,
137 before_device_migrate_destination, after_device_migrate_destina‐
138 tion,
139 before_memory_hotplug, after_memory_hotplug.
140
141 Are all augmented by custom properties specific to those devices, sent
142 by the caller of the hook. For example if before_nic_hotplug is called
143 with custom: {qos: '0.5', color: 'red'} then qos and color will be
144 directly available as environment variables when before_nic_hotplug is
145 called.
146
147 before_get_vm_stats and before_get_all_vm_stats are called upon API
148 request to get VM statistics, before getVmStats and getAllVmStats
149 respectively. Those hooks do not receive any parameters.
150
151 after_get_vm_stats and after_get_all_vm_stats are called upon getVm‐
152 Stats and getAllVmStats respectively. Both receive a parameter in
153 _hook_json containing a list of dictionaries of VM stats (in case of
154 after_get_vm_stats the list will have a single element):
155 [
156 {"vm_id": "...", ... },
157 {"vm_id": "...", ... },
158 ...
159 ]
160
161 before_get_caps and after_get_caps are called before (and after) a
162 getVdsCapabilities API request. after_get_caps receives the complete
163 capabilities dictionary within _hook_json.
164
165 before_get_stats and after_get_stats are called before (and after) a
166 getVdsStats API request. after_get_stats receives the complete host
167 statistics dictionary within _hook_json.
168
169
170 Hook execution
171 before_vdsm_start and after_vdsm_stop scripts are executed as user
172 root. All the other hooks are executed as user vdsm.
173
174 before_vm_start scripts may edit the domain xml file (pointed by
175 _hook_domxml ) in order to change VDSM's definition of a virtual
176 machine before it reaches libvirt. As with all hooks, the China Store
177 Rule applies - if you break something, you own it. Any script can mess
178 up VDSM's operation badly. In particular, you may never change the uuid
179 of the domain, and should better know what you are doing if you remove
180 a device from the domain.
181
182 before_vm_start and before_device_create may alter the vm start behav‐
183 ior by modifying the vm libvirt vm startup flags. The flag must be
184 written to the /var/run/vdsm/hook/<vm id>/launchflags file, the
185 required value being a decimal based on the libvirt virDomainCreate‐
186 Flags enum values.
187
188 Standard error of hook scripts is collected into VDSM's log, which may
189 be used by scripts for debugging.
190
191 As a somewhat silly example, let us think of a script that warns when a
192 domain with too much memory is started on a host:
193
194 #!/bin/bash
195
196 mem=`/usr/bin/xpath $_hook_domxml '/domain/memory/text()' 2> /dev/null`
197
198 if [ "$mem" -gt 1073741824 ]; then
199 echo "Domain with more than Gb!" >&2
200 fi
201
202 exit 0
203
204
205 Hook return code
206 Hook script must return one of the following return codes:
207
208 0 the hook script ended successfully.
209 1 the hook script failed, other hooks should be processed.
210 2 the hook script failed, no further hooks should be processed.
211 >2 reserved.
212
213 If a before_<action> hook fails, the <action> would be aborted.
214 However, before_vm_destroy's failure does not abort destroy().
215
217 /etc/vdsm/vdsm.conf
218 VDSM main configuration file. Use with great caution; some
219 information about available variables and their meaning appear
220 in /usr/share/doc/vdsm-<version>/vdsm.conf.sample
221 /var/log/vdsm/vdsm.log
222 Default log location for vdsm.
223 /usr/share/doc/vdsm-<version>/vdsm-api.html
224 vdsm QAPI documentation.
225 /etc/pki/vdsm
226 VDSM's trust store: server key, certificate, and @ENGINENAME@
227 CA's certificate.
228 /rhev/data-center
229 VDSM's image repository, or more exactly, links to NFS exports
230 and iSCSI or FiberChannel devices which VDSM uses.
231
232
234 vdsClient(1)
235 http://www.ovirt.org/wiki/Category:Vdsm
236
238 VDSM was written by Ayal Baron, Barak Azulay, Cyril Plisko, Dan Kenigs‐
239 berg, Doron Fediuck, Igor Lvovsky, Saggi Mizrahi, Shahar Frank, Simon
240 Grinberg, and probably others.
241
243 Report bugs to <http://bugzilla.redhat.com>
244
246 Copyright 2010-2013 Red Hat, Inc. License GPLv2: GNU GPL Version 2
247 <http://gnu.org/licenses/gpl.html>.
248
249
250
251 January 1, 2012 VDSMD(8)