[Openstack] Removing unused images using Glance APIs

Narayanan, Krishnaprasad narayana at uni-mainz.de
Thu Nov 14 09:57:58 UTC 2013


To be precise enough, you are referring to "Images" table in Glance database. Is this correct?
I also see an image_properties table that has a column "deleted" and ID.

From: Razique Mahroua [mailto:razique.mahroua at gmail.com]
Sent: Donnerstag, 14. November 2013 09:55
To: Narayanan, Krishnaprasad
Cc: openstack at lists.openstack.org
Subject: Re: [Openstack] Removing unused images using Glance APIs


Ok, so you can deleted safely the unused ones with the SQL commands.
As for the physical files on the server (usually /var/lib/glance/images), you need to check that against the Glance database:
select UUID where deleted =1
You will retrieve a list of unused UUIDs, and these files can be removed as well

Razique

On 14 Nov 2013, at 0:06, Narayanan, Krishnaprasad wrote:

By removing unused images, I mean here is the extra images in the image store which were supposed to be deleted but they still exist. I want to persist the images that are connected to active instances and base images using which snapshots were created.

-----Original Message-----
From: Razique Mahroua [mailto:razique.mahroua at gmail.com<mailto:razique.mahroua at gmail.com>]
Sent: Donnerstag, 14. November 2013 04:08
To: Narayanan, Krishnaprasad
Cc: openstack at lists.openstack.org<mailto:openstack at lists.openstack.org>
Subject: Re: [Openstack] Removing unused images using Glance APIs

But didn't you wanted to remove the unused images in the first place?
if so, then running the SQL commands I gave you will help you to find unused images :)

On 13 Nov 2013, at 16:43, Narayanan, Krishnaprasad wrote:

If I want to retain the base image for launching new VMs, then I may
lose them. So how do I retain it?

-----Original Message-----
From: Razique Mahroua [mailto:razique.mahroua at gmail.com<mailto:razique.mahroua at gmail.com>]
Sent: Donnerstag, 14. November 2013 01:16
To: Narayanan, Krishnaprasad
Cc: openstack at lists.openstack.org<mailto:openstack at lists.openstack.org>
Subject: Re: [Openstack] Removing unused images using Glance APIs

Same :)
as long as the snapshot is created (make sure it's finished though!)
then you don't need the base image

On 13 Nov 2013, at 16:15, Narayanan, Krishnaprasad wrote:

What happens if there is an snaspshot created but there are no
instances launched?

From: Razique Mahroua [mailto:razique.mahroua at gmail.com<mailto:razique.mahroua at gmail.com>]
Sent: Donnerstag, 14. November 2013 01:11
To: Narayanan, Krishnaprasad
Cc: openstack at lists.openstack.org<mailto:openstack at lists.openstack.org>
Subject: Re: [Openstack] Removing unused images using Glance APIs

Volumes snap depends on the active instance, that means you don't
need
the base image afterwards.
Just check all actives instances
select * from instances where deleted <> 1
OR :
select image_id from instances where deleted = 0

Razique

On 13 Nov 2013, at 15:47, Narayanan, Krishnaprasad wrote:

Hi

If I understand it correctly, this addresses the active instances and
its images. Can I know how one should take care of instance and
volume
snapshots?

Thanks,
Krishnaprasad
From: Razique Mahroua
[mailto:razique.mahroua at gmail.com<mailto:razique.mahroua at gmail.com>razique.mahroua at gmail.com<mailto:razique.mahroua at gmail.com>]
Sent: Mittwoch, 13. November 2013 14:40
To: Narayanan, Krishnaprasad
Cc:
openstack at lists.openstack.org<mailto:openstack at lists.openstack.org>openstack at lists.openstack.org<mailto:openstack at lists.openstack.org>
Subject: Re: [Openstack] Removing unused images using Glance APIs

Hi. I think there is not any API for that unfortunately....
But there is a field into the database that indicates the image ID.
So
if you select all active instances and select the unique images ID
entries, you can compare them against the Glance images. A BASH
script
should be sufficient.

Razique

On Wednesday, November 13, 2013, Narayanan, Krishnaprasad wrote:
Hallo All,

In our testbed we have Openstack ESSEX. I am in the process of
cleaning up the image store. Can I know are there any APIs in Glance
or Nova that can help me in this process?

Thanks,
Krishnaprasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20131114/25a8f320/attachment.html>


More information about the Openstack mailing list