Mailing List Archive

Node Disk Cleaning Script
Hi!
I hope this script will usefull for somebody.

#!/bin/bash
cd /var/lib/nova/instances
find -name "disk*" | xargs -n1 qemu-img info | grep backing | sed
-e's/.*file: //' -e 's/ .*//' | sort | uniq > /tmp/ignore
while read i; do
ARGS="$ARGS \( ! -path $i \) "
done < /tmp/ignore
find /var/lib/nova/instances/_base/ -type f $ARGS -delete
Re: Node Disk Cleaning Script [ In reply to ]
On 08/02/2012 12:12 PM, Алексей Кайтаз wrote:
> Hi!
> I hope this script will usefull for somebody.
>
> #!/bin/bash
> cd /var/lib/nova/instances
> find -name "disk*" | xargs -n1 qemu-img info | grep backing | sed -e's/.*file: //' -e 's/ .*//' | sort | uniq > /tmp/ignore
> while read i; do
> ARGS="$ARGS \( ! -path $i \) "
> done < /tmp/ignore
> find /var/lib/nova/instances/_base/ -type f $ARGS -delete

This is done automatically by nova when you enable this in /etc/nova/nova.conf

remove_unused_base_images = True

That is done in Fedora/EPEL packages for the last while,
and will default on in the next folsom release.

cheers,
Pádraig.

_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to : openstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openstack
More help : https://help.launchpad.net/ListHelp
Re: Node Disk Cleaning Script [ In reply to ]
Pádraig, thanks.

That I need.

2012/8/2 Pádraig Brady <P@draigbrady.com>

> On 08/02/2012 12:12 PM, Алексей Кайтаз wrote:
> > Hi!
> > I hope this script will usefull for somebody.
> >
> > #!/bin/bash
> > cd /var/lib/nova/instances
> > find -name "disk*" | xargs -n1 qemu-img info | grep backing | sed
> -e's/.*file: //' -e 's/ .*//' | sort | uniq > /tmp/ignore
> > while read i; do
> > ARGS="$ARGS \( ! -path $i \) "
> > done < /tmp/ignore
> > find /var/lib/nova/instances/_base/ -type f $ARGS -delete
>
> This is done automatically by nova when you enable this in
> /etc/nova/nova.conf
>
> remove_unused_base_images = True
>
> That is done in Fedora/EPEL packages for the last while,
> and will default on in the next folsom release.
>
> cheers,
> Pádraig.
>