<div dir="ltr">What about this patch?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 28, 2013 at 1:31 PM, éÇÏÒØ ûÅÓÔÁËÏ× <span dir="ltr"><<a href="mailto:shine@selectel.ru" target="_blank">shine@selectel.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Done.<div><br></div><div><div>diff --git a/PVE/OpenVZ.pm b/PVE/OpenVZ.pm</div><div>index a16d4fc..7788f66 100644</div>
<div>--- a/PVE/OpenVZ.pm</div><div>+++ b/PVE/OpenVZ.pm</div><div>@@ -1244,13 +1244,13 @@ sub replacepw {</div><div class="im">
<div>š}</div><div>š</div><div>šsub set_rootpasswd {</div><div>- š šmy ($privatedir, $opt_rootpasswd) = @_;</div></div><div>+ š šmy ($opt_rootpasswd, $rootdir) = @_;</div><div class="im"><div>š</div><div>- š šmy $pwfile = "$privatedir/etc/passwd";</div>
</div><div>+ š šmy $pwfile = "$rootdir/etc/passwd";</div><div class="im"><div>š</div><div>š š šreturn if ! -f $pwfile;</div><div>š</div><div>- š šmy $shadow = "$privatedir/etc/shadow";</div></div><div>
+ š šmy $shadow = "$rootdir/etc/shadow";</div><div class="im">
<div>š</div><div>š š šif ($opt_rootpasswd !~ m/^\$/) {</div></div><div class="im"><div>š<span style="white-space:pre-wrap"> </span>my $time = substr (Digest::SHA::sha1_base64 (time), 0, 8);</div></div></div><div><br></div>
<div><br></div><div><br>
</div><div><div>diff --git a/PVE/API2/OpenVZ.pm b/PVE/API2/OpenVZ.pm</div><div>index 06fe60b..60ef124 100644</div><div>--- a/PVE/API2/OpenVZ.pm</div><div>+++ b/PVE/API2/OpenVZ.pm</div><div>@@ -406,15 +406,23 @@ __PACKAGE__->register_method({</div>
<div>š<span style="white-space:pre-wrap"> </span>}</div><div>š</div><div>š<span style="white-space:pre-wrap"> </span> š š} else {</div><div>-<span style="white-space:pre-wrap"> </span>PVE::Tools::file_set_contents($basecfg_fn, $rawconf);</div>
<div>-<span style="white-space:pre-wrap"> </span>my $cmd = ['vzctl', '--skiplock', 'create', $vmid,</div><div>-<span style="white-space:pre-wrap"> </span> š '--ostemplate', $archive, '--private', $private];</div>
<div>-<span style="white-space:pre-wrap"> </span>run_command($cmd);</div><div>-<span style="white-space:pre-wrap"> </span></div><div>-<span style="white-space:pre-wrap"> </span># hack: vzctl '--userpasswd' starts the CT, but we wantš</div>
<div>-<span style="white-space:pre-wrap"> </span># to avoid that for create</div><div class="im"><div>-<span style="white-space:pre-wrap"> </span>PVE::OpenVZ::set_rootpasswd($private, $password)š</div></div><div>-<span style="white-space:pre-wrap"> </span> š šif defined($password);</div>
<div>+<span style="white-space:pre-wrap"> </span> š š š šPVE::Tools::file_set_contents($basecfg_fn, $rawconf);</div><div>+<span style="white-space:pre-wrap"> </span> š š š šmy $cmd = ['vzctl', '--skiplock', 'create', $vmid,</div>
<div>+<span style="white-space:pre-wrap"> </span> š š š š š š š š š '--ostemplate', $ostmp, '--private', $private];</div><div>+<span style="white-space:pre-wrap"> </span> š š š šrun_command($cmd);</div>
<div>+<span style="white-space:pre-wrap"> </span> š š š šmy $rootdir = PVE::OpenVZ::get_rootdir($conf, $vmid);</div><div>+</div><div>+<span style="white-space:pre-wrap"> </span> š š š š$cmd = ['/usr/sbin/vzctl', '--skiplock', 'mount', $vmid];</div>
<div>+<span style="white-space:pre-wrap"> </span> š š š šrun_command($cmd);</div><div>+<span style="white-space:pre-wrap"> </span> š š š šdie "Cannot mount $vmid" if !PVE::OpenVZ::check_mounted($conf, $vmid);</div>
<div>+</div><div>+<span style="white-space:pre-wrap"> </span> š š š š# hack: vzctl '--userpasswd' starts the CT, but we want</div><div>+<span style="white-space:pre-wrap"> </span> š š š š# to avoid that for create</div>
<div>+<span style="white-space:pre-wrap"> </span> š š š šPVE::OpenVZ::set_rootpasswd($password, $rootdir)</div><div>+<span style="white-space:pre-wrap"> </span> š š š š š šif defined($password);</div><div>+</div><div>
+<span style="white-space:pre-wrap"> </span> š š š š$cmd = ['/usr/sbin/vzctl', '--skiplock', 'umount', $vmid];</div><div>+<span style="white-space:pre-wrap"> </span> š š š šrun_command($cmd);</div>
<div>š<span style="white-space:pre-wrap"> </span> š š}</div><div>š</div><div>š<span style="white-space:pre-wrap"> </span> š šPVE::AccessControl::add_vm_to_pool($vmid, $pool) if $pool;</div></div><div><br></div></div>
<div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Mon, Oct 28, 2013 at 12:20 PM, Dietmar Maurer <span dir="ltr"><<a href="mailto:dietmar@proxmox.com" target="_blank">dietmar@proxmox.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>> Of course, we can use "vzctl mount", but then functionšset_rootpasswd must be<br>
> rewrited to use "vzctl mount" for simfs too.<br>
<br>
</div>I guess that is the correct way to implement it.<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><div class="im">-- <br>ó Õ×ÁÖÅÎÉÅÍ, ûÅÓÔÁËÏ× éÇÏÒØ<br>óÅÔØ ÄÁÔÁ-ÃÅÎÔÒÏ× "óÅÌÅËÔÅÌ"
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>ó Õ×ÁÖÅÎÉÅÍ, ûÅÓÔÁËÏ× éÇÏÒØ<br>óÅÔØ ÄÁÔÁ-ÃÅÎÔÒÏ× "óÅÌÅËÔÅÌ"
</div>