<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>}</div><div></div><div>sub set_rootpasswd {</div><div>- my ($privatedir, $opt_rootpasswd) = @_;</div><div>+ my ($opt_rootpasswd, $rootdir) = @_;</div><div></div><div>- my $pwfile = "$privatedir/etc/passwd";</div>
<div>+ my $pwfile = "$rootdir/etc/passwd";</div><div></div><div> return if ! -f $pwfile;</div><div></div><div>- my $shadow = "$privatedir/etc/shadow";</div><div>+ my $shadow = "$rootdir/etc/shadow";</div>
<div></div><div> if ($opt_rootpasswd !~ m/^\$/) {</div><div><span class="" style="white-space:pre"> </span>my $time = substr (Digest::SHA::sha1_base64 (time), 0, 8);</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 class="" style="white-space:pre"> </span>}</div><div></div><div><span class="" style="white-space:pre"> </span> } else {</div><div>-<span class="" style="white-space:pre"> </span>PVE::Tools::file_set_contents($basecfg_fn, $rawconf);</div>
<div>-<span class="" style="white-space:pre"> </span>my $cmd = ['vzctl', '--skiplock', 'create', $vmid,</div><div>-<span class="" style="white-space:pre"> </span> '--ostemplate', $archive, '--private', $private];</div>
<div>-<span class="" style="white-space:pre"> </span>run_command($cmd);</div><div>-<span class="" style="white-space:pre"> </span></div><div>-<span class="" style="white-space:pre"> </span># hack: vzctl '--userpasswd' starts the CT, but we want</div>
<div>-<span class="" style="white-space:pre"> </span># to avoid that for create</div><div>-<span class="" style="white-space:pre"> </span>PVE::OpenVZ::set_rootpasswd($private, $password)</div><div>-<span class="" style="white-space:pre"> </span> if defined($password);</div>
<div>+<span class="" style="white-space:pre"> </span> PVE::Tools::file_set_contents($basecfg_fn, $rawconf);</div><div>+<span class="" style="white-space:pre"> </span> my $cmd = ['vzctl', '--skiplock', 'create', $vmid,</div>
<div>+<span class="" style="white-space:pre"> </span> '--ostemplate', $ostmp, '--private', $private];</div><div>+<span class="" style="white-space:pre"> </span> run_command($cmd);</div>
<div>+<span class="" style="white-space:pre"> </span> my $rootdir = PVE::OpenVZ::get_rootdir($conf, $vmid);</div><div>+</div><div>+<span class="" style="white-space:pre"> </span> $cmd = ['/usr/sbin/vzctl', '--skiplock', 'mount', $vmid];</div>
<div>+<span class="" style="white-space:pre"> </span> run_command($cmd);</div><div>+<span class="" style="white-space:pre"> </span> die "Cannot mount $vmid" if !PVE::OpenVZ::check_mounted($conf, $vmid);</div>
<div>+</div><div>+<span class="" style="white-space:pre"> </span> # hack: vzctl '--userpasswd' starts the CT, but we want</div><div>+<span class="" style="white-space:pre"> </span> # to avoid that for create</div>
<div>+<span class="" style="white-space:pre"> </span> PVE::OpenVZ::set_rootpasswd($password, $rootdir)</div><div>+<span class="" style="white-space:pre"> </span> if defined($password);</div><div>+</div>
<div>
+<span class="" style="white-space:pre"> </span> $cmd = ['/usr/sbin/vzctl', '--skiplock', 'umount', $vmid];</div><div>+<span class="" style="white-space:pre"> </span> run_command($cmd);</div>
<div><span class="" style="white-space:pre"> </span> }</div><div></div><div><span class="" style="white-space:pre"> </span> PVE::AccessControl::add_vm_to_pool($vmid, $pool) if $pool;</div></div><div><br></div></div>
<div class="gmail_extra"><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 class="im">> Of course, we can use "vzctl mount", but then functionset_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>-- <br>๓ ีืมึลฮษลอ, ๛ลำิมหฯื ้วฯาุ<br>๓ลิุ ฤมิม-รลฮิาฯื "๓ลฬลหิลฬ"
</div>