Debian Codegraph @

agents/virt/docs/README

raw
1 TODO: update
2
3 I. Fence_xvm - Virtual machine fencing agent
4
5 Fence_xvm is an agent which establishes a communications link between
6 a cluster of virtual machines (VC) and a cluster of domain0/physical
7 nodes which are hosting the virtual cluster. Its operations are
8 fairly simple.
9
10 (a) Start a listener service.
11 (b) Send a multicast packet requesting that a VM be fenced.
12 (c) Authenticate client.
13 (e) Read response.
14 (f) Exit with success/failure, depending on the response received.
15
16 If any of the above steps fail, the fencing agent exits with a failure
17 code and fencing is retried by the virtual cluster at a later time.
18 Because of the simplicty of fence_xvm, it is not necessary that
19 fence_xvm be run from within a virtualized guest - all it needs is
20 libnspr and libnss and a shared private key (for authentication; we
21 would hate to receive a false positive response from a node not in the
22 cluster!).
23
24
25 II. Fence_virtd - Virtual machine fencing host
26
27 Fence_virtd is a daemon which runs on physical hosts (e.g. in domain0)
28 of the cluster hosting the virtual cluster. It listens on a port
29 for multicast traffic from virtual cluster(s), and takes actions.
30 Multiple disjoint virtual clusters can coexist on a single physical
31 host cluster, but this requires multiple instances of fence_virtd.
32
33 NOTE: fence_virtd *MUST* be run on ALL nodes in a given cluster which
34 will be hosting virtual machines if fence_xvm is to be used for
35 fencing!
36
37 There are a couple of ways the multicast packet is handled,
38 depending on the state of the host OS. It might be hosting the VM,
39 or it might not. Furthermore, the VM might "reside" on a host which
40 has failed.
41
42 In order to be able to guarantee safe fencing of a VM even if the
43 last- known host is down, we must store the last-known locations of
44 each virtual machine in some sort of cluster-wide way. For this, we
45 use the corosync CPG API. Every few seconds, fence_virtd queries the
46 hypervisor via libvirt and stores any local VM states and sends those
47 states over CPG to all other members. In the event of a physical node
48 failure (which consequently causes the failure of one or more guests),
49 we can then read the stored VM state corresponding to the guest we need
50 to fence to find out the previous owner. With that information, we can
51 infer if the known host node has been fenced. If so, then the VM is clean
52 as well. The physical cluster must, therefore, have fencing in order for
53 fence_virtd to work.
54
55 Operation of a node hosting a VM which needs to be fenced:
56
57 (a) Receive multicast packet
58 (b) Authenticate multicast packet
59 (c) Open connection to host contained within multicast
60 packet.
61 (d) Authenticate server.
62 (e) Carry out fencing operation (e.g. call libvirt to destroy or
63 reboot the VM; there is no "on" method at this point).
64 (f) If operation succeeds, send success response.
65
66 Operation of high-node-ID:
67
68 (a) Receive multicast packet
69 (b) Authenticate multicast packet
70 (c) Read VM state from stored CPG messages
71 (d) Check liveliness of nodeID hosting VM (if alive, do nothing)
72 (e) Open connection to host contained within multicast
73 packet.
74 (f) Check with CMAN to see if last-known host has been fenced.
75 (g) If last-known host has been fenced, send success response.
76 (h) Authenticate server & send response.
77
78 NOTE: There is always a possibility that a VM is started again
79 before the fencing operation and CPG update for that VM
80 occurs. If the VM has booted and rejoined the cluster, fencing will
81 not be necessary. If it is in the process of booting, but has not
82 yet joined the cluster, fencing will also not be necessary - because
83 it will not be using cluster resources yet.
84
85
86 III. Security considerations
87
88 While fencing is generally expected to run on a more or less trusted
89 network, there are cases where it may not be.
90
91 * The multicast packet is subject to replay attacks, but because no
92 fencing action is taken based solely on the information contained
93 within the packet, this should not allow an attacker to maliciously
94 fence a VM from outside the cluster, though it may be possible to
95 cause a DoS of fence_virtd if enough multicast packets are sent.
96
97 * The only currently supported authentication mechanisms are simple
98 challenge-response based on a shared private key and pseudorandom
99 number generation.
100
101 * An attacker with access to the shared key(s) can easily fence any
102 known VM, even if they are not on a cluster node.
103
104 * Different shared keys should be used for different virtual
105 clusters on the same subnet (whether in the same physical cluster
106 or not). Additionally, multiple fence_virtd instances must be run
107 (each listening on a different multicast IP + port combination).
108
109 IV. Configuration
110
111 Generate a random key file. An example of how to generate it is:
112
113 dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=4096 count=1
114
115 Distribute the generated key file to all domUs in a cluster as well
116 as all dom0s which will be hosting that particular cluster of domUs.
117 The key should not be placed on shared file systems (because shared
118 file systems require the cluster, which requires fencing...).
119
120 Start fence_virtd on all hosts
121
122 Configure fence_xvm on the domU cluster...
123
124 rest...tbd
125