[Ovirt-devel] [PATCH ovirt-node] standalone mode - configure local storage (DESTRUCTIVE)

Daniel P. Berrange berrange at redhat.com
Fri Nov 7 15:10:47 UTC 2008


On Fri, Nov 07, 2008 at 02:27:45AM +0100, Alan Pevec wrote:
> From: Darryl L. Pierce <dpierce at redhat.com>
> 
> ---
>  scripts/ovirt-config-storage |  112 ++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 112 insertions(+), 0 deletions(-)
> 
> diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
> index 8b13789..91d50de 100755
> --- a/scripts/ovirt-config-storage
> +++ b/scripts/ovirt-config-storage
> @@ -1 +1,113 @@
> +#!/bin/bash
> +#
> +# All sizes are in gigabytes
>  
> +DRIVE=$(sfdisk -s | awk '/\/dev\/([sh]da)/ {  match($0, "^(.*):.*", data); printf data[1] }')

This won't work on HP machines where you have disks named with 
the crack-smoking /dev/cciss/... scheme

Really you should ask HAL for the list of block devices because
it knows about all types of storage, and you can explicitly
distinguish physical devices from device mapper. Ideally use
python or something to talk to HAL over DBus, or if you really
want to use shell scripts you can probaly do something evil
with 'lshal'.

Or (soon) you can use libvirt hard device enum code.

> +BOOT_SIZE=1
> +INSTALL_SIZE=10
> +CONFIG_SIZE=5
> +LOGGING_SIZE=2
> +
> +MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/ { print $2 }')

libvirt gives you a nice API for doing this, or use 'virsh nodeinfo'

> +                # Boot partition
> +                # /dev/sda1 = Boot partition
> +                # /dev/sda2 = Swap partition

Swap should be an LVM lv too - only /boot needs to be on the raw
partition.

> +                # /dev/sda4 = LVM
> +                echo -e "n\np\n1\n\n+$(( $BOOT_SIZE * 1024))M\na\n1\n
> +                         n\np\n2\n\n+$(( $SWAP_SIZE * 1024))M\nt\n2\n82\n
> +                         n\np\n4\n\n\nt\n4\n8e\n
> +                         w\n" | fdisk $DRIVE
> +                pvcreate /dev/sda4
> +                vgcreate /dev/VolGroup00 /dev/sda4

Avoid calling it VolGroup00 because this makes it almost certain that you'll
clash with names used inside guests becasue VolGroup00 is anaconda default
naming. I typically use 'HostVG' for a host.

> +
> +                lvcreate --name Ovirt   /dev/VolGroup00 --size ${INSTALL_SIZE}G

I'd suggest 'Root' instead of 'Ovirt' since it better reflects what it
is.

> +                lvcreate --name Config  /dev/VolGroup00 --size ${CONFIG_SIZE}G
> +                lvcreate --name Logging /dev/VolGroup00 --size ${LOGGING_SIZE}G
> +
> +                mkfs -t ext3 /dev/sda1
> +                mkfs -t ext3 /dev/VolGroup00/Ovirt
> +                mkfs -t ext3 /dev/VolGroup00/Config
> +                mkfs -t ext3 /dev/VolGroup00/Logging

You should use  mke2fs instead and set a filesystem label matching the VG name,
allowing for mount-by-label.  Also run 'tune2fs' to set max-mount-counts=0
and interval-between-checks=0 to disable the automatic fsck. If error behaviour
isn't set to 'remount-ro'automatically, that should be set too, perhaps even to
'panic'


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the ovirt-devel mailing list