Lines 18-23
esac
Link Here
|
18 |
# default to 500 seconds |
18 |
# default to 500 seconds |
19 |
[ -z ${LIBVIRT_MAXWAIT} ] && LIBVIRT_MAXWAIT=500 |
19 |
[ -z ${LIBVIRT_MAXWAIT} ] && LIBVIRT_MAXWAIT=500 |
20 |
|
20 |
|
|
|
21 |
# default to 5 seconds |
22 |
[ -z ${LIBVIRT_CONWAIT} ] && LIBVIRT_CONWAIT=5 |
23 |
|
24 |
|
21 |
gueststatefile="/var/lib/libvirt/libvirt-guests.state" |
25 |
gueststatefile="/var/lib/libvirt/libvirt-guests.state" |
22 |
netstatefile="/var/lib/libvirt/libvirt-net.state" |
26 |
netstatefile="/var/lib/libvirt/libvirt-net.state" |
23 |
|
27 |
|
Lines 165-180
libvirtd_net_stop() {
Link Here
|
165 |
fi |
169 |
fi |
166 |
} |
170 |
} |
167 |
|
171 |
|
|
|
172 |
libvirtd_connect_wait() { |
173 |
# Does up to LIBVIRT_CONWAIT connect attempts |
174 |
# Fails if cannot connect |
175 |
# Exits as soon as a successful connection is made |
176 |
|
177 |
local hvuri=$1 |
178 |
local counter=${LIBVIRT_CONWAIT} |
179 |
|
180 |
# Since we call virsh directly, repeat the do_virsh check |
181 |
# if unset, default to qemu |
182 |
[ -z ${hvuri} ] && hvuri="qemu:///system" |
183 |
# if only qemu was supplied then correct the value |
184 |
[ "xqemu" = x${hvuri} ] && hvuri="qemu:///system" |
185 |
|
186 |
einfo " Checking connection to ${hvuri} ..." |
187 |
|
188 |
while [ ${counter} -gt 0 ]; do |
189 |
virsh -c ${hvuri} connect &>/dev/null |
190 |
if [ $? -ne 0 ]; then |
191 |
counter=$((${counter} - 1)) |
192 |
printf "." |
193 |
sleep 1 |
194 |
else |
195 |
counter=0 |
196 |
fi |
197 |
done |
198 |
virsh -c ${hvuri} connect &>/dev/null |
199 |
if [ $? -ne 0 ]; then |
200 |
eerror "Failed to connect to '${hvuri}'. Domains may not start." |
201 |
else |
202 |
einfo " Connection to ${hvuri} OK" |
203 |
fi |
204 |
} |
205 |
|
168 |
start() { |
206 |
start() { |
169 |
local uri= |
207 |
local uri= |
170 |
local uuid= |
208 |
local uuid= |
171 |
local name= |
209 |
local name= |
172 |
|
210 |
|
173 |
for uri in ${LIBVIRT_URIS}; do |
211 |
for uri in ${LIBVIRT_URIS}; do |
174 |
do_virsh "${uri}" connect |
212 |
libvirtd_connect_wait ${uri} |
175 |
if [ $? -ne 0 ]; then |
|
|
176 |
eerror "Failed to connect to '${uri}'. Domains may not start." |
177 |
fi |
178 |
done |
213 |
done |
179 |
|
214 |
|
180 |
[ ! -e "${netstatefile}" ] && touch "${netstatefile}" |
215 |
[ ! -e "${netstatefile}" ] && touch "${netstatefile}" |