3 # ovirt Start ovirt services
7 # Required-Start: ovirt libvirtd
8 # Default-Start: 2 3 4 5
9 # Description: Performs managed node post configuration setup.
12 # Source functions library
13 .
/etc
/init.d
/functions
14 .
/usr
/libexec
/ovirt-functions
17 VAR_SUBSYS_OVIRT_POST
=/var
/lock
/subsys
/$prog
20 # wait for libvirt to finish initializing
23 if virsh connect qemu
:///system
--readonly >/dev
/null
2>&1; then
25 elif [ "$count" == "100" ]; then
26 log
"Libvirt did not initialize in time..."
29 log
"Waiting for libvirt to finish initializing..."
30 count
=$
(expr $count + 1)
34 touch $VAR_SUBSYS_OVIRT_POST
39 ISSUE_NET
=/etc
/issue.net
40 egrep -v "[Vv]irtualization hardware" $ISSUE > $BACKUP
43 hwvirt
=$
(virsh
--readonly capabilities
)
44 if [[ $hwvirt =~ kvm
]]; then
45 log
"Hardware virtualization detected"
47 log
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
48 log
"!!! Hardware Virtualization Is Unavailable !!!"
49 log
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
51 echo "Virtualization hardware is unavailable." >> $ISSUE
53 flags
=$
(cat /proc
/cpuinfo |
grep "^flags")
54 if [[ $flags =~ vmx
]] ||
[[ $flags =~ svm
]]; then
55 echo "(Virtualization hardware was detected but is disabled)" >> $ISSUE
57 echo "(No virtualization hardware was detected on this system)" >> $ISSUE
60 if is_local_storage_configured
; then
62 echo "Please login as 'admin' to configure the node" >> $ISSUE
64 cp -f $ISSUE $ISSUE_NET
66 if is_standalone
; then
70 # persist selected configuration files
74 /etc
/sysconfig
/node-config
75 /etc
/libvirt
/krb5.tab \
76 /etc
/ssh
/ssh_host
*_key
*
78 .
/usr
/libexec
/ovirt-functions
80 # successfull boot from /dev/HostVG/Root
81 if grep -q -w root
=live
:LABEL
=Root
/proc
/cmdline
; then
82 # set first boot entry as permanent default
83 ln -snf /dev
/.initramfs
/live
/grub
/boot
/grub
84 mount
-o rw
,remount LABEL
=Root
/dev
/.initramfs
/live
> /tmp
/grub-savedefault.log
2>&1
85 echo "savedefault --default=0" | grub
>> /tmp
/grub-savedefault.log
2>&1
86 mount
-o ro
,remount LABEL
=Root
/dev
/.initramfs
/live
>> /tmp
/grub-savedefault.log
2>&1
89 # perform any post startup operations
90 case $OVIRT_RUNTIME_MODE in
93 rm -f $VAR_SUBSYS_OVIRT_POST
97 echo -n "Stopping ovirt-post: "
101 reload_ovirt_post
() {
108 [ -f "$VAR_SUBSYS_OVIRT_POST" ] && exit 0
109 echo -n "Starting ovirt-post: "
112 log
"Starting ovirt-post"
114 log
"Completed ovirt-post"
115 } >> $OVIRT_LOGFILE 2>&1
117 test $?
== 0 && success || failure
130 echo "Usage: ovirt-post {start}"