[pve-devel] Create template from CT

Daniel Hunsaker danhunsaker at gmail.com
Sun Mar 2 23:09:37 CET 2014


Yes, at http://pve.proxmox.com/wiki/Developer_Documentation ; to "compile"
the Ext.js code, simply run make (all it does is concatenate the various
.js files together in an intelligent order).

Immediate feedback:

"createtemplate" is a tad on the long side for an API endpoint, and
somewhat redundant if being used via pvesh.  POST requests imply create,
and RESTful API design generally frowns on verbs in endpoint names, so I'd
shorten it to just "template".

It should be possible to remove network devices from a CT prior to
conversion instead of throwing an error, then re-add them once template
creation is complete.  It might also be good to ensure that certain other
files/settings which shouldn't be rolled into a template are omitted (.ssh
directories, root password shadow file entries, and so forth), which can
either be tricky or simple depending on how you approach it, and the
files/settings in question.  We *can* rely on users to think of these
things, but it's generally a bad idea since the average user, even of
something as specialized os Proxmox, doesn't have enough background in the
underlying technologies to reliably think of these things on their own.
 Principle of least surprise has always been a good guideline for user
support, so the more of this we can automate, the better.  (Besides, how
tedious to have to manually remove network entries every time you update a
template, only to have to re-add them before making further updates...)

This isn't strictly required (or necessarily advised), but you could also
automate CT stop/start as part of the process.  This would require a
statement to the effect of "The container will be shutdown for the duration
of this process.  Are you sure you want to continue?" in the web UI.  The
issue here, though, is that API users don't get confirmation requests, so
this may be undesired.  A sensible alternative would be to use
suspend/resume (patch submitted yesterday for this) instead of stop/start,
but the CT still needs to be offline for the duration of the operation,
which still might be undesired in some cases.

On that note...  Might it make sense to convert a *backup* into a template?
 The snapshot mode involves no downtime, and manipulating archive contents
is simple enough with how tar works.  Just run a vzdump of the selected CT
with snapshot and gzip selected, then manipulate the contents of the backup
into an OpenVZ template.  The conversion step would probably be best
implemented in a separate tool, which would also take care of intelligently
removing unwanted files/settings.  (According to this [
http://forum.proxmox.com/archive/index.php/t-1403.html], you can just
rename the backup to conform with template naming rules, place it in the
cache directory, and you're good, but this doesn't remove sensitive files,
and omits a file or two used at the beginning of regular OpenVZ templates
to describe the template itself, so may not be quite what you're looking
for.)  I haven't seen any evidence that such a tool exists already, but it
might be useful to provide upstream to the OpenVZ team.

Anyway, that's just my feedback as a fellow contributor.  Looking forward
to others' feedback on this.

- Daniel Hunsaker
Owner / Developer
Lei's Genesis Experiment: Code For The Future!


On Sun, Mar 2, 2014 at 2:11 PM, James A. Coyle
<james.coyle at jamescoyle.net>wrote:

> Hi all,
>
> I have made a few changes to the web GUI to add a new option under the
> container context menu to make a template from a stopped container and
> wanted to know if you would consider including it in the main distribution?
>
> I don't know how to compile the code from your git repo for testing so I
> have modified the built code directly on a Proxmox install. I have
> attached the code but I'm not sure how useful it will be to you as it's not
> in git diff format. Do you have any docs on making changes to the code from
> the git repo and submitting patches correctly?
>
> James Coyle
>
> M:+44 (0) 7809 895 392
> E: james.coyle at jamescoyle.net
> Skype: jac2703
> Gtalk: jac2703 at gmail.com
> www: www.jamescoyle.net
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20140302/1a74abc5/attachment.htm>


More information about the pve-devel mailing list