Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 723494 | Differences between
and this patch

Collapse All | Expand All

(-)a/files/libvirt-guests.confd (+9 lines)
Lines 66-68 Link Here
66
# NATed network for you. Valid values: 'yes' or 'no'
66
# NATed network for you. Valid values: 'yes' or 'no'
67
67
68
#LIBVIRT_NET_SHUTDOWN="yes"
68
#LIBVIRT_NET_SHUTDOWN="yes"
69
70
71
# LIBVIRT_CONWAIT
72
# The timeout, in seconds, to wait for a connection to LIBVIRT_URIS
73
# Valid values are any integer greater than or equal to 0
74
# 0 means there will be no wait
75
#
76
#LIBVIRT_CONWAIT=5
77
(-)a/files/libvirt-guests.init-r4 (-4 / +35 lines)
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 attemtpts
174
	# Exits as soon as a successful connection is made
175
176
	local hvuri=$1
177
	local counter=${LIBVIRT_CONWAIT}
178
	local ruri
179
180
	einfo " Checking connection to ${hvuri} ..."
181
182
	while [ ${counter} -gt 0 ] ; do
183
		ruri=$(do_virsh "${hvuri}" uri)
184
		counter=$((${counter} - 1))
185
		if [ "${hvuri}" = "${ruri}" ]; then
186
			counter=0
187
		else
188
			counter=$((${counter} - 1))
189
			printf "."
190
			sleep 1
191
		fi
192
193
	done
194
	ruri=$(do_virsh "${hvuri}" uri)
195
	if [ "${hvuri}" = "${ruri}" ]; then
196
		einfo " Connection to ${hvuri} OK"
197
	else
198
		eerror "Failed to connect to '${hvuri}'. Domains may not start."
199
	fi
200
}
201
168
start() {
202
start() {
169
	local uri=
203
	local uri=
170
	local uuid=
204
	local uuid=
171
	local name=
205
	local name=
172
206
173
	for uri in ${LIBVIRT_URIS}; do
207
	for uri in ${LIBVIRT_URIS}; do
174
		do_virsh "${uri}" connect
208
		libvirtd_connect_wait ${uri}
175
		if [ $? -ne 0 ]; then
176
			eerror "Failed to connect to '${uri}'. Domains may not start."
177
		fi
178
	done
209
	done
179
210
180
	[ ! -e "${netstatefile}" ] && touch "${netstatefile}"
211
	[ ! -e "${netstatefile}" ] && touch "${netstatefile}"

Return to bug 723494