Skip to content

Support listing volumes#1959

Open
jelly wants to merge 2 commits into
cockpit-project:mainfrom
jelly:list-volumes
Open

Support listing volumes#1959
jelly wants to merge 2 commits into
cockpit-project:mainfrom
jelly:list-volumes

Conversation

@jelly
Copy link
Copy Markdown
Member

@jelly jelly commented Jan 10, 2025

Rought mockup with basic volume listing

image

Let's add a basic listing and then delete support.

Tests needed

  • Delete volume
  • Force delete volume
  • Long volume names
  • Unused volume detection
  • Filter on volume names
  • Quadlet volume listing?

As follow up:

  • Show sizes, there is a /system/df endpoint but it needs investigation on why its slow with btrfs graphDriver and other performance concerns
  • Prune unused volumes like images
  • Create volume support in the container page
  • Export volume (download), which begs the question about import support.

Related to: #2342

@jelly jelly added the no-test label Jan 10, 2025
@jelly jelly requested a review from garrett January 10, 2025 17:40
Comment thread src/app.jsx Fixed
@tomasmatus
Copy link
Copy Markdown
Member

I like this, thanks! Another idea I have is to show which containers use the volume. Maybe a popover for the text in the "Used by" column?

@jelly
Copy link
Copy Markdown
Member Author

jelly commented Jan 13, 2025

I like this, thanks! Another idea I have is to show which containers use the volume. Maybe a popover for the text in the "Used by" column?

Right we have this for images!

image

So maybe an expandable makes sense here.

@rare-magma
Copy link
Copy Markdown
Contributor

@jelly this would be a great addition to cockpit-podman, is there anything left to do before merging this PR? I'd be willing to help with implementing the display of the size of the volumes later on.

@Venefilyn Venefilyn self-requested a review August 27, 2025 13:02
@gp-lnuff
Copy link
Copy Markdown

Any update on this?

@Venefilyn
Copy link
Copy Markdown
Member

Venefilyn commented Jan 19, 2026

@jelly wanna rebase?

Let's add a basic listing and then

  • Delete support

  • Showing the size of the volumes

  • Prune volumes

  • Create volume in container

I think we should support these in the same PR. I think the initial work looks good, I'm wondering if we should do anything with volumes without a name, e.g. those created with just podman volume create as-is. It creates a large hash as the name and mount, but can always tackle this after the fact. For now nothing seems off about it

image

@jelly jelly force-pushed the list-volumes branch 2 times, most recently from bee2e7e to 8b8726c Compare February 24, 2026 15:09
Copy link
Copy Markdown
Member

@Venefilyn Venefilyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Couple of comments going through the commits

Comment thread src/app.jsx Outdated
initVolumes(con) {
return client.getVolumes(con)
.then(volumesList => {
console.log(volumesList);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed from the commit

Comment thread src/app.jsx
import ContainerHeader from './ContainerHeader.jsx';
import Containers from './Containers.jsx';
import Images from './Images.jsx';
import Volumes from './Volumes.jsx';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hasn't been added on or before this commit

Comment thread src/VolumeDeleteModal.jsx
<ModalFooter>
<Button id="btn-volme-delete" variant="danger"
onClick={() => handleRemoveVolume()}>
{force ? _("Force delete volume") : _("Delete volume")}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Force is never used atm, state is never modified

Comment thread src/Volumes.jsx Outdated
<FlexItem grow={{ default: 'grow' }}>
<Flex>
<CardTitle>
<h2 className="containers-images-title">{_("Volumes")}</h2>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be

Suggested change
<h2 className="containers-images-title">{_("Volumes")}</h2>
<Content component={ContentVariants.h1} className="containers-volumes-title">{_("Volumes")}</Content>

Currently the heading differs from images and containers. The class name also needs a change

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Comment thread src/Volumes.jsx Outdated
Comment thread src/Volumes.jsx Outdated
Comment thread src/app.jsx
Comment on lines +206 to +209
Object.entries(prevState.volumes || {}).forEach(([id, volume]) => {
if (volume.uid !== con.uid)
copyVolumes[id] = volume;
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems expensive. Can we keep an index of everything we found so far or otherwise not do a heavy Object.entries on existing state?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how our state works for containers, images and now also volumes. However I don't understand your concern here iterating over an array is not that slow in JavaScript and we do need new state (ie an object).

If we want to improve this I am not sure how as I don't understand your proposal, getting the volumes basically resets the state for the current logged in user (uid).

jelly added 2 commits April 17, 2026 17:12
The variable naming is a bit confusing as it is in fact an object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants