]> git.proxmox.com Git - pve-common.git/blobdiff - data/PVE/INotify.pm
network : add tap_unplug
[pve-common.git] / data / PVE / INotify.pm
index 110e0341b1c7cf106e31eb125f9ee31021b6fb52..850668a0d730bfc3e83a8413b76466cd0e6ced6c 100644 (file)
@@ -685,7 +685,7 @@ sub read_etc_network_interfaces {
 
     if (my $fd2 = IO::File->new("/proc/net/dev", "r")) {
        while (defined ($line = <$fd2>)) {
-           if ($line =~ m/^\s*(eth[0-9]):.*/) {
+           if ($line =~ m/^\s*(eth\d+):.*/) {
                $ifaces->{$1}->{exists} = 1;
            }
        }
@@ -810,7 +810,7 @@ sub read_etc_network_interfaces {
                $ifaces->{$1}->{exists} = 0;
                $d->{exists} = 0;
            }
-       } elsif ($iface =~ m/^eth[0-9]$/) {
+       } elsif ($iface =~ m/^eth\d+$/) {
            $d->{type} = 'eth';
        } elsif ($iface =~ m/^lo$/) {
            $d->{type} = 'loopback';
@@ -957,4 +957,20 @@ register_file('interfaces', "/etc/network/interfaces",
              \&read_etc_network_interfaces,
              \&write_etc_network_interfaces);
 
+
+sub read_iscsi_initiatorname {
+    my ($filename, $fd) = @_;
+
+    while (defined(my $line = <$fd>)) {
+       if ($line =~ m/^InitiatorName=(\S+)$/) {
+           return $1;
+       }
+    }
+
+    return 'undefined';
+}
+
+register_file('initiatorname', "/etc/iscsi/initiatorname.iscsi",  
+             \&read_iscsi_initiatorname);
+
 1;