]> git.proxmox.com Git - vzctl.git/commitdiff
allow to pass absolute paths for ostemplate on create
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 22 Dec 2011 10:58:39 +0000 (11:58 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 22 Dec 2011 11:01:42 +0000 (12:01 +0100)
Makefile
debian/changelog
debian/patches/allow-abs-ostemplate-path.diff [new file with mode: 0644]
debian/patches/series

index 31497c9b145d344573ac4bc0bbe4d602e2d0bf29..06c5d9d70328570d1cce4f89958ab7175217ccbb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 RELEASE=2.0
 
 SVER=3.0.29
-PACKAGERELEASE=3pve7
+PACKAGERELEASE=3pve8
 ARCH=amd64
 
 PACKAGE=vzctl
index bfc6bc3a28230356ca31d0bece6a9f51ece8b629..533a905eea2bfa40f2bf0b1e88aab941d6ecd6fd 100644 (file)
@@ -1,3 +1,9 @@
+vzctl (3.0.29-3pve8) unstable; urgency=low
+
+  * allow to pass absolute paths for ostemplate on create
+
+ -- Proxmox Support Team <support@proxmox.com>  Thu, 22 Dec 2011 11:56:48 +0100
+
 vzctl (3.0.29-3pve7) unstable; urgency=low
 
   * avoid backup error on new installation
diff --git a/debian/patches/allow-abs-ostemplate-path.diff b/debian/patches/allow-abs-ostemplate-path.diff
new file mode 100644 (file)
index 0000000..6e66c33
--- /dev/null
@@ -0,0 +1,64 @@
+Index: new/src/lib/create.c
+===================================================================
+--- new.orig/src/lib/create.c  2011-09-29 11:02:02.000000000 +0200
++++ new/src/lib/create.c       2011-12-22 12:00:55.000000000 +0100
+@@ -83,17 +83,21 @@
+       const char *ext[] = { "", ".gz", ".bz2", ".xz", NULL };
+       const char *errmsg_ext = "[.gz|.bz2|.xz]";
+-      for (i = 0; ext[i] != NULL; i++) {
+-              snprintf(tarball, sizeof(tarball), "%s/%s.tar%s",
+-                              fs->tmpl, tar_nm, ext[i]);
+-              logger(1, 0, "Looking for %s", tarball);
+-              if (stat_file(tarball))
+-                      break;
+-      }
+-      if (ext[i] == NULL) {
+-              logger(-1, 0, "Cached OS template %s/%s.tar%s not found",
+-                              fs->tmpl, tar_nm, errmsg_ext);
+-              return VZ_OSTEMPLATE_NOT_FOUND;
++      if (tar_nm[0] == '/' && stat_file(tar_nm)) {
++              snprintf(tarball, sizeof(tarball), "%s", tar_nm);
++      } else {
++              for (i = 0; ext[i] != NULL; i++) {
++                      snprintf(tarball, sizeof(tarball), "%s/%s.tar%s",
++                               fs->tmpl, tar_nm, ext[i]);
++                      logger(1, 0, "Looking for %s", tarball);
++                      if (stat_file(tarball))
++                              break;
++              }
++              if (ext[i] == NULL) {
++                      logger(-1, 0, "Cached OS template %s/%s.tar%s not found",
++                             fs->tmpl, tar_nm, errmsg_ext);
++                      return VZ_OSTEMPLATE_NOT_FOUND;
++              }
+       }
+       /* Lock CT area */
+       if (make_dir(fs->private, 0))
+@@ -168,6 +172,7 @@
+       char tar_nm[256];
+       char src[STR_SIZE];
+       char dst[STR_SIZE];
++      char *p;
+       const char *sample_config;
+       fs_param *fs = &vps_p->res.fs;
+       tmpl_param *tmpl = &vps_p->res.tmpl;
+@@ -288,7 +293,17 @@
+                               tmpl->ostmpl = full_ostmpl;
+                       }
+               }
+-              snprintf(tar_nm, sizeof(tar_nm), "cache/%s", tmpl->ostmpl);
++              if (tmpl->ostmpl[0] == '/') {
++                      snprintf(tar_nm, sizeof(tar_nm), "%s", tmpl->ostmpl);
++                      if ((p = strrchr(tmpl->ostmpl, '/'))) {
++                              p = strdup(p + 1);
++                              free(tmpl->ostmpl);
++                              tmpl->ostmpl = p;
++                      }
++              } else {
++                      snprintf(tar_nm, sizeof(tar_nm), "cache/%s", tmpl->ostmpl);
++              }
++
+               logger(0, 0, "Creating container private area (%s)",
+                               tmpl->ostmpl);
+               if ((ret = fs_create(veid, fs, tmpl, &vps_p->res.dq, tar_nm)))
index c76e7c6477a2a83983d34e0ef0abc11bfc117fd9..f63fc4ab482017b4f395d3ede4217cffba71e9ff 100644 (file)
@@ -9,3 +9,4 @@ fix-udev-path.diff
 fix-config-path.diff
 no-backup-on-destroy.diff
 fix-init.d-depends.diff
+allow-abs-ostemplate-path.diff