You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Darren Shepherd <da...@gmail.com> on 2013/10/27 01:11:40 UTC

ifconfig and MacAddress

Is there a specific reason that in MacAddress it uses "ifconfig" or
other utilities to grab the Mac Address as opposed to the java API
java.net.NetworkInterface?  There's a comment in that code that says
that code was copied from some public domain utility.  So I'm guessing
its there just because that's what somebody wrote back before Java 6
introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
this code to use the standard API, grab the Mac deterministically and
also not use ifconfig which was deprecated 3 years ago.

Darren

Re: ifconfig and MacAddress

Posted by Darren Shepherd <da...@gmail.com>.
Shoot, I didn't see your patch.  I just created a patch that
supersedes yours.  https://reviews.apache.org/r/15108/  The logic is
as follows

1. Look for MAC that matches interface of cluster.node.IP
2. Look for first interface alphabetically that has a non-linklocal address
3. Look for first interface alphabetically
4. Randomly generate a mac address

Darren

On Wed, Oct 30, 2013 at 4:27 PM, Laszlo Hornyak
<la...@gmail.com> wrote:
> Hi,
>
> A patch to make MacAddress eat the Windows ipconfig output.
> https://reviews.apache.org/r/15106/
>
> I have one more question about how MacAddress should work. It seems it is
> returning the mac address of the first interface of the ipconfig/ifconfig
> output. Therefore if you configure up a new network, e.g. let libvirt start
> a new network or just plug in a usb wifi adapter, it may get something
> else. Does this meet the expectations?
>
>
>
>
> On Tue, Oct 29, 2013 at 8:18 PM, Laszlo Hornyak <la...@gmail.com>wrote:
>
>> Hi,
>>
>> I will update my patch with a fix, but I also like Darran's solution: just
>> delete the class and/or use InetAddress
>>
>>
>>
>>
>> On Tue, Oct 29, 2013 at 6:42 PM, Kelven Yang <ke...@citrix.com>wrote:
>>
>>>  Windows ipconfig is not supported, a fix is welcome.
>>>
>>>  To run a CS management server cluster on Windows. manual configuration
>>> is required. cluster.node.ip needs to configured correctly in db.properties
>>>
>>>  Kelven
>>>
>>>   From: Alex Huang <Al...@citrix.com>
>>> Date: Tuesday, October 29, 2013 at 8:43 AM
>>> To: Laszlo Hornyak <la...@gmail.com>, "dev@cloudstack.apache.org"
>>> <de...@cloudstack.apache.org>
>>> Cc: Kelven Yang <ke...@citrix.com>
>>> Subject: RE: ifconfig and MacAddress
>>>
>>>   I can confirm the code’s only there because Java didn’t have it before.
>>> ****
>>>
>>> ** **
>>>
>>> --Alex****
>>>
>>> ** **
>>>
>>> *From:* Laszlo Hornyak [mailto:laszlo.hornyak@gmail.com<la...@gmail.com>]
>>>
>>> *Sent:* Monday, October 28, 2013 11:50 PM
>>> *To:* dev@cloudstack.apache.org
>>> *Cc:* Alex Huang; Kelven Yang
>>> *Subject:* Re: ifconfig and MacAddress****
>>>
>>> ** **
>>>
>>> Hi,
>>>
>>> I noticed other problem with the MacAddress, it appears that it does not
>>> handle the Windows ipconfig output.****
>>>
>>> (see related patch) https://reviews.apache.org/r/14514/ I tested it with
>>> win8, 7, and XP outputs****
>>>
>>> As far as I remember this may be a problem when running CS cluster on
>>> windows, since each node determines the default as id.****
>>>
>>> ** **
>>>
>>> On Sun, Oct 27, 2013 at 1:11 AM, Darren Shepherd <
>>> darren.s.shepherd@gmail.com> wrote:****
>>>
>>> Is there a specific reason that in MacAddress it uses "ifconfig" or
>>> other utilities to grab the Mac Address as opposed to the java API
>>> java.net.NetworkInterface?  There's a comment in that code that says
>>> that code was copied from some public domain utility.  So I'm guessing
>>> its there just because that's what somebody wrote back before Java 6
>>> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
>>> this code to use the standard API, grab the Mac deterministically and
>>> also not use ifconfig which was deprecated 3 years ago.
>>>
>>> Darren****
>>>
>>>
>>>
>>>
>>> --
>>>
>>> EOF ****
>>>
>>
>>
>>
>> --
>>
>> EOF
>>
>
>
>
> --
>
> EOF

