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/31 01:18:39 UTC

Review Request 15108: Grab MacAddress in a more deterministic fashion

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15108/
-----------------------------------------------------------

Review request for cloudstack, Alex Huang and Laszlo Hornyak.


Repository: cloudstack-git


Description
-------

The MAC address is determined in the following order

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


Diffs
-----

  utils/src/com/cloud/utils/net/MacAddress.java 15350c8 

Diff: https://reviews.apache.org/r/15108/diff/


Testing
-------


Thanks,

Darren Shepherd


Re: Review Request 15108: Grab MacAddress in a more deterministic fashion

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

> On Oct. 31, 2013, 8:29 a.m., Laszlo Hornyak wrote:
> > I haven't had a chance to test it yet, but I prefer this solution over my own patchset, since I was only trying to fix some broken functionality without radically changing the behavior.
> > One minor problem I see in there is that still lots of code in static initializer block, it is hard to write unit tests for it. I think we can solve that later.
> 
> Darren Shepherd wrote:
>     I can't remove the static initialization atm but we can move the contents of the static block to a method findDefaultMacAddress that returns the MacAddress.  Then the static block would just be the assignment.  That should help with unit testing. I wasn't too sure how to unit test this code.  If you want to move around the code and see if you can write some tests that would be great.

Yes, that is what I meant. I will check the new code and see what I can do with tests.


- Laszlo


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15108/#review27875
-----------------------------------------------------------


On Oct. 31, 2013, 12:18 a.m., Darren Shepherd wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15108/
> -----------------------------------------------------------
> 
> (Updated Oct. 31, 2013, 12:18 a.m.)
> 
> 
> Review request for cloudstack, Alex Huang and Laszlo Hornyak.
> 
> 
> Repository: cloudstack-git
> 
> 
> Description
> -------
> 
> The MAC address is determined in the following order
> 
> 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
> 
> 
> Diffs
> -----
> 
>   utils/src/com/cloud/utils/net/MacAddress.java 15350c8 
> 
> Diff: https://reviews.apache.org/r/15108/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Darren Shepherd
> 
>


Re: Review Request 15108: Grab MacAddress in a more deterministic fashion

Posted by Darren Shepherd <da...@gmail.com>.

> On Oct. 31, 2013, 8:29 a.m., Laszlo Hornyak wrote:
> > I haven't had a chance to test it yet, but I prefer this solution over my own patchset, since I was only trying to fix some broken functionality without radically changing the behavior.
> > One minor problem I see in there is that still lots of code in static initializer block, it is hard to write unit tests for it. I think we can solve that later.

I can't remove the static initialization atm but we can move the contents of the static block to a method findDefaultMacAddress that returns the MacAddress.  Then the static block would just be the assignment.  That should help with unit testing. I wasn't too sure how to unit test this code.  If you want to move around the code and see if you can write some tests that would be great.


- Darren


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15108/#review27875
-----------------------------------------------------------


On Oct. 31, 2013, 12:18 a.m., Darren Shepherd wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15108/
> -----------------------------------------------------------
> 
> (Updated Oct. 31, 2013, 12:18 a.m.)
> 
> 
> Review request for cloudstack, Alex Huang and Laszlo Hornyak.
> 
> 
> Repository: cloudstack-git
> 
> 
> Description
> -------
> 
> The MAC address is determined in the following order
> 
> 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
> 
> 
> Diffs
> -----
> 
>   utils/src/com/cloud/utils/net/MacAddress.java 15350c8 
> 
> Diff: https://reviews.apache.org/r/15108/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Darren Shepherd
> 
>


Re: Review Request 15108: Grab MacAddress in a more deterministic fashion

Posted by Laszlo Hornyak <la...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/15108/#review27875
-----------------------------------------------------------


I haven't had a chance to test it yet, but I prefer this solution over my own patchset, since I was only trying to fix some broken functionality without radically changing the behavior.
One minor problem I see in there is that still lots of code in static initializer block, it is hard to write unit tests for it. I think we can solve that later.

- Laszlo Hornyak


On Oct. 31, 2013, 12:18 a.m., Darren Shepherd wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15108/
> -----------------------------------------------------------
> 
> (Updated Oct. 31, 2013, 12:18 a.m.)
> 
> 
> Review request for cloudstack, Alex Huang and Laszlo Hornyak.
> 
> 
> Repository: cloudstack-git
> 
> 
> Description
> -------
> 
> The MAC address is determined in the following order
> 
> 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
> 
> 
> Diffs
> -----
> 
>   utils/src/com/cloud/utils/net/MacAddress.java 15350c8 
> 
> Diff: https://reviews.apache.org/r/15108/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Darren Shepherd
> 
>