[pve-devel] [PATCH pve-container] allow to load configs from CTs located on other nodes

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Aug 26 15:54:57 CEST 2015



On 08/26/2015 03:36 PM, Thomas Lamprecht wrote:
> This allows load_config to load also configs from LXC container
> which arent't located on the same node.
>
> This is needed to fix the bug that doesn't let view the noVNC
> console from an CT located on another node, whereas viewing it on
> the same node as the container is located works fine.
>
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>   src/PVE/API2/LXC.pm | 2 +-
>   src/PVE/LXC.pm      | 5 +++--
>   2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 8431125..e9bd5a7 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
> @@ -593,7 +593,7 @@ __PACKAGE__->register_method ({
>   	my $remcmd = $remip ?
>   	    ['/usr/bin/ssh', '-t', $remip] : [];
>   
> -	my $conf = PVE::LXC::load_config($vmid);
> +	my $conf = PVE::LXC::load_config($vmid, $node);
>   	my $concmd = PVE::LXC::get_console_command($vmid, $conf);
>   
>   	my $shcmd = [ '/usr/bin/dtach', '-A',
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index 5e21df6..abd6ff0 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -439,9 +439,10 @@ sub config_file {
>   }
>   
>   sub load_config {
> -    my ($vmid) = @_;
> +    my ($vmid, $node) = @_;
>   
> -    my $cfspath = cfs_config_path($vmid);
> +    $node = $nodename if !$node;
> +    my $cfspath = cfs_config_path($vmid, $node);
The vmid as unique identifier should be enough to load the config 
though, independent on which node it lies.
I'll try to rework that.
>   
>       my $conf = PVE::Cluster::cfs_read_file($cfspath);
>       die "container $vmid does not exists\n" if !defined($conf);





More information about the pve-devel mailing list