[pve-devel] [PATCH v3 container 1/2] Fix #1924: add snapshot parameter

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jan 23 07:23:49 CET 2019


On 1/22/19 5:27 PM, Rhonda D'Vine wrote:
> The config CLI command offer the config and showcmd functions. The
> output of that may vary with respect to a given snapshot. This adds a
> switch that shows the corresponding snapshot's config.
> 
> Also add debian/SOURCE to debian/docs for installation into the package.

but this has nothing to do with this patch? Patched should be contained to
logical changes and not mix various, especially code and package changes.

> 
> Signed-off-by: Rhonda D'Vine <rhonda at proxmox.com>
> ---
>  debian/control             |  2 +-
>  debian/docs                |  1 +
>  src/PVE/API2/LXC/Config.pm | 19 +++++++++++++++++++
>  3 files changed, 21 insertions(+), 1 deletion(-)
>  create mode 100644 debian/docs
> 
> diff --git a/debian/control b/debian/control
> index 15f42ad..5a1e9eb 100644
> --- a/debian/control
> +++ b/debian/control
> @@ -4,7 +4,7 @@ Priority: extra
>  Maintainer: Proxmox Support Team <support at proxmox.com>
>  Build-Depends: debhelper (>= 7.0.50~),
>                 libpve-common-perl,
> -               libpve-guest-common-perl | libpve-common-perl (<= 4.0-89),
> +               libpve-guest-common-perl (>= 2.0-19),
>                 libpve-storage-perl,
>                 libtest-mockmodule-perl,
>                 lxc (>= 3.0.2-1) | lxc-pve (>= 3.0.1+pve1-1),
> diff --git a/debian/docs b/debian/docs
> new file mode 100644
> index 0000000..8696672
> --- /dev/null
> +++ b/debian/docs
> @@ -0,0 +1 @@
> +debian/SOURCE
> diff --git a/src/PVE/API2/LXC/Config.pm b/src/PVE/API2/LXC/Config.pm
> index 1ba0ffd..b69db12 100644
> --- a/src/PVE/API2/LXC/Config.pm
> +++ b/src/PVE/API2/LXC/Config.pm
> @@ -35,6 +35,14 @@ __PACKAGE__->register_method({
>  	properties => {
>  	    node => get_standard_option('pve-node'),
>  	    vmid => get_standard_option('pve-vmid', { completion => \&PVE::LXC::complete_ctid }),
> +            snapshot => get_standard_option('pve-snapshot-name', {
> +                description => "Fetch config values from given snapshot.",
> +                optional => 1,
> +                completion => sub {
> +                    my ($cmd, $pname, $cur, $args) = @_;
> +                    PVE::LXC::Config->snapshot_list($args->[0]);
> +                },
> +            }),
>  	},
>      },
>      returns => {
> @@ -57,6 +65,17 @@ __PACKAGE__->register_method({
>  
>  	my $conf = PVE::LXC::Config->load_config($param->{vmid});
>  
> +	my $snapname = $param->{snapshot};
> +	if ($snapname) {
> +	    my $snapshot = $conf->{snapshots}->{$snapname};
> +	    die "snapshot '$snapname' does not exist\n"
> +		if !defined($snapshot);
> +
> +	    # we need the digest of the file
> +	    $snapshot->{digest} = $conf->{digest};
> +	    $conf = $snapshot;
> +	}
> +
>  	delete $conf->{snapshots};
>  
>  	return $conf;
> 





More information about the pve-devel mailing list