[pve-devel] applied: [PATCH firewall] simulator: make lxc/qemu optional
Wolfgang Bumiller
w.bumiller at proxmox.com
Mon Feb 6 12:00:42 CET 2017
applied and added another missing hunk for qemu-server
On Tue, Jan 31, 2017 at 11:15:22AM +0100, Wolfgang Bumiller wrote:
> ---
> in order to be able to bootstrap the package (eg. for stretch)
> (copypasted as-is from Firewall.pm)
>
> src/PVE/FirewallSimulator.pm | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/FirewallSimulator.pm b/src/PVE/FirewallSimulator.pm
> index c924b41..fc53a9b 100644
> --- a/src/PVE/FirewallSimulator.pm
> +++ b/src/PVE/FirewallSimulator.pm
> @@ -6,8 +6,20 @@ use Data::Dumper;
> use PVE::Firewall;
> use File::Basename;
> use Net::IP;
> -use PVE::LXC;
> -use PVE::QemuServer;
> +
> +# dynamically include PVE::QemuServer and PVE::LXC
> +# to avoid dependency problems
> +my $have_qemu_server;
> +eval {
> + require PVE::QemuServer;
> + $have_qemu_server = 1;
> +};
> +
> +my $have_lxc;
> +eval {
> + require PVE::LXC;
> + $have_lxc = 1;
> +};
>
> my $mark;
> my $trace;
> @@ -530,6 +542,7 @@ sub simulate_firewall {
> $from_info->{iface} = 'tapXYZ';
> $start_state = 'from-bport';
> } elsif ($from =~ m/^ct(\d+)$/) {
> + return 'SKIPPED' if !$have_lxc;
> my $vmid = $1;
> $from_info = extract_ct_info($vmdata, $vmid, 0);
> $start_state = 'fwbr-out';
> @@ -563,10 +576,12 @@ sub simulate_firewall {
> $target->{bridge} = 'vmbr0';
> $target->{iface} = 'tapXYZ';
> } elsif ($to =~ m/^ct(\d+)$/) {
> + return 'SKIPPED' if !$have_lxc;
> my $vmid = $1;
> $target = extract_ct_info($vmdata, $vmid, 0);
> $target->{iface} = $target->{tapdev};
> } elsif ($to =~ m/^vm(\d+)$/) {
> + return 'SKIPPED' if !$have_qemu_server;
> my $vmid = $1;
> $target = extract_vm_info($vmdata, $vmid, 0);
> $target->{iface} = $target->{tapdev};
> --
> 2.11.0
More information about the pve-devel
mailing list