[Ovirt-devel] [PATCH node][RFC] Remove dependencies on /dev/disk/by-label entries
Mike Burns
mburns at redhat.com
Tue Mar 23 23:04:13 UTC 2010
This depends on the previous patch for uninstall fixes. There is a
known issue with these that we aren't able to unmount the Logging
volume. I hope to have this debugged and fixed soon.
On Tue, 2010-03-23 at 19:00 -0400, Mike Burns wrote:
> Use findfs LABEL=ABC and mount LABEL=ABC instead.
>
> Signed-off-by: Mike Burns <mburns at redhat.com>
> ---
> scripts/ovirt-config-boot | 29 ++++++++++++++++-------------
> scripts/ovirt-config-storage | 2 --
> scripts/ovirt-functions | 18 ++++++++++--------
> 3 files changed, 26 insertions(+), 23 deletions(-)
>
> diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
> index ac43daa..b1fd469 100755
> --- a/scripts/ovirt-config-boot
> +++ b/scripts/ovirt-config-boot
> @@ -29,14 +29,21 @@ ovirt_boot_setup() {
> local disk2
> local partN=-1
> log "installing the image."
> - if [ -h /dev/disk/by-label/Boot ]; then
> + local found_boot=false
> + if findfs LABEL=Boot 2>&1 >/dev/null ; then
> + found_boot=true
> + grub_dev_label=Boot
> + elif findfs LABEL=Root 2>&1 >/dev/null ; then
> + found_boot=true
> + grub_dev_label=Root
> + fi
> + if $found_boot; then
> mount_boot
> mountpoint /boot
> if [ $? -ne 0 ] ; then
> log "Boot partition not available"
> return 1
> fi
> - grub_dev_label="Boot"
> # Grab OVIRT_ISCSI VARIABLES from boot partition for upgrading
> # file created only if OVIRT_ISCSI_ENABLED=y
> if [ -f /boot/ovirt ]; then
> @@ -50,7 +57,7 @@ ovirt_boot_setup() {
> fi
>
> # check that /boot mounted ok and find partition number for GRUB
> - get_part_info $(readlink -f /dev/disk/by-label/$grub_dev_label disk partN
> + get_part_info $(readlink -f $(findfs LABEL=$grub_dev_label 2>/dev/null) disk partN
> rc=$?
> if [ $rc -ne 0 -o $partN -lt 0 ]; then
> log "unable to determine Root partition"
> @@ -67,11 +74,11 @@ ovirt_boot_setup() {
>
> # prepare Root partition update
> candidate=
> - if [ -e /dev/disk/by-label/RootBackup ]; then
> + if findfs LABEL=RootBackup 2>&1 >/dev/null; then
> candidate=RootBackup
> - elif [ -e /dev/disk/by-label/RootUpdate ]; then
> + elif findfs LABEL=RootUpdate 2>&1 >/dev/null; then
> candidate=RootUpdate
> - elif [ -e /dev/disk/by-label/RootNew ]; then
> + elif findfs LABEL=RootNew 2>&1 >/dev/null; then
> candidate=RootNew
> fi
> if [ -z "$candidate" ]; then
> @@ -80,7 +87,7 @@ ovirt_boot_setup() {
> umount /liveos
> rc=0
> else
> - candidate_dev=$(readlink -f /dev/disk/by-label/$candidate)
> + candidate_dev=$(findfs LABEL=$candidate 2>/dev/null)
> e2label $candidate_dev RootNew
> rc=$?
> fi
> @@ -90,7 +97,7 @@ ovirt_boot_setup() {
> return $rc
> fi
>
> - mount $candidate_dev /liveos
> + mount $candidate_dev /liveos/
>
> rm -rf /liveos/LiveOS
> mkdir -p /liveos/LiveOS
> @@ -212,11 +219,7 @@ if [ $rc -eq 0 -a "$doreboot" = "yes" ]; then
> ovirt_store_firstboot_config
> stop_log
>
> - if [ "$OVIRT_ISCSI_ENABLED" != "y" ]; then
> - reboot
> - else
> - /sbin/reboot
> - fi
> + reboot
> fi
> stop_log
> exit $rc
> diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
> index c6473a6..93b94b0 100755
> --- a/scripts/ovirt-config-storage
> +++ b/scripts/ovirt-config-storage
> @@ -703,8 +703,6 @@ perform_partitioning()
> log "Creating volume group"
> vgcreate /dev/HostVG "${partpv}"
>
> - mkdir -p /dev/disk/by-label
> -
> if [ "$SWAP_SIZE" -gt 0 ]; then
> log "Creating swap partition"
> lvcreate --name Swap --size ${SWAP_SIZE}M /dev/HostVG
> diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
> index b98e31a..482441a 100644
> --- a/scripts/ovirt-functions
> +++ b/scripts/ovirt-functions
> @@ -283,7 +283,7 @@ mount_liveos() {
> return 0
> fi
> mkdir -p /liveos
> - mount /dev/disk/by-label/Root /liveos
> + mount LABEL=Root /liveos
> }
>
> # mount config partition
> @@ -326,7 +326,7 @@ mount_boot() {
> return 0
> fi
> mkdir -p /boot
> - mount /dev/disk/by-label/Boot /boot
> + mount LABEL=Root /boot
> }
> # stop any service which keeps /var/log busy
> # keep the list of services
> @@ -709,12 +709,14 @@ lvremove() {
> # cleanup before reboot
> reboot() {
> cd /
> - # setup new Root if update is prepared
> - if [ -e "/dev/disk/by-label/RootUpdate" ]; then
> - root_update_dev=$(readlink -f /dev/disk/by-label/RootUpdate)
> - root_dev=$(readlink -f /dev/disk/by-label/Root)
> - e2label $root_dev RootBackup
> - e2label $root_update_dev Root
> + if [ "$OVIRT_ISCSI_ENABLED" = "yes" ]; then
> + # setup new Root if update is prepared
> + if findfs LABEL=RootUpdate 2>&1 >/dev/null; then
> + root_update_dev=$(findfs LABEL=RootUpdate 2>/dev/null)
> + root_dev=$(findfs LABEL=Root 2>/dev/null)
> + e2label $root_dev RootBackup
> + e2label $root_update_dev Root
> + fi
> fi
> # run post-install hooks
> # e.g. to avoid reboot loops using Cobbler PXE only once
More information about the ovirt-devel
mailing list