]> git.proxmox.com Git - pve-container.git/blobdiff - src/lxc-pve-poststop-hook
clone: randomize network MAC HW address of clone
[pve-container.git] / src / lxc-pve-poststop-hook
index a4302d6bbf13f3efc4cbd01c79d2032c9063d0d5..654aa268780c977a9e37b83c9b299162fa1d91a9 100755 (executable)
@@ -77,13 +77,17 @@ __PACKAGE__->register_method ({
            # In order to make sure hot-plugged config changes aren't reverted
            # to what the monitor initially loaded we need to stop the container
            # and restart it.
-           # Update the config and queue a restart of the lxc@$vmid task, note
-           # that we must not block because we're part of the service cgroup
-           # systemd waits for to die before issuing the new lxc-start command.
+           # Update the config and queue a restart of the pve-container@$vmid
+           # task, note that we must not block because we're part of the
+           # service cgroup systemd waits for to die before issuing the new
+           # lxc-start command.
            PVE::LXC::update_lxc_config($vmid, $conf);
-           PVE::Tools::run_command(['systemctl', '--no-block', 'restart', "lxc\@$vmid"]);
+           # Tell the post-stop hook we want to be restarted.
+           open(my $fh, '>', "/var/lib/lxc/$vmid/reboot")
+               or die "failed to create reboot trigger file: $!\n";
+           close($fh);
            # cause lxc to stop instead of rebooting
-           POSIX::_exit(1);
+           exit(1);
        }
 
        return undef;