Re: ifconfig and MacAddress

Posted by Laszlo Hornyak <la...@gmail.com>.
Hi,

A patch to make MacAddress eat the Windows ipconfig output.
https://reviews.apache.org/r/15106/

I have one more question about how MacAddress should work. It seems it is
returning the mac address of the first interface of the ipconfig/ifconfig
output. Therefore if you configure up a new network, e.g. let libvirt start
a new network or just plug in a usb wifi adapter, it may get something
else. Does this meet the expectations?




On Tue, Oct 29, 2013 at 8:18 PM, Laszlo Hornyak <la...@gmail.com>wrote:

> Hi,
>
> I will update my patch with a fix, but I also like Darran's solution: just
> delete the class and/or use InetAddress
>
>
>
>
> On Tue, Oct 29, 2013 at 6:42 PM, Kelven Yang <ke...@citrix.com>wrote:
>
>>  Windows ipconfig is not supported, a fix is welcome.
>>
>>  To run a CS management server cluster on Windows. manual configuration
>> is required. cluster.node.ip needs to configured correctly in db.properties
>>
>>  Kelven
>>
>>   From: Alex Huang <Al...@citrix.com>
>> Date: Tuesday, October 29, 2013 at 8:43 AM
>> To: Laszlo Hornyak <la...@gmail.com>, "dev@cloudstack.apache.org"
>> <de...@cloudstack.apache.org>
>> Cc: Kelven Yang <ke...@citrix.com>
>> Subject: RE: ifconfig and MacAddress
>>
>>   I can confirm the code’s only there because Java didn’t have it before.
>> ****
>>
>> ** **
>>
>> --Alex****
>>
>> ** **
>>
>> *From:* Laszlo Hornyak [mailto:laszlo.hornyak@gmail.com<la...@gmail.com>]
>>
>> *Sent:* Monday, October 28, 2013 11:50 PM
>> *To:* dev@cloudstack.apache.org
>> *Cc:* Alex Huang; Kelven Yang
>> *Subject:* Re: ifconfig and MacAddress****
>>
>> ** **
>>
>> Hi,
>>
>> I noticed other problem with the MacAddress, it appears that it does not
>> handle the Windows ipconfig output.****
>>
>> (see related patch) https://reviews.apache.org/r/14514/ I tested it with
>> win8, 7, and XP outputs****
>>
>> As far as I remember this may be a problem when running CS cluster on
>> windows, since each node determines the default as id.****
>>
>> ** **
>>
>> On Sun, Oct 27, 2013 at 1:11 AM, Darren Shepherd <
>> darren.s.shepherd@gmail.com> wrote:****
>>
>> Is there a specific reason that in MacAddress it uses "ifconfig" or
>> other utilities to grab the Mac Address as opposed to the java API
>> java.net.NetworkInterface?  There's a comment in that code that says
>> that code was copied from some public domain utility.  So I'm guessing
>> its there just because that's what somebody wrote back before Java 6
>> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
>> this code to use the standard API, grab the Mac deterministically and
>> also not use ifconfig which was deprecated 3 years ago.
>>
>> Darren****
>>
>>
>>
>>
>> --
>>
>> EOF ****
>>
>
>
>
> --
>
> EOF
>



-- 

EOF

Re: ifconfig and MacAddress

Posted by Laszlo Hornyak <la...@gmail.com>.
Hi,

