All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Riemer <sebastian.riemer@profitbricks.com>
To: LVM general discussion and development <linux-lvm@redhat.com>
Subject: Re: [linux-lvm] Allocation Policy for Cloud Computing needed
Date: Tue, 21 Feb 2012 10:34:18 +0100	[thread overview]
Message-ID: <4F43651A.1000505@profitbricks.com> (raw)
In-Reply-To: <20120220215911.GJ6331@barkeeper1-xen.linbit>

On 20/02/12 22:59, Lars Ellenberg wrote:
>> Or does someone want to implement this together with me?
> 
> I would certainly be here for discussions.
> 
> Though, as you always will be more flexible with scripts than with
> pre-implemented fixed algorithms, I probably would first check if I can
> solve it with some scripting.
> [completely untested, but you get the idea]
> 
> #!/bin/bash
> export LANG=C LC_ALL=C
> name=$1 vg=$2 size_in_MiB=$3
> PVS=$(vgs --nohead --unit m -o pv_name,pv_free -O -pv_free,pv_name $vg |
> 	awk -v need=$size_in_MiB '{ print $1; sum += $2;
> 	if (sum >= need) exit; }')
> lvcreate -n $name -L ${size_in_MiB}m $vg $PVS
> 
> (similar for lvextend)
> 
> Which basically implements this allocation policy:
> use the pvs with most free space available,
> and no more than necessary.
> 
> If I understand you correctly, that would almost do what you asked for.

Yes, this really helps. I've also thought about allocating the LVs
directly to distinct PVs. Thanks for the confirmation.

> You can get pretty complex in similar scripts, if you really want to...
> consider using
>   pvs -o vg_name,lv_name,pv_name,pvseg_start,pvseg_size,seg_pe_ranges
> and explicitly listing not only the PVS, but even the PE ranges to your
> lvcreate commands...

Thank you very much for your response.

Regards,
Sebastian

      parent reply	other threads:[~2012-02-21  9:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16 13:50 [linux-lvm] Allocation Policy for Cloud Computing needed Sebastian Riemer
2012-02-16 14:41 ` James Hawtin
2012-02-16 15:27   ` Sebastian Riemer
2012-02-20 21:59 ` Lars Ellenberg
2012-02-20 22:41   ` Ray Morris
2012-02-21  9:48     ` Sebastian Riemer
2012-02-21  9:34   ` Sebastian Riemer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F43651A.1000505@profitbricks.com \
    --to=sebastian.riemer@profitbricks.com \
    --cc=linux-lvm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.