]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
snapshot: Fix snapshot delete/prune command
authorEric Bollengier <eric@baculasystems.com>
Wed, 18 May 2022 13:17:53 +0000 (15:17 +0200)
committerEric Bollengier <eric@baculasystems.com>
Fri, 27 May 2022 08:31:53 +0000 (10:31 +0200)
bacula/src/filed/fd_snapshot.c
bacula/src/tools/bsnapshot.c

index aa3d5ea2576dff855d9dc39a587d02aba2d64c7b..4f83f0a66dc98fcb46fa462951f9982d040e9c31 100644 (file)
@@ -925,7 +925,7 @@ public:
    int del() {
       int ret = 0;
       arg_parser cmd;
-      if (!*Name || !*Volume || !created) {
+      if (!*Name || !*Volume) {
          goto bail_out;
       }
       ret = do_command("delete", &cmd);
index 4947d6ada3526d44747b738b24f69939a0f2e2f9..8c7a62e87622edfac5de6c2198f70f2ce0de6fbb 100644 (file)
@@ -143,8 +143,8 @@ static bool makedir(char *path)
 static char *strip_tz(char *line)
 {
    if (line) {
-      /* The format returned by LVM is 2022-05-18 09:17:41 +0000, we use TZ= to keep it UTC */
-      char *p = strstr(line, " +0000");
+      /* The format returned by LVM is 2022-05-18 09:17:41 +0000 */
+      char *p = strstr(line, " +");
       if (p) {
          *p = 0;
       }
@@ -1771,7 +1771,7 @@ public:
       /* TODO: Need to get the volume name and add the snapshot
        * name at the end 
        */
-      MmsgD5(10, cmd, "%s TZ= lvcreate -s -n \"%s_%s\" -L %lldb \"%s\"", 
+      MmsgD5(10, cmd, "%s lvcreate -s -n \"%s_%s\" -L %lldb \"%s\"", 
            arg->sudo, name, arg->name, size, arg->device);
       if (run_program(cmd, 60, errmsg)) {
          Dmsg(10, "Unable to create snapshot %s %s\n", arg->name, errmsg);
@@ -1798,8 +1798,8 @@ public:
       strip_tz(ts);
       t = str_to_utime(ts);
 
-      Dmsg(10, "status=1 volume=\"%s_%s\" createtdate=\"%s\" type=lvm\n",
-           arg->device, arg->name, edit_uint64(t, ed1));
+      Dmsg(10, "status=1 volume=\"%s_%s\" createtdate=\"%s\" createdate=\"%s\" type=lvm\n",
+           arg->device, arg->name, edit_uint64(t, ed1), ts);
       printf("status=1 volume=\"%s_%s\" createtdate=\"%s\" type=lvm\n",
              arg->device, arg->name, edit_uint64(t, ed1));
       return 1;
@@ -1990,7 +1990,7 @@ public:
    };
 
    bool parse_vgs_output() {
-      MmsgD1(10, cmd, "%s TZ= vgs -o vg_all --separator=; --units b --nosuffix", arg->sudo);
+      MmsgD1(10, cmd, "%s vgs -o vg_all --separator=; --units b --nosuffix", arg->sudo);
       if (vgs) {
          free_header(vgs, vgs_nbelt);
          vgs_nbelt=0;
@@ -2003,7 +2003,7 @@ public:
    };
 
    bool parse_lvs_output() {
-      MmsgD1(10, cmd, "%s TZ= lvs -o lv_all --separator=; --units b --nosuffix", arg->sudo);
+      MmsgD1(10, cmd, "%s lvs -o lv_all --separator=; --units b --nosuffix", arg->sudo);
       if (lvs) {
          free_header(lvs, lvs_nbelt);
          lvs_nbelt=0;