I will update my patch with a fix, but I also like Darran's solution: just
delete the class and/or use InetAddress




On Tue, Oct 29, 2013 at 6:42 PM, Kelven Yang <ke...@citrix.com> wrote:

>  Windows ipconfig is not supported, a fix is welcome.
>
>  To run a CS management server cluster on Windows. manual configuration
> is required. cluster.node.ip needs to configured correctly in db.properties
>
>  Kelven
>
>   From: Alex Huang <Al...@citrix.com>
> Date: Tuesday, October 29, 2013 at 8:43 AM
> To: Laszlo Hornyak <la...@gmail.com>, "dev@cloudstack.apache.org"
> <de...@cloudstack.apache.org>
> Cc: Kelven Yang <ke...@citrix.com>
> Subject: RE: ifconfig and MacAddress
>
>   I can confirm the code’s only there because Java didn’t have it before.*
> ***
>
> ** **
>
> --Alex****
>
> ** **
>
> *From:* Laszlo Hornyak [mailto:laszlo.hornyak@gmail.com<la...@gmail.com>]
>
> *Sent:* Monday, October 28, 2013 11:50 PM
> *To:* dev@cloudstack.apache.org
> *Cc:* Alex Huang; Kelven Yang
> *Subject:* Re: ifconfig and MacAddress****
>
> ** **
>
> Hi,
>
> I noticed other problem with the MacAddress, it appears that it does not
> handle the Windows ipconfig output.****
>
> (see related patch) https://reviews.apache.org/r/14514/ I tested it with
> win8, 7, and XP outputs****
>
> As far as I remember this may be a problem when running CS cluster on
> windows, since each node determines the default as id.****
>
> ** **
>
> On Sun, Oct 27, 2013 at 1:11 AM, Darren Shepherd <
> darren.s.shepherd@gmail.com> wrote:****
>
> Is there a specific reason that in MacAddress it uses "ifconfig" or
> other utilities to grab the Mac Address as opposed to the java API
> java.net.NetworkInterface?  There's a comment in that code that says
> that code was copied from some public domain utility.  So I'm guessing
> its there just because that's what somebody wrote back before Java 6
> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
> this code to use the standard API, grab the Mac deterministically and
> also not use ifconfig which was deprecated 3 years ago.
>
> Darren****
>
>
>
>
> --
>
> EOF ****
>



-- 

EOF

Re: ifconfig and MacAddress

Posted by Kelven Yang <ke...@citrix.com>.
Windows ipconfig is not supported, a fix is welcome.

To run a CS management server cluster on Windows. manual configuration is required. cluster.node.ip needs to configured correctly in db.properties

Kelven

From: Alex Huang <Al...@citrix.com>>
Date: Tuesday, October 29, 2013 at 8:43 AM
To: Laszlo Hornyak <la...@gmail.com>>, "dev@cloudstack.apache.org<ma...@cloudstack.apache.org>" <de...@cloudstack.apache.org>>
Cc: Kelven Yang <ke...@citrix.com>>
Subject: RE: ifconfig and MacAddress

I can confirm the code’s only there because Java didn’t have it before.

--Alex

From: Laszlo Hornyak [mailto:laszlo.hornyak@gmail.com]
Sent: Monday, October 28, 2013 11:50 PM
To: dev@cloudstack.apache.org<ma...@cloudstack.apache.org>
Cc: Alex Huang; Kelven Yang
Subject: Re: ifconfig and MacAddress

Hi,

I noticed other problem with the MacAddress, it appears that it does not handle the Windows ipconfig output.
(see related patch) https://reviews.apache.org/r/14514/ I tested it with win8, 7, and XP outputs
As far as I remember this may be a problem when running CS cluster on windows, since each node determines the default as id.

