public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] vma extract force flag
@ 2024-04-24 20:44 Ben Dailey
  2024-04-30  8:26 ` Fiona Ebner
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Dailey @ 2024-04-24 20:44 UTC (permalink / raw)
  To: pve-devel

Would the development team consider a patch like below to add a force flag
to the vma extract command?

diff --git
a/debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch
b/debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch
index 1620a56..931bebc 100644
--- a/debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch
+++ b/debian/patches/pve/0027-PVE-Backup-add-vma-backup-format-code.patch
@@ -1797,7 +1797,7 @@ index 0000000000..347f6283ca
 +        "vma list <filename>\n"
 +        "vma config <filename> [-c config]\n"
 +        "vma create <filename> [-c config] pathname ...\n"
-+        "vma extract <filename> [-d <drive-list>] [-r <fifo>]
<targetdir>\n"
++        "vma extract <filename> [-d <drive-list>] [-r <fifo>] [-f]
<targetdir>\n"
 +        "vma verify <filename> [-v]\n"
 +        ;
 +
@@ -1939,6 +1939,7 @@ index 0000000000..347f6283ca
 +{
 +    int c, ret = 0;
 +    int verbose = 0;
++    int force = 0;
 +    const char *filename;
 +    const char *dirname;
 +    const char *readmap = NULL;
@@ -1957,6 +1958,9 @@ index 0000000000..347f6283ca
 +        case 'd':
 +            drive_list = g_strsplit(optarg, ",", 254);
 +            break;
++        case 'f':
++            force = 1;
++            break;
 +        case 'r':
 +            readmap = optarg;
 +            break;
@@ -1982,7 +1986,7 @@ index 0000000000..347f6283ca
 +        g_error("%s", error_get_pretty(errp));
 +    }
 +
-+    if (mkdir(dirname, 0777) < 0) {
++    if (mkdir(dirname, 0777) < 0 && !force) {
 +        g_error("unable to create target directory %s - %s",
 +                dirname, g_strerror(errno));
 +    }
@@ -2100,7 +2104,13 @@ index 0000000000..347f6283ca
 +        VmaDeviceInfo *di = vma_reader_get_device_info(vmar, i);
 +        if (di && (strcmp(di->devname, "vmstate") == 0)) {
 +            char *statefn = g_strdup_printf("%s/vmstate.bin", dirname);
-+            vmstate_fd = open(statefn, O_WRONLY|O_CREAT|O_EXCL, 0644);
++            int open_flags =O_WRONLY|O_CREAT;
++            if(force) {
++                open_flags |= O_TRUNC;
++            }else{
++                open_flags |= O_EXCL;
++            }
++            vmstate_fd = open(statefn, open_flags, 0644);
 +            if (vmstate_fd < 0) {
 +                g_error("create vmstate file '%s' failed - %s", statefn,
 +                        g_strerror(errno));

I would like to keep extracted backups on an NFS server backed with ZFS and
retain the benefits of differential snapshots and it would be helpful to
have the vma extract replace the previous backups directly.

Thank you for your consideration.

Praise the Lord!
Ben Dailey
Associate Technology Director
Bluffton-Harrison MSD
bdailey@bhmsd.org
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2024-04-30 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 20:44 [pve-devel] vma extract force flag Ben Dailey
2024-04-30  8:26 ` Fiona Ebner
2024-04-30 18:06   ` Ben Dailey

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