[pve-devel] [PATCH container] api: clone: improve error message

Fiona Ebner f.ebner at proxmox.com
Fri Jan 23 11:04:29 CET 2026


The old message suggests that the container doesn't have any
snapshots, which might not be true. While at it, improve the style by
avoiding the multi-line post-if.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/API2/LXC.pm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 3d74f71..7841215 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -2039,9 +2039,10 @@ __PACKAGE__->register_method({
                         $rpcenv->check($authuser, "/storage/$sid", ['Datastore.AllocateSpace']);
 
                         if ($full) {
-                            die
-                                "Cannot do full clones on a running container without snapshots\n"
-                                if $running && !defined($snapname);
+                            if ($running && !defined($snapname)) {
+                                die "Full clone of a running container is only possible from a"
+                                    . " snapshot\n";
+                            }
                             $fullclone->{$opt} = 1;
                         } else {
                             # not full means clone instead of copy
-- 
2.47.3





More information about the pve-devel mailing list