On Sun, Oct 27, 2013 at 1:11 AM, Darren Shepherd <da...@gmail.com>> wrote:
Is there a specific reason that in MacAddress it uses "ifconfig" or
other utilities to grab the Mac Address as opposed to the java API
java.net.NetworkInterface?  There's a comment in that code that says
that code was copied from some public domain utility.  So I'm guessing
its there just because that's what somebody wrote back before Java 6
introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
this code to use the standard API, grab the Mac deterministically and
also not use ifconfig which was deprecated 3 years ago.

Darren



--

EOF

RE: ifconfig and MacAddress

Posted by Alex Huang <Al...@citrix.com>.
I can confirm the code's only there because Java didn't have it before.

--Alex

From: Laszlo Hornyak [mailto:laszlo.hornyak@gmail.com]
Sent: Monday, October 28, 2013 11:50 PM
To: dev@cloudstack.apache.org
Cc: Alex Huang; Kelven Yang
Subject: Re: ifconfig and MacAddress

Hi,

I noticed other problem with the MacAddress, it appears that it does not handle the Windows ipconfig output.
(see related patch) https://reviews.apache.org/r/14514/ I tested it with win8, 7, and XP outputs
As far as I remember this may be a problem when running CS cluster on windows, since each node determines the default as id.

On Sun, Oct 27, 2013 at 1:11 AM, Darren Shepherd <da...@gmail.com>> wrote:
Is there a specific reason that in MacAddress it uses "ifconfig" or
other utilities to grab the Mac Address as opposed to the java API
java.net.NetworkInterface?  There's a comment in that code that says
that code was copied from some public domain utility.  So I'm guessing
its there just because that's what somebody wrote back before Java 6
introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
this code to use the standard API, grab the Mac deterministically and
also not use ifconfig which was deprecated 3 years ago.

Darren



--

EOF

Re: ifconfig and MacAddress

Posted by Laszlo Hornyak <la...@gmail.com>.
Hi,

I noticed other problem with the MacAddress, it appears that it does not
handle the Windows ipconfig output.
(see related patch) https://reviews.apache.org/r/14514/ I tested it with
win8, 7, and XP outputs

As far as I remember this may be a problem when running CS cluster on
windows, since each node determines the default as id.



On Sun, Oct 27, 2013 at 1:11 AM, Darren Shepherd <
darren.s.shepherd@gmail.com> wrote:

> Is there a specific reason that in MacAddress it uses "ifconfig" or
> other utilities to grab the Mac Address as opposed to the java API
> java.net.NetworkInterface?  There's a comment in that code that says
> that code was copied from some public domain utility.  So I'm guessing
> its there just because that's what somebody wrote back before Java 6
> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
> this code to use the standard API, grab the Mac deterministically and
> also not use ifconfig which was deprecated 3 years ago.
>
> Darren
>



-- 

EOF

Re: ifconfig and MacAddress

Posted by Kelven Yang <ke...@citrix.com>.
In a setup with multiple interfaces or Multiple IPs on one interfaces, it
sounds more simple to just get the decision resolved through
configuration. Looking for interfaces that has IP configured as what
"cluster.node.IP" says so, can get us a deterministic mac address.

I'm not sure about a KVM case though, when management server is running on
KVM and CloudStack allows adding management server itself as a KVM host as
well, when this happens, KVM agent seems to create a bridge and shuffle IP
address assignment which could break above logic.

Kelven


On 10/26/13 10:02 PM, "Darren Shepherd" <da...@gmail.com>
wrote:

>Just want to clarify something for people reading this thread.  I'm not
>looking at code right now so I could be slightly wrong about the
>following.  'host' and 'cluster.node.IP' are slightly different.
>Cluster.node.ip is recorded in the mshost table and is used to tell
>cluster peers what IP the current node is addressable by.  The 'host'
>property is used to tell the systemvms what IP to use to get to the mgmt
>servers.  The host property in a production setup should actually be
>bound to a VIP so that you can handle failover between mgmt servers.  So
>cluster.node.IP != host in most setups.  If you don't set the
>cluster.node.IP (I don't know why) it seems to pick localhost.  If you
>are only running one mgmt server (like a dev setup) that is actually
>fine. Even though it's localhost it will still listen on *.  So in a dev
>setup the cluster.node.IP will be localhost, but you just need to set the
>host property to your real IP.
>
>This is working for me on master, so I'm not too sure what's going on in
>your setup.  Are you seeing that Marvin is not setting the prop in the
>config table.  Or are you seeing the prop in the config table but that
>it's not getting set on cmdline of the systemvms.  I typically set the
>host prop with SQL, so never tried through Marvin.
>
>Darren
>
>> On Oct 26, 2013, at 9:30 PM, Marcus Sorensen <sh...@gmail.com>
>>wrote:
>> 
>> there's a 'host' global config property that I believe is supposed to
>> be the master mgmt server. For some reason this is also not working
>> quite right for me on master, it used to set correctly per my marvin
>> zone config, going from 4.2 to master the 'host' property always ends
>> up as 'localhost' rather than the IP. This messes things up because it
>> passes 'localhost' as the mgmt server to the system vms.
>> 
>> On Sat, Oct 26, 2013 at 9:44 PM, Darren Shepherd
>> <da...@gmail.com> wrote:
>>> I completely agree and part of why I want to change it.  On my machine
>>>my wifi and Ethernet devices sometimes swap as being first in the list
>>>and it doesn't seem to like that at all.  I don't know if it's because
>>>my mgmt IP is localhost or what, but the new mgmt host entry never
>>>takes over ownership of the previous hosts.
>>> 
>>> I'd like to make it more deterministic.  Not completely sure what the
>>>algorithm should be.  I was thinking that I'd sort the interfaces by
>>>Mac or name and then look for the non-link local nic.
>>> 
>>> Actually, I can just look for the Mac of the IP set as the
>>>cluster.node.IP.  Some stupid reason I was thinking that was in the DB,
>>>but it's (obviously?) in the db.propeties.
>>> 
>>> Darren
>>> 
>>>> On Oct 26, 2013, at 4:27 PM, Marcus Sorensen <sh...@gmail.com>
>>>>wrote:
>>>> 
>>>> Tangent, if that's the code that comes up with mgmt server id (by Mac
>>>> address conversion to short), its bitten me in the past. It doesn't
>>>> tolerate new NICs well, for example in development when a mgmt server
>>>>is
>>>> also a host and a link local bridge is created. Seems bad form to
>>>>just run
>>>> ifconfig and grab the first Mac you find.
>>>> On Oct 26, 2013 5:12 PM, "Darren Shepherd"
>>>><da...@gmail.com>
>>>> wrote:
>>>> 
>>>>> Is there a specific reason that in MacAddress it uses "ifconfig" or
>>>>> other utilities to grab the Mac Address as opposed to the java API
>>>>> java.net.NetworkInterface?  There's a comment in that code that says
>>>>> that code was copied from some public domain utility.  So I'm
>>>>>guessing
>>>>> its there just because that's what somebody wrote back before Java 6
>>>>> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
>>>>> this code to use the standard API, grab the Mac deterministically and
>>>>> also not use ifconfig which was deprecated 3 years ago.
>>>>> 
>>>>> Darren
>>>>> 


Re: ifconfig and MacAddress

Posted by Darren Shepherd <da...@gmail.com>.
Just want to clarify something for people reading this thread.  I'm not looking at code right now so I could be slightly wrong about the following.  'host' and 'cluster.node.IP' are slightly different.  Cluster.node.ip is recorded in the mshost table and is used to tell cluster peers what IP the current node is addressable by.  The 'host' property is used to tell the systemvms what IP to use to get to the mgmt servers.  The host property in a production setup should actually be bound to a VIP so that you can handle failover between mgmt servers.  So cluster.node.IP != host in most setups.  If you don't set the cluster.node.IP (I don't know why) it seems to pick localhost.  If you are only running one mgmt server (like a dev setup) that is actually fine. Even though it's localhost it will still listen on *.  So in a dev setup the cluster.node.IP will be localhost, but you just need to set the host property to your real IP.  

This is working for me on master, so I'm not too sure what's going on in your setup.  Are you seeing that Marvin is not setting the prop in the config table.  Or are you seeing the prop in the config table but that it's not getting set on cmdline of the systemvms.  I typically set the host prop with SQL, so never tried through Marvin.  

Darren

> On Oct 26, 2013, at 9:30 PM, Marcus Sorensen <sh...@gmail.com> wrote:
> 
> there's a 'host' global config property that I believe is supposed to
> be the master mgmt server. For some reason this is also not working
> quite right for me on master, it used to set correctly per my marvin
> zone config, going from 4.2 to master the 'host' property always ends
> up as 'localhost' rather than the IP. This messes things up because it
> passes 'localhost' as the mgmt server to the system vms.
> 
> On Sat, Oct 26, 2013 at 9:44 PM, Darren Shepherd
> <da...@gmail.com> wrote:
>> I completely agree and part of why I want to change it.  On my machine my wifi and Ethernet devices sometimes swap as being first in the list and it doesn't seem to like that at all.  I don't know if it's because my mgmt IP is localhost or what, but the new mgmt host entry never takes over ownership of the previous hosts.
>> 
>> I'd like to make it more deterministic.  Not completely sure what the algorithm should be.  I was thinking that I'd sort the interfaces by Mac or name and then look for the non-link local nic.
>> 
>> Actually, I can just look for the Mac of the IP set as the cluster.node.IP.  Some stupid reason I was thinking that was in the DB, but it's (obviously?) in the db.propeties.
>> 
>> Darren
>> 
>>> On Oct 26, 2013, at 4:27 PM, Marcus Sorensen <sh...@gmail.com> wrote:
>>> 
>>> Tangent, if that's the code that comes up with mgmt server id (by Mac
>>> address conversion to short), its bitten me in the past. It doesn't
>>> tolerate new NICs well, for example in development when a mgmt server is
>>> also a host and a link local bridge is created. Seems bad form to just run
>>> ifconfig and grab the first Mac you find.
>>> On Oct 26, 2013 5:12 PM, "Darren Shepherd" <da...@gmail.com>
>>> wrote:
>>> 
>>>> Is there a specific reason that in MacAddress it uses "ifconfig" or
>>>> other utilities to grab the Mac Address as opposed to the java API
>>>> java.net.NetworkInterface?  There's a comment in that code that says
>>>> that code was copied from some public domain utility.  So I'm guessing
>>>> its there just because that's what somebody wrote back before Java 6
>>>> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
>>>> this code to use the standard API, grab the Mac deterministically and
>>>> also not use ifconfig which was deprecated 3 years ago.
>>>> 
>>>> Darren
>>>> 

Re: ifconfig and MacAddress

Posted by Marcus Sorensen <sh...@gmail.com>.
there's a 'host' global config property that I believe is supposed to
be the master mgmt server. For some reason this is also not working
quite right for me on master, it used to set correctly per my marvin
zone config, going from 4.2 to master the 'host' property always ends
up as 'localhost' rather than the IP. This messes things up because it
passes 'localhost' as the mgmt server to the system vms.

On Sat, Oct 26, 2013 at 9:44 PM, Darren Shepherd
<da...@gmail.com> wrote:
> I completely agree and part of why I want to change it.  On my machine my wifi and Ethernet devices sometimes swap as being first in the list and it doesn't seem to like that at all.  I don't know if it's because my mgmt IP is localhost or what, but the new mgmt host entry never takes over ownership of the previous hosts.
>
> I'd like to make it more deterministic.  Not completely sure what the algorithm should be.  I was thinking that I'd sort the interfaces by Mac or name and then look for the non-link local nic.
>
> Actually, I can just look for the Mac of the IP set as the cluster.node.IP.  Some stupid reason I was thinking that was in the DB, but it's (obviously?) in the db.propeties.
>
> Darren
>
>> On Oct 26, 2013, at 4:27 PM, Marcus Sorensen <sh...@gmail.com> wrote:
>>
>> Tangent, if that's the code that comes up with mgmt server id (by Mac
>> address conversion to short), its bitten me in the past. It doesn't
>> tolerate new NICs well, for example in development when a mgmt server is
>> also a host and a link local bridge is created. Seems bad form to just run
>> ifconfig and grab the first Mac you find.
>> On Oct 26, 2013 5:12 PM, "Darren Shepherd" <da...@gmail.com>
>> wrote:
>>
>>> Is there a specific reason that in MacAddress it uses "ifconfig" or
>>> other utilities to grab the Mac Address as opposed to the java API
>>> java.net.NetworkInterface?  There's a comment in that code that says
>>> that code was copied from some public domain utility.  So I'm guessing
>>> its there just because that's what somebody wrote back before Java 6
>>> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
>>> this code to use the standard API, grab the Mac deterministically and
>>> also not use ifconfig which was deprecated 3 years ago.
>>>
>>> Darren
>>>

Re: ifconfig and MacAddress

Posted by Darren Shepherd <da...@gmail.com>.
I completely agree and part of why I want to change it.  On my machine my wifi and Ethernet devices sometimes swap as being first in the list and it doesn't seem to like that at all.  I don't know if it's because my mgmt IP is localhost or what, but the new mgmt host entry never takes over ownership of the previous hosts.  

I'd like to make it more deterministic.  Not completely sure what the algorithm should be.  I was thinking that I'd sort the interfaces by Mac or name and then look for the non-link local nic.

Actually, I can just look for the Mac of the IP set as the cluster.node.IP.  Some stupid reason I was thinking that was in the DB, but it's (obviously?) in the db.propeties.  

Darren

> On Oct 26, 2013, at 4:27 PM, Marcus Sorensen <sh...@gmail.com> wrote:
> 
> Tangent, if that's the code that comes up with mgmt server id (by Mac
> address conversion to short), its bitten me in the past. It doesn't
> tolerate new NICs well, for example in development when a mgmt server is
> also a host and a link local bridge is created. Seems bad form to just run
> ifconfig and grab the first Mac you find.
> On Oct 26, 2013 5:12 PM, "Darren Shepherd" <da...@gmail.com>
> wrote:
> 
>> Is there a specific reason that in MacAddress it uses "ifconfig" or
>> other utilities to grab the Mac Address as opposed to the java API
>> java.net.NetworkInterface?  There's a comment in that code that says
>> that code was copied from some public domain utility.  So I'm guessing
>> its there just because that's what somebody wrote back before Java 6
>> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
>> this code to use the standard API, grab the Mac deterministically and
>> also not use ifconfig which was deprecated 3 years ago.
>> 
>> Darren
>> 

Re: ifconfig and MacAddress

Posted by Marcus Sorensen <sh...@gmail.com>.
Tangent, if that's the code that comes up with mgmt server id (by Mac
address conversion to short), its bitten me in the past. It doesn't
tolerate new NICs well, for example in development when a mgmt server is
also a host and a link local bridge is created. Seems bad form to just run
ifconfig and grab the first Mac you find.
On Oct 26, 2013 5:12 PM, "Darren Shepherd" <da...@gmail.com>
wrote:

> Is there a specific reason that in MacAddress it uses "ifconfig" or
> other utilities to grab the Mac Address as opposed to the java API
> java.net.NetworkInterface?  There's a comment in that code that says
> that code was copied from some public domain utility.  So I'm guessing
> its there just because that's what somebody wrote back before Java 6
> introduced NetworkInteface.getHardwareAddress().  I'd like to rewrite
> this code to use the standard API, grab the Mac deterministically and
> also not use ifconfig which was deprecated 3 years ago.
>
> Darren
>