]>
git.proxmox.com Git - pve-network.git/blob - PVE/Network/Transport.pm
1 package PVE
::Network
::Transport
;
6 use PVE
::Cluster
qw(cfs_read_file cfs_write_file cfs_lock_file);
7 use PVE
::Network
::Plugin
;
8 use PVE
::Network
::VlanPlugin
;
9 use PVE
::Network
::VxlanMulticastPlugin
;
11 PVE
::Network
::VlanPlugin-
>register();
12 PVE
::Network
::VxlanMulticastPlugin-
>register();
13 PVE
::Network
::Plugin-
>init();
16 sub transport_config
{
17 my ($cfg, $transportid, $noerr) = @_;
19 die "no transport ID specified\n" if !$transportid;
21 my $scfg = $cfg->{ids
}->{$transportid};
22 die "transport '$transportid' does not exists\n" if (!$noerr && !$scfg);
29 return cfs_read_file
("network/transports.cfg");
35 cfs_write_file
("network/transports.cfg", $cfg);
38 sub lock_transport_config
{
39 my ($code, $errmsg) = @_;
41 cfs_lock_file
("network/transports.cfg", undef, $code);
44 $errmsg ?
die "$errmsg: $err" : die $err;
51 return keys %{$cfg->{ids
}};
54 sub complete_transport
{
55 my ($cmdname, $pname, $cvalue) = @_;
57 my $cfg = PVE
::Network
::Transport
::config
();
59 return $cmdname eq 'add' ?
[] : [ PVE
::Network
::Transport
::transports_ids
($cfg) ];