Perry Myers
2009-Jan-16 19:58 UTC
[Ovirt-devel] [PATCH node] BZ479378: Provide the user an option to mount the logging partition during the initial configuration of logging
From: Bryan Kearney <bkearney at redhat.com> Signed-off-by: Bryan Kearney <bkearney at redhat.com> Signed-off-by: Perry Myers <pmyers at redhat.com> --- scripts/ovirt-config-logging | 20 ++++++++++++++++++++ scripts/ovirt-functions | 27 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging index c57c229..ae104a0 100755 --- a/scripts/ovirt-config-logging +++ b/scripts/ovirt-config-logging @@ -7,6 +7,25 @@ RSYSLOG_FILE="/etc/rsyslog.conf" +function enable_local_logging { + if grep -q "/dev/mapper/HostVG-Logging " /proc/mounts; then + return 0 + else + while true; do + printf "\n" + read -p "Would you like to enable logging to the local disk? (Y/N)? " + r=$(echo $REPLY|tr '[[:lower:]]' '[[:upper:]]') + if [ "$r" == "Y" ]; then + mount_logging + return + elif [ "$r" == "N" ]; then + printf "\nNot mounting the local disk. All logs will be lost\n" + return + fi + done + fi +} + # Creates the rsyslog file based on the following inputs # $1 ipaddress of remote syslog server # $2 port of remote syslog server @@ -178,6 +197,7 @@ if [ "$1" = "AUTO" ]; then fi else prompt_user + enable_local_logging fi exit 0 diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index 26dc556..8df2fce 100644 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -193,6 +193,33 @@ mount_config() { fi } +# mount logging partition +mount_logging() { + if grep -q "/dev/mapper/HostVG-Logging " /proc/mounts; then + return 0 + fi + + if [ -e /dev/HostVG/Logging ] ; then + # backup the logs + if [ -e /var/log.bak ]; then + rm -rf /var/log.bak + fi + cp -a /var/log /var/log.bak + + mount /dev/HostVG/Logging /var/log + restorecon -rv /var/log + mv /var/log.bak/* /var/log + rm -Rf /var/log.bak + service rsyslog restart + + return 0 + else + # /var/log is not available + printf "\nThe logging partion has not been created. Please create it at the main menu.\n" + return 1 + fi +} + # augtool wrapper # workaround for bind-mounted files # see https://fedorahosted.org/augeas/ticket/32 -- 1.6.0.6
Darryl L. Pierce
2009-Jan-16 20:29 UTC
[Ovirt-devel] [PATCH node] BZ479378: Provide the user an option to mount the logging partition during the initial configuration of logging
On Fri, Jan 16, 2009 at 02:58:26PM -0500, Perry Myers wrote:> From: Bryan Kearney <bkearney at redhat.com> > > Signed-off-by: Bryan Kearney <bkearney at redhat.com> > Signed-off-by: Perry Myers <pmyers at redhat.com>ACK. -- Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc. Virtual Machine Management - http://www.ovirt.org/ "What do you care what other people think, Mr. Feynman?" -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: not available URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090116/e4a12c47/attachment.sig>