public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-backup] api: create target namespace when moving and it doesn't exist yet
@ 2026-04-24 11:24 Hannes Laimer
  2026-04-24 19:06 ` applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Laimer @ 2026-04-24 11:24 UTC (permalink / raw)
  To: pbs-devel

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* applied: [PATCH proxmox-backup] api: create target namespace when moving and it doesn't exist yet
  2026-04-24 11:24 [PATCH proxmox-backup] api: create target namespace when moving and it doesn't exist yet Hannes Laimer
@ 2026-04-24 19:06 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-04-24 19:06 UTC (permalink / raw)
  To: pbs-devel, Hannes Laimer

On Fri, 24 Apr 2026 13:24:20 +0200, Hannes Laimer wrote:
> 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.

Applied, thanks!

[1/1] api: create target namespace when moving and it doesn't exist yet
      commit: 6c64dc4922b0b541bb01167d50610965ea234717




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-24 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-24 11:24 [PATCH proxmox-backup] api: create target namespace when moving and it doesn't exist yet Hannes Laimer
2026-04-24 19:06 ` applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal