* [pve-devel] [PATCH v2 container] pct fstrim: add 'ignore-mountpoints' parameter
@ 2020-10-29 10:09 Oguz Bektas
0 siblings, 0 replies; only message in thread
From: Oguz Bektas @ 2020-10-29 10:09 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-29 10:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 10:09 [pve-devel] [PATCH v2 container] pct fstrim: add 'ignore-mountpoints' parameter Oguz Bektas
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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal