]> git.proxmox.com Git - pve-firewall.git/blob - PVE/Firewall.pm
start example code
[pve-firewall.git] / PVE / Firewall.pm
1 package PVE::Firewall;
2
3 use warnings;
4 use strict;
5 use Data::Dumper;
6
7 use PVE::QemuServer;
8
9 # we need complete VM configuration of all VMs (openvz/qemu)
10 # in vmdata
11
12 sub compile {
13 my ($vmdata) = @_;
14
15 my $netinfo;
16
17 foreach my $vmid (keys %{$vmdata->{qemu}}) {
18 $netinfo->{$vmid} = {};
19 my $conf = $vmdata->{qemu}->{$vmid};
20 foreach my $opt (keys %$conf) {
21 next if $opt !~ m/^net(\d+)$/;
22 my $net = PVE::QemuServer::parse_net($conf->{$opt});
23 next if !$net;
24 $netinfo->{$vmid} = $net;
25 }
26 }
27
28 print Dumper($netinfo);
29
30 }
31
32 sub activate {
33
34 }
35
36
37 1;