]> git.proxmox.com Git - pve-container.git/commitdiff
allow/use empty network type
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 6 May 2015 07:50:00 +0000 (09:50 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 6 May 2015 07:50:00 +0000 (09:50 +0200)
src/PVE/LXC.pm

index 1e54ad58c3a8dc718964552da0ecfe953611bc92..c5900b8f75d561d0fc52a130132a58072abf7383 100644 (file)
@@ -179,10 +179,12 @@ sub write_lxc_config {
        $raw .= "$k = $data->{$k}\n";
     }
 
+    my $network_count = 0;
     foreach my $k (sort keys %$data) {
        next if $k !~ m/^net\d+$/;
        $done_hash->{$k} = 1;
        my $net = $data->{$k};
+       $network_count++;
        $raw .= "lxc.network.type = $net->{type}\n";
        foreach my $subkey (sort keys %$net) {
            next if $subkey eq 'type';
@@ -196,6 +198,10 @@ sub write_lxc_config {
        }
     }
 
+    if (!$network_count) {
+       $raw .= "lxc.network.type = empty\n";
+    }
+
     foreach my $k (sort keys %$data) {
        next if $done_hash->{$k};
        die "found un-written value in config - implement this!";
@@ -323,6 +329,7 @@ sub parse_lxc_config {
     &$push_network($network);
 
     foreach my $net (@{$network_list}) {
+       next if $net->{type} eq 'empty'; # skip
        $net->{'veth.pair'} = &$find_next_hostif_name() if !$net->{'veth.pair'};
        $net->{hwaddr} =  PVE::Tools::random_ether_addr() if !$net->{hwaddr};
        die "unsupported network type '$net->{type}'\n" if $net->{type} ne 'veth';