public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Ben Dailey <bdailey@bhmsd.org>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] vma extract force flag
Date: Wed, 24 Apr 2024 16:44:41 -0400	[thread overview]
Message-ID: <CAD5+3sPm1WmhfkimQqkbgP8Nc+LRFhT0kiKK_3151K8LLOg7XQ@mail.gmail.com> (raw)

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


             reply	other threads:[~2024-04-24 20:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24 20:44 Ben Dailey [this message]
2024-04-30  8:26 ` Fiona Ebner
2024-04-30 18:06   ` Ben Dailey

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=CAD5+3sPm1WmhfkimQqkbgP8Nc+LRFhT0kiKK_3151K8LLOg7XQ@mail.gmail.com \
    --to=bdailey@bhmsd.org \
    --cc=pve-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 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