Re: [32/50] [abbrv] git commit: updated refs/heads/feature/systemvm-persistent-config to 4fe7264

2015-02-04 Thread John Kinsella
Would be nice if we weren’t setting a static VRRP password...

John

> On Feb 4, 2015, at 12:28 PM, d...@apache.org wrote:
> 
> Fix router priuority using the same logic as the one for the state
> Fix the router state. do not show UNKNOW, but MASTER or BACKUP depending on 
> the type of router
> Implement the virtual_router_id to be passed as a boot parameter to the router
>  - it is needed for the keepalived configuration
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
> Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5303d2a8
> Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5303d2a8
> Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5303d2a8
> 
> Branch: refs/heads/feature/systemvm-persistent-config
> Commit: 5303d2a8e4ccd34d518c7e529d3ebd95e2933808
> Parents: cc384ee
> Author: wilderrodrigues 
> Authored: Tue Jan 27 14:05:38 2015 +0100
> Committer: wilderrodrigues 
> Committed: Wed Feb 4 18:47:09 2015 +0100
> 
> --
> .../VirtualNetworkApplianceManagerImpl.java | 22 +---
> .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  7 ++-
> .../config/opt/cloud/bin/cs/CsRedundant.py  |  3 ++-
> .../opt/cloud/templates/keepalived.conf.templ   |  4 ++--
> 4 files changed, 24 insertions(+), 12 deletions(-)
> --
> 
> 
> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5303d2a8/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
> --
> diff --git 
> a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java 
> b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
> index f0730f5..1c32c7e 100644
> --- 
> a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
> +++ 
> b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
> @@ -1302,23 +1302,24 @@ Configurable, StateListener VirtualMachine.Event, VirtualMachine> {
> }
> }
> 
> -protected int getUpdatedPriority(final Network network, final 
> List routers, final DomainRouterVO exclude)
> +protected int getUpdatedPriority(final Network network, final 
> List routers, final DomainRouterVO masterRouter)
> throws InsufficientVirtualNetworkCapacityException {
> int priority;
> if (routers.size() == 0) {
> priority = DEFAULT_PRIORITY;
> } else {
> int maxPriority = 0;
> -for (final DomainRouterVO r : routers) {
> -if (!r.getIsRedundantRouter()) {
> +
> +final DomainRouterVO router0 = routers.get(0);
> +if (router0.getId() == masterRouter.getId()) {
> +if (!router0.getIsRedundantRouter()) {
> throw new CloudRuntimeException("Redundant router is 
> mixed with single router in one network!");
> }
> -// FIXME Assume the maxPriority one should be running or just
> -// created.
> -if (r.getId() != exclude.getId() && 
> _nwHelper.getRealPriority(r) > maxPriority) {
> -maxPriority = _nwHelper.getRealPriority(r);
> -}
> +maxPriority = _nwHelper.getRealPriority(router0);
> +} else {
> +maxPriority = DEFAULT_PRIORITY;
> }
> +
> if (maxPriority == 0) {
> return DEFAULT_PRIORITY;
> }
> @@ -1330,6 +1331,7 @@ Configurable, StateListener VirtualMachine.Event, VirtualMachine> {
> throw new InsufficientVirtualNetworkCapacityException("Too 
> many times fail-over happened! Current maximum priority is too high as " + 
> maxPriority + "!",
> network.getId());
> }
> +
> priority = maxPriority - DEFAULT_DELTA + 1;
> }
> return priority;
> @@ -1589,6 +1591,7 @@ Configurable, StateListener VirtualMachine.Event, VirtualMachine> {
> final boolean isRedundant = router.getIsRedundantRouter();
> if (isRedundant) {
> buf.append(" redundant_router=1");
> +buf.append(" router_id=").append(router.getId());
> 
> final Long vpcId = router.getVpcId();
> final List routers;
> @@ -1599,13 +1602,16 @@ Configurable, StateListener VirtualMachine.Event, VirtualMachine> {
> }
> 
> String redundantState = RedundantState.BACKUP.toString();
> +router.setRedundantState(RedundantState.BACKUP);
> if (routers.size() == 0) {
> redundantState = RedundantState.MASTER.toString();
> +router.setRedundantState(RedundantState.MASTER);
> } else {
> final DomainRouterVO router0 = routers.get(0);
> 
> if (rou

Re: [32/50] [abbrv] git commit: updated refs/heads/feature/systemvm-persistent-config to 4fe7264

2015-02-05 Thread Ian Southam
One of the many  things on “to fix” list but thanks, we do not want to go 
forward with stupid stuff in there, the idea is to make things better!

—
Cheers
Ian

On 04 Feb 2015, at 22:53, John Kinsella  wrote:

> Would be nice if we weren’t setting a static VRRP password...
> 
> John
> 
>> On Feb 4, 2015, at 12:28 PM, d...@apache.org wrote:
>> 
>> Fix router priuority using the same logic as the one for the state
>> Fix the router state. do not show UNKNOW, but MASTER or BACKUP depending on 
>> the type of router
>> Implement the virtual_router_id to be passed as a boot parameter to the 
>> router
>> - it is needed for the keepalived configuration
>> 
>> 
>> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5303d2a8
>> Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5303d2a8
>> Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5303d2a8
>> 
>> Branch: refs/heads/feature/systemvm-persistent-config
>> Commit: 5303d2a8e4ccd34d518c7e529d3ebd95e2933808
>> Parents: cc384ee
>> Author: wilderrodrigues 
>> Authored: Tue Jan 27 14:05:38 2015 +0100
>> Committer: wilderrodrigues 
>> Committed: Wed Feb 4 18:47:09 2015 +0100
>> 
>> --
>> .../VirtualNetworkApplianceManagerImpl.java | 22 +---
>> .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  7 ++-
>> .../config/opt/cloud/bin/cs/CsRedundant.py  |  3 ++-
>> .../opt/cloud/templates/keepalived.conf.templ   |  4 ++--
>> 4 files changed, 24 insertions(+), 12 deletions(-)
>> --
>> 
>> 
>> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5303d2a8/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>> --
>> diff --git 
>> a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>>  
>> b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>> index f0730f5..1c32c7e 100644
>> --- 
>> a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>> +++ 
>> b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>> @@ -1302,23 +1302,24 @@ Configurable, StateListener> VirtualMachine.Event, VirtualMachine> {
>>}
>>}
>> 
>> -protected int getUpdatedPriority(final Network network, final 
>> List routers, final DomainRouterVO exclude)
>> +protected int getUpdatedPriority(final Network network, final 
>> List routers, final DomainRouterVO masterRouter)
>>throws InsufficientVirtualNetworkCapacityException {
>>int priority;
>>if (routers.size() == 0) {
>>priority = DEFAULT_PRIORITY;
>>} else {
>>int maxPriority = 0;
>> -for (final DomainRouterVO r : routers) {
>> -if (!r.getIsRedundantRouter()) {
>> +
>> +final DomainRouterVO router0 = routers.get(0);
>> +if (router0.getId() == masterRouter.getId()) {
>> +if (!router0.getIsRedundantRouter()) {
>>throw new CloudRuntimeException("Redundant router is 
>> mixed with single router in one network!");
>>}
>> -// FIXME Assume the maxPriority one should be running or 
>> just
>> -// created.
>> -if (r.getId() != exclude.getId() && 
>> _nwHelper.getRealPriority(r) > maxPriority) {
>> -maxPriority = _nwHelper.getRealPriority(r);
>> -}
>> +maxPriority = _nwHelper.getRealPriority(router0);
>> +} else {
>> +maxPriority = DEFAULT_PRIORITY;
>>}
>> +
>>if (maxPriority == 0) {
>>return DEFAULT_PRIORITY;
>>}
>> @@ -1330,6 +1331,7 @@ Configurable, StateListener> VirtualMachine.Event, VirtualMachine> {
>>throw new InsufficientVirtualNetworkCapacityException("Too 
>> many times fail-over happened! Current maximum priority is too high as " + 
>> maxPriority + "!",
>>network.getId());
>>}
>> +
>>priority = maxPriority - DEFAULT_DELTA + 1;
>>}
>>return priority;
>> @@ -1589,6 +1591,7 @@ Configurable, StateListener> VirtualMachine.Event, VirtualMachine> {
>>final boolean isRedundant = router.getIsRedundantRouter();
>>if (isRedundant) {
>>buf.append(" redundant_router=1");
>> +buf.append(" router_id=").append(router.getId());
>> 
>>final Long vpcId = router.getVpcId();
>>final List routers;
>> @@ -1599,13 +1602,16 @@ Configurable, StateListener> VirtualMachine.Event, VirtualMachine> {
>>}
>> 
>>String redundantState = RedundantState.BACKUP.toString();
>> +router.setRedundantState(RedundantSt

Re: [32/50] [abbrv] git commit: updated refs/heads/feature/systemvm-persistent-config to 4fe7264

2015-02-05 Thread Daan Hoogland
A thing to stress here is that we plan to support this after release
so early comment is very welcome. I think Ian is trying to express the
same but I wanted to make sure;) Thanks John.

On Thu, Feb 5, 2015 at 5:50 PM, Ian Southam  wrote:
> One of the many  things on “to fix” list but thanks, we do not want to go 
> forward with stupid stuff in there, the idea is to make things better!
>
> —
> Cheers
> Ian
>
> On 04 Feb 2015, at 22:53, John Kinsella  wrote:
>
>> Would be nice if we weren’t setting a static VRRP password...
>>
>> John
>>
>>> On Feb 4, 2015, at 12:28 PM, d...@apache.org wrote:
>>>
>>> Fix router priuority using the same logic as the one for the state
>>> Fix the router state. do not show UNKNOW, but MASTER or BACKUP depending on 
>>> the type of router
>>> Implement the virtual_router_id to be passed as a boot parameter to the 
>>> router
>>> - it is needed for the keepalived configuration
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5303d2a8
>>> Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5303d2a8
>>> Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5303d2a8
>>>
>>> Branch: refs/heads/feature/systemvm-persistent-config
>>> Commit: 5303d2a8e4ccd34d518c7e529d3ebd95e2933808
>>> Parents: cc384ee
>>> Author: wilderrodrigues 
>>> Authored: Tue Jan 27 14:05:38 2015 +0100
>>> Committer: wilderrodrigues 
>>> Committed: Wed Feb 4 18:47:09 2015 +0100
>>>
>>> --
>>> .../VirtualNetworkApplianceManagerImpl.java | 22 +---
>>> .../debian/config/opt/cloud/bin/cs/CsDatabag.py |  7 ++-
>>> .../config/opt/cloud/bin/cs/CsRedundant.py  |  3 ++-
>>> .../opt/cloud/templates/keepalived.conf.templ   |  4 ++--
>>> 4 files changed, 24 insertions(+), 12 deletions(-)
>>> --
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5303d2a8/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>>> --
>>> diff --git 
>>> a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>>>  
>>> b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>>> index f0730f5..1c32c7e 100644
>>> --- 
>>> a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>>> +++ 
>>> b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
>>> @@ -1302,23 +1302,24 @@ Configurable, StateListener>> VirtualMachine.Event, VirtualMachine> {
>>>}
>>>}
>>>
>>> -protected int getUpdatedPriority(final Network network, final 
>>> List routers, final DomainRouterVO exclude)
>>> +protected int getUpdatedPriority(final Network network, final 
>>> List routers, final DomainRouterVO masterRouter)
>>>throws InsufficientVirtualNetworkCapacityException {
>>>int priority;
>>>if (routers.size() == 0) {
>>>priority = DEFAULT_PRIORITY;
>>>} else {
>>>int maxPriority = 0;
>>> -for (final DomainRouterVO r : routers) {
>>> -if (!r.getIsRedundantRouter()) {
>>> +
>>> +final DomainRouterVO router0 = routers.get(0);
>>> +if (router0.getId() == masterRouter.getId()) {
>>> +if (!router0.getIsRedundantRouter()) {
>>>throw new CloudRuntimeException("Redundant router is 
>>> mixed with single router in one network!");
>>>}
>>> -// FIXME Assume the maxPriority one should be running or 
>>> just
>>> -// created.
>>> -if (r.getId() != exclude.getId() && 
>>> _nwHelper.getRealPriority(r) > maxPriority) {
>>> -maxPriority = _nwHelper.getRealPriority(r);
>>> -}
>>> +maxPriority = _nwHelper.getRealPriority(router0);
>>> +} else {
>>> +maxPriority = DEFAULT_PRIORITY;
>>>}
>>> +
>>>if (maxPriority == 0) {
>>>return DEFAULT_PRIORITY;
>>>}
>>> @@ -1330,6 +1331,7 @@ Configurable, StateListener>> VirtualMachine.Event, VirtualMachine> {
>>>throw new InsufficientVirtualNetworkCapacityException("Too 
>>> many times fail-over happened! Current maximum priority is too high as " + 
>>> maxPriority + "!",
>>>network.getId());
>>>}
>>> +
>>>priority = maxPriority - DEFAULT_DELTA + 1;
>>>}
>>>return priority;
>>> @@ -1589,6 +1591,7 @@ Configurable, StateListener>> VirtualMachine.Event, VirtualMachine> {
>>>final boolean isRedundant = router.getIsRedundantRouter();
>>>if (isRedundant) {
>>>buf.append(" redundant_router=1");
>>> +buf.append(" router_id=").append(