[SOLVED] Does not create MAC when adding IP Address

hi,



it shouldn't cause any problems (everything should still work)



hasn't been packaged yet.



/usr/share/perl5/PVE/LXC/Config.pm


Thank you. Is it enough to add and register the following commands at the bottom of the file?



src/PVE/LXC/Config.pm | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 2699d3d..7e51b8d 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1211,6 +1211,7 @@ sub vmconfig_hotplug_pending {
} elsif ($opt =~ m/^net(\d+)$/) {
my $netid = $1;
my $net = $class->parse_lxc_network($value);
+ $value = $class->print_lxc_network($net);
PVE::LXC::update_net($vmid, $conf, $opt, $net, $netid, $rootdir);
} elsif ($opt eq 'memory' || $opt eq 'swap') {
if (!$hotplug_memory_done) { # don't call twice if both opts are passed
@@ -1297,6 +1298,10 @@ sub vmconfig_apply_pending {
if !$class->is_volume_in_use($conf, $conf->{$opt}, 1, 1);
}
}
+ } elsif ($opt =~ m/^net(\d+)$/) {
+ my $netid = $1;
+ my $net = $class->parse_lxc_network($conf->{pending}->{$opt});
+ $conf->{pending}->{$opt} = $class->print_lxc_network($net);
}
};
if (my $err = $@) {
 
no. it's a patch so it won't work that way. download the attachment to your host.

copy this in a file:

Code:
---
src/PVE/LXC/Config.pm | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 2699d3d..7e51b8d 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1211,6 +1211,7 @@ sub vmconfig_hotplug_pending {
         } elsif ($opt =~ m/^net(\d+)$/) {
         my $netid = $1;
         my $net = $class->parse_lxc_network($value);
+        $value = $class->print_lxc_network($net);
         PVE::LXC::update_net($vmid, $conf, $opt, $net, $netid, $rootdir);
         } elsif ($opt eq 'memory' || $opt eq 'swap') {
         if (!$hotplug_memory_done) { # don't call twice if both opts are passed
@@ -1297,6 +1298,10 @@ sub vmconfig_apply_pending {
                 if !$class->is_volume_in_use($conf, $conf->{$opt}, 1, 1);
             }
         }
+        } elsif ($opt =~ m/^net(\d+)$/) {
+        my $netid = $1;
+        my $net = $class->parse_lxc_network($conf->{pending}->{$opt});
+        $conf->{pending}->{$opt} = $class->print_lxc_network($net);
         }
     };
     if (my $err = $@) {
--
2.20.1

let's say mac.patch


then go to the directory /usr/share/perl5/PVE/LXC/ and apply it with: patch -N -i mac.txt. if it asks which file to patch, type Config.pm and it should work.

Code:
patching file Config.pm
Hunk #1 succeeded at 1210 (offset -1 lines).
Hunk #2 succeeded at 1297 (offset -1 lines).

EDIT: looks like the indentation isn't preserved correctly when pasting into the forum, so it doesn't apply when copy pasted from here... you should copy it from https://pve.proxmox.com/pipermail/pve-devel/2019-November/040143.html starting with --- and ending with 2.20.1

i added it as an attachment
 

Attachments

  • mac.txt
    984 bytes · Views: 1
Last edited:
no. it's a patch so it won't work that way. download the attachment to your host.

copy this in a file:

Code:
---
src/PVE/LXC/Config.pm | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 2699d3d..7e51b8d 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1211,6 +1211,7 @@ sub vmconfig_hotplug_pending {
         } elsif ($opt =~ m/^net(\d+)$/) {
         my $netid = $1;
         my $net = $class->parse_lxc_network($value);
+        $value = $class->print_lxc_network($net);
         PVE::LXC::update_net($vmid, $conf, $opt, $net, $netid, $rootdir);
         } elsif ($opt eq 'memory' || $opt eq 'swap') {
         if (!$hotplug_memory_done) { # don't call twice if both opts are passed
@@ -1297,6 +1298,10 @@ sub vmconfig_apply_pending {
                 if !$class->is_volume_in_use($conf, $conf->{$opt}, 1, 1);
             }
         }
+        } elsif ($opt =~ m/^net(\d+)$/) {
+        my $netid = $1;
+        my $net = $class->parse_lxc_network($conf->{pending}->{$opt});
+        $conf->{pending}->{$opt} = $class->print_lxc_network($net);
         }
     };
     if (my $err = $@) {
--
2.20.1

let's say mac.patch


then go to the directory /usr/share/perl5/PVE/LXC/ and apply it with: patch -N -i mac.txt. if it asks which file to patch, type Config.pm and it should work.

Code:
patching file Config.pm
Hunk #1 succeeded at 1210 (offset -1 lines).
Hunk #2 succeeded at 1297 (offset -1 lines).

EDIT: looks like the indentation isn't preserved correctly when pasting into the forum, so it doesn't apply when copy pasted from here... you should copy it from https://pve.proxmox.com/pipermail/pve-devel/2019-November/040143.html starting with --- and ending with 2.20.1

i added it as an attachment

I did it the way you said. You can see from the picture. https://prnt.sc/pu8v8z But when I add a rope that doesn't change anything, it doesn't get mac again.
 
run systemctl restart pvedaemon pveproxy and it should start showing the MAC address when you change the network settings once.
 
run systemctl restart pvedaemon pveproxy and it should start showing the MAC address when you change the network settings once.

Yes, now the mac address appears when the new ip is added. Thank you.
 
you're welcome (onemli degil). you can mark the thread as [SOLVED] so others know what to expect.
 
  • Like
Reactions: lowegame

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!