[pve-devel] [PATCH] HA resources check before destroying lxc
Alen Grizonic
a.grizonic at proxmox.com
Fri Aug 28 15:07:27 CEST 2015
The code in PVE::HA::Config::vm_is_ha_managed assumes that the LXC
insertion in the HA resources file
/etc/pve/ha/resources.cfg starts with vm: so if we decide to change the
insert to ct:, some code has to be added!
On 08/28/2015 03:03 PM, Alen Grizonic wrote:
> ---
> src/PVE/API2/LXC.pm | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 35f2c24..303f0ce 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
> @@ -532,6 +532,10 @@ __PACKAGE__->register_method({
>
> my $storage_cfg = cfs_read_file("storage.cfg");
>
> + if (PVE::HA::Config::vm_is_ha_managed($vmid)) {
> + die "unable to delete CT $vmid - used in HA resources\n";
> + }
> +
> my $code = sub {
> # reload config after lock
> $conf = PVE::LXC::load_config($vmid);
More information about the pve-devel
mailing list