1 |
# $MidnightBSD$ |
2 |
# $FreeBSD: stable/10/etc/devd/hyperv.conf 322129 2017-08-07 02:15:13Z sephe $ |
3 |
# |
4 |
# Hyper-V specific events |
5 |
|
6 |
notify 10 { |
7 |
match "system" "DEVFS"; |
8 |
match "subsystem" "CDEV"; |
9 |
match "type" "CREATE"; |
10 |
match "cdev" "hv_kvp_dev"; |
11 |
action "/usr/sbin/hv_kvp_daemon"; |
12 |
}; |
13 |
|
14 |
notify 10 { |
15 |
match "system" "DEVFS"; |
16 |
match "subsystem" "CDEV"; |
17 |
match "type" "DESTROY"; |
18 |
match "cdev" "hv_kvp_dev"; |
19 |
action "pkill -x hv_kvp_daemon"; |
20 |
}; |
21 |
|
22 |
notify 11 { |
23 |
match "system" "DEVFS"; |
24 |
match "subsystem" "CDEV"; |
25 |
match "type" "CREATE"; |
26 |
match "cdev" "hv_fsvss_dev"; |
27 |
action "/usr/sbin/hv_vss_daemon"; |
28 |
}; |
29 |
|
30 |
notify 11 { |
31 |
match "system" "DEVFS"; |
32 |
match "subsystem" "CDEV"; |
33 |
match "type" "DESTROY"; |
34 |
match "cdev" "hv_fsvss_dev"; |
35 |
action "pkill -x hv_vss_daemon"; |
36 |
}; |
37 |
|
38 |
# |
39 |
# Rules for non-transparent network VF. |
40 |
# |
41 |
# How network VF works with hn(4) on Hyper-V in non-transparent mode: |
42 |
# |
43 |
# - Each network VF has a cooresponding hn(4). |
44 |
# - The network VF and the it's cooresponding hn(4) have the same hardware |
45 |
# address. |
46 |
# - Once the network VF is up, e.g. ifconfig VF up: |
47 |
# o All of the transmission should go through the network VF. |
48 |
# o Most of the reception goes through the network VF. |
49 |
# o Small amount of reception may go through the cooresponding hn(4). |
50 |
# This reception will happen, even if the the cooresponding hn(4) is |
51 |
# down. The cooresponding hn(4) will change the reception interface |
52 |
# to the network VF, so that network layer and application layer will |
53 |
# be tricked into thinking that these packets were received by the |
54 |
# network VF. |
55 |
# o The cooresponding hn(4) pretends the physical link is down. |
56 |
# - Once the network VF is down or detached: |
57 |
# o All of the transmission should go through the cooresponding hn(4). |
58 |
# o All of the reception goes through the cooresponding hn(4). |
59 |
# o The cooresponding hn(4) fallbacks to the original physical link |
60 |
# detection logic. |
61 |
# |
62 |
# All these features are mainly used to help live migration, during which |
63 |
# the network VF will be detached, while the network communication to the |
64 |
# VM must not be cut off. In order to reach this level of live migration |
65 |
# transparency, we use failover mode lagg(4) with the network VF and the |
66 |
# cooresponding hn(4) attached to it. |
67 |
# |
68 |
# To ease user configuration for both network VF and non-network VF, the |
69 |
# lagg(4) will be created by the following rules, and the configuration |
70 |
# of the cooresponding hn(4) will be applied to the lagg(4) automatically. |
71 |
# |
72 |
# NOTE: |
73 |
# If live migration is not needed at all, the following rules could be |
74 |
# commented out, and the network VF interface could be used exclusively. |
75 |
# Most often the cooresponding hn(4) could be completely ignored. |
76 |
# |
77 |
# |
78 |
# Default workflow for the network VF bringup: |
79 |
# 1) ETHERNET/IFATTACH -> VF interface up (delayed by rc.conf hyperv_vf_delay |
80 |
# seconds). This operation will trigger HYPERV_NIC_VF/VF_UP. |
81 |
# 2) HYPERV_NIC_VF/VF_UP: |
82 |
# a) Create laggX coresponding to hnX. |
83 |
# b) Add hnX and VF to laggX. |
84 |
# c) Whack all previous network configuration on hnX, including stopping |
85 |
# dhclient. |
86 |
# d) Apply rc.conf ifconfig_hnX to laggX; i.e. including starting dhclient. |
87 |
# |
88 |
# NOTE: |
89 |
# HYPERV_NIC_VF/VF_UP action script could be customized per-interface by |
90 |
# adding /usr/libexec/hyperv/hyperv_vfup.hnX script. |
91 |
# /usr/libexec/hyperv/hyperv_vfup could be used as the template for the |
92 |
# customized per-interface script. |
93 |
# |
94 |
# NOTE: |
95 |
# For transparent network VF, hyperv_vfattach does nothing and |
96 |
# HYPERV_NIC_VF/VF_UP will not be triggered at all. |
97 |
# |
98 |
|
99 |
notify 10 { |
100 |
match "system" "HYPERV_NIC_VF"; |
101 |
match "type" "VF_UP"; |
102 |
action "/usr/libexec/hyperv/hyperv_vfup $subsystem"; |
103 |
}; |
104 |
|
105 |
notify 10 { |
106 |
match "system" "ETHERNET"; |
107 |
match "type" "IFATTACH"; |
108 |
action "/usr/libexec/hyperv/hyperv_vfattach $subsystem 0"; |
109 |
}; |