all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup] api: create target namespace when moving and it doesn't exist yet
Date: Fri, 24 Apr 2026 13:24:20 +0200	[thread overview]
Message-ID: <20260424112420.207317-1-h.laimer@proxmox.com> (raw)

So the behaviour is the same what a normal `mv` would do. What still
stays required is the existance of the parent to which the namespace is
moved.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
noticed while doing some testing, though it works, i think having it
create not-existing target namespaces makes sense

 pbs-datastore/src/datastore.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 6cb1c5ec..292c56bf 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1200,8 +1200,9 @@ impl DataStore {
         if !self.namespace_exists(source_ns) {
             bail!("source namespace '{source_ns}' does not exist");
         }
-        if !target_ns.is_root() && !self.namespace_exists(target_ns) {
-            bail!("target namespace '{target_ns}' does not exist");
+        let target_parent = target_ns.parent();
+        if !target_ns.is_root() && !self.namespace_exists(&target_parent) {
+            bail!("target parent namespace '{target_parent}' does not exist");
         }
         if source_ns.contains(target_ns).is_some() {
             bail!(
-- 
2.47.3





             reply	other threads:[~2026-04-24 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24 11:24 Hannes Laimer [this message]
2026-04-24 19:06 ` applied: [PATCH proxmox-backup] api: create target namespace when moving and it doesn't exist yet Thomas Lamprecht

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=20260424112420.207317-1-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pbs-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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal