Darryl L. Pierce
2009-May-20 16:20 UTC
[Ovirt-devel] [PATCH node] Adds support for a core dump partition to the node.
Creates an additional LV, CoreDump. This LV, if present, is mounted at
/var/log/core. Its default size is 10240 MB (10G) and has a minimum size
of 1024 MB.
Additionally, the default log partition size was changed from 256 MB to
2048 MB (2G).
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
scripts/ovirt-config-storage | 23 ++++++++++++++++++-----
scripts/ovirt-early | 9 +++++----
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index 815c8e0..8d550ea 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -1,7 +1,7 @@
#!/bin/bash
#
# To automate the partitioning, pass in the specific fields in this order
-# ovirt-config-storage [swap size] [boot size] [root size] [logging size] [data
size]
+# ovirt-config-storage [swap size] [boot size] [root size] [logging size] [core
dump size] [data size]
#
# All sizes are in megabytes
#
@@ -25,7 +25,8 @@ default_overcommit=0.5
default_boot_size=50
default_root_size=256
default_config_size=5
-default_logging_size=256
+default_logging_size=2048
+default_coredump_size=10240
# -1 indicates data partition should use remaining disk
default_data_size=-1
@@ -33,6 +34,7 @@ boot_min_size=50
root_min_size=256
config_min_size=5
logging_min_size=5
+coredump_min_size=1024
data_min_size=5
swap_min_size=5
@@ -73,7 +75,7 @@ check_partition_sizes()
disk_size=$SPACE
need_size=$(echo "scale=0;" \
"$BOOT_SIZE + $SWAP_SIZE + $ROOT_SIZE * 2" \
- "+ $CONFIG_SIZE + $LOGGING_SIZE +
$min_data_size" | bc -l)
+ "+ $CONFIG_SIZE + $LOGGING_SIZE + $COREDUMP_SIZE +
$min_data_size" | bc -l)
if [ $need_size -gt $disk_size ]; then
local gap_size=$(echo "scale=0; $need_size-$disk_size;" | bc
-l)
@@ -186,7 +188,7 @@ do_configure()
printf " partition should use up the remaining space on the
disk.\n\n"
local space_left=$SPACE
- for part in boot swap root config logging data ; do
+ for part in boot swap root config logging coredump data ; do
part_regexp="^0$"
if [ "$part" = "data" ]; then
part_regexp="^\-1|0$"
@@ -234,6 +236,7 @@ set /files$OVIRT_DEFAULTS/OVIRT_VOL_SWAP_SIZE $SWAP_SIZE
set /files$OVIRT_DEFAULTS/OVIRT_VOL_ROOT_SIZE $ROOT_SIZE
set /files$OVIRT_DEFAULTS/OVIRT_VOL_CONFIG_SIZE $CONFIG_SIZE
set /files$OVIRT_DEFAULTS/OVIRT_VOL_LOGGING_SIZE $LOGGING_SIZE
+set /files$OVIRT_DEFAULTS/OVIRT_VOL_COREDUMP_SIZE $COREDUMP_SIZE
set /files$OVIRT_DEFAULTS/OVIRT_VOL_DATA_SIZE $DATA_SIZE
EOF
}
@@ -248,7 +251,7 @@ do_review()
local data_size_display="$DATA_SIZE MB"
if [ "$DATA_SIZE" = -1 ]; then
local remaining_mb=$(( $SPACE - $BOOT_SIZE - $SWAP_SIZE \
- - $ROOT_SIZE * 2 - $CONFIG_SIZE - $LOGGING_SIZE ))
+ - $ROOT_SIZE * 2 - $CONFIG_SIZE - $LOGGING_SIZE -
$COREDUMP_SIZE ))
data_size_display="$remaining_mb MB"
fi
@@ -263,6 +266,7 @@ The local disk will be repartitioned as follows:
Installation partition size: $ROOT_SIZE * 2 MB
Configuration partition size: $CONFIG_SIZE MB
Logging partition size: $LOGGING_SIZE MB
+ Core dump partition size: $COREDUMP_SIZE MB
Data partition size: $data_size_display
EOF
@@ -381,6 +385,14 @@ perform_partitioning()
tune2fs -c 0 -i 0 /dev/HostVG/Logging
echo "/dev/HostVG/Logging /var/log ext3 defaults 0 0"
>> /etc/fstab
fi
+ if [ "$COREDUMP_SIZE" -gt 0 ]; then
+ log "Creating core dump partition"
+ lvcreate --name CoreDump --size ${COREDUMP_SIZE}M /dev/HostVG
+ mke2fs -j /dev/HostVG/CoreDump -L "COREDUMP"
+ tune2fs -c 0 -i 0 /dev/HostVG/CoreDump
+ mkdir -p /var/log/core
+ echo "/dev/HostVG/CoreDump /var/log/core ext3 defaults 0 0" >>
/etc/fstab
+ fi
local use_data=1
if [ "$DATA_SIZE" -eq -1 ]; then
@@ -486,6 +498,7 @@ BOOT_SIZE=${OVIRT_VOL_BOOT_SIZE:-$default_boot_size}
ROOT_SIZE=${OVIRT_VOL_ROOT_SIZE:-$default_root_size}
CONFIG_SIZE=${OVIRT_VOL_CONFIG_SIZE:-$default_config_size}
LOGGING_SIZE=${OVIRT_VOL_LOGGING_SIZE:-$default_logging_size}
+COREDUMP_SIZE=${OVIRT_VOL_COREDUMP_SIZE:-$default_coredump_size}
DATA_SIZE=${OVIRT_VOL_DATA_SIZE:-$default_data_size}
if [ -n "$OVIRT_INIT" ]; then
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index ac54e4b..b11b85d 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -129,7 +129,7 @@ start() {
# oVirt boot parameters
# BOOTIF=link|eth*|<MAC> (appended by pxelinux)
# ovirt_init=[usb|scsi[:serial#]|/dev/...]
- # ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:DATA_MB
+ #
ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:COREDUMP_MB:DATA_MB
# ovirt_overcommit=<overcommit_ratio>
# ovirt_local_boot
# ovirt_standalone
@@ -166,13 +166,14 @@ start() {
# w/o value - grab the first disk (/dev/?da)
init
- # ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:DATA_MB
+ #
ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:COREDUMP_MB:DATA_MB
# local partition sizes in MB
vol_boot_size vol_swap_size vol_root_size vol_config_size
vol_logging_size+ vol_coredump_size # data size can be set to 0 to
disable data partition, -1 to use
# remaining free space after the other above partitions are defined
# or a specific positive number in MB
@@ -294,7 +295,7 @@ start() {
;;
ovirt_vol=*)
i=${i#ovirt_vol=}
- eval $(printf $i|awk -F: '{print "vol_boot_size="$1;
print "vol_swap_size="$2; print "vol_root_size="$3; print
"vol_config_size="$4; print "vol_logging_size="$5; print
"vol_data_size="$6;}')
+ eval $(printf $i|awk -F: '{print "vol_boot_size="$1;
print "vol_swap_size="$2; print "vol_root_size="$3; print
"vol_config_size="$4; print "vol_logging_size="$5; print
"vol_coredump_size="$6; print "vol_data_size="$7;}')
;;
ovirt_local_boot*)
local_boot=1
@@ -361,7 +362,7 @@ start() {
ip_gateway=$gateway
fi
# save boot parameters as defaults for ovirt-config-*
- params="bootif init vol_boot_size vol_swap_size vol_root_size
vol_config_size vol_logging_size vol_data_size local_boot standalone overcommit
ip_address ip_netmask ip_gateway ipv6 dns ntp syslog_server syslog_port
collectd_server collectd_port bootparams hostname firstboot"
+ params="bootif init vol_boot_size vol_swap_size vol_root_size
vol_config_size vol_logging_size vol_coredump_size vol_data_size local_boot
standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp
syslog_server syslog_port collectd_server collectd_port bootparams hostname
firstboot"
# mount /config unless firstboot is forced
if [ "$firstboot" != "1" ]; then
mount_config
--
1.6.0.6
Darryl L. Pierce
2009-May-20 21:04 UTC
[Ovirt-devel] Bindmount instead of a new file system...
This patch overrides the previous one, which created a new logical volume for storing core dumps. Instead, we'll bindmount /var/log/cores/ from /data/cores/ and take advantage of that intentionally larger partition.
Darryl L. Pierce
2009-May-20 21:04 UTC
[Ovirt-devel] [PATCH node] Adds support for a core dump partition to the node.
If a /data partition is created, then a subdirectory is created,
/data/cores. This directory is then bindmounted along with /data.
Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
scripts/ovirt-config-storage | 4 +++-
scripts/ovirt-functions | 4 ++++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index 815c8e0..3d8163b 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -25,7 +25,7 @@ default_overcommit=0.5
default_boot_size=50
default_root_size=256
default_config_size=5
-default_logging_size=256
+default_logging_size=2048
# -1 indicates data partition should use remaining disk
default_data_size=-1
@@ -398,7 +398,9 @@ perform_partitioning()
tune2fs -c 0 -i 0 /dev/HostVG/Data
echo "/dev/HostVG/Data /data ext3 defaults 0 0" >>
/etc/fstab
echo "/data/images /var/lib/libvirt/images bind bind 0 0"
>> /etc/fstab
+ echo "/data/cores /var/log/cores bind bind 0 0" >> /etc/fstab
log "Mounting data partition"
+ mkdir -p /var/log/cores
mount_data
fi
diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index 4d81193..095d433 100755
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -378,6 +378,10 @@ mount_data() {
mount /var/lib/libvirt/images
restorecon -rv /var/lib/libvirt/images
+ mkdir -p /data/cores
+ mount /var/log/cores
+ restorecon -rv /var/log/cores
+
return 0
else
# /data is not available
--
1.6.0.6
Reasonably Related Threads
- [PATCH] RFC: Advanced Storage Configuration
- [PATCH] Provides an explicit upgrade path for an installed node.
- [PATCH] add netconsole autoinstall parameter
- [PATCH node] Adds a new kernel cmdline argument to toggle SSH password auth.
- [PATCH] RFC: Encrypted swap support