From: Oguz Bektas <o.bektas@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 container] pct fstrim: add 'ignore-mountpoints' parameter
Date: Thu, 29 Oct 2020 11:09:21 +0100 [thread overview]
Message-ID: <20201029100921.73750-1-o.bektas@proxmox.com> (raw)
parameter to ignore mountpoints when doing fstrim on a container
root@pve:~# pct fstrim 123
/var/lib/lxc/123/rootfs/: 338.7 MiB (355094528 bytes) trimmed
/var/lib/lxc/123/rootfs/test: 8.9 GiB (9576009728 bytes) trimmed
root@pve:~# pct fstrim 123 --ignore-mountpoints
/var/lib/lxc/123/rootfs/: 338.7 MiB (355094528 bytes) trimmed
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
thanks thomas for the review :)
v1->v2:
* change to kebab casing
* add description
* revert the 'warn' change
* use the regex in //
src/PVE/CLI/pct.pm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index df4e9f8..ff02112 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -767,6 +767,11 @@ __PACKAGE__->register_method ({
additionalProperties => 0,
properties => {
vmid => get_standard_option('pve-vmid', { completion => \&PVE::LXC::complete_ctid }),
+ 'ignore-mountpoints' => {
+ description => 'ignore mountpoints when doing an fstrim operation for a container.',
+ optional => 1,
+ type => 'boolean',
+ },
},
},
returns => { type => 'null' },
@@ -785,6 +790,7 @@ __PACKAGE__->register_method ({
PVE::LXC::Config->foreach_volume($conf, sub {
my ($name, $mp) = @_;
$path = $mp->{mp};
+ return if $param->{'ignore-mountpoints'} && $name =~ /^mp\d+/;
my $cmd = ["fstrim", "-v", "$rootdir$path"];
PVE::Tools::run_command($cmd);
});
--
2.20.1
reply other threads:[~2020-10-29 10:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20201029100921.73750-1-o.bektas@proxmox.com \
--to=o.bektas@proxmox.com \
--cc=pve-devel@lists.proxmox.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.