Skip to content

Commit

Permalink
Bump priority stragety is no longer used for redundant virtual routers
Browse files Browse the repository at this point in the history
   - With the changes added by the rVPC work, the bump priority became deprecated.
     This commit includes a refactor to get it removed from the following resources:
     * Java classes
     * domain_router table - removing the is_priority_bumpup column
     * Fixing unit tests

All changes were tested with:

XenServer 6.2 running under our VMWare zone
CloudStack Management Server running on MacBook Pro
MySql running on MackBook Pro
Storage Type: Local
  • Loading branch information
wilderrodrigues committed Apr 2, 2015
1 parent 3e28747 commit 3d22a16
Show file tree
Hide file tree
Showing 21 changed files with 680 additions and 987 deletions.
38 changes: 12 additions & 26 deletions core/src/com/cloud/agent/api/CheckRouterAnswer.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,63 +22,49 @@
import com.cloud.network.router.VirtualRouter.RedundantState;

public class CheckRouterAnswer extends Answer {

public static final String ROUTER_NAME = "router.name";
public static final String ROUTER_IP = "router.ip";
RedundantState state;
boolean isBumped;

protected CheckRouterAnswer() {
}

public CheckRouterAnswer(CheckRouterCommand cmd, String details, boolean parse) {
public CheckRouterAnswer(final CheckRouterCommand cmd, final String details, final boolean parse) {
super(cmd, true, details);
if (parse) {
if (!parseDetails(details)) {
this.result = false;
result = false;
}
}
}

public CheckRouterAnswer(CheckRouterCommand cmd, String details) {
public CheckRouterAnswer(final CheckRouterCommand cmd, final String details) {
super(cmd, false, details);
}

protected boolean parseDetails(String details) {
String[] lines = details.split("&");
if (lines.length != 2) {
protected boolean parseDetails(final String details) {
if (details == null || "".equals(details.trim())) {
state = RedundantState.UNKNOWN;
return false;
}
if (lines[0].startsWith("Status: MASTER")) {
if (details.startsWith("Status: MASTER")) {
state = RedundantState.MASTER;
} else if (lines[0].startsWith("Status: BACKUP")) {
} else if (details.startsWith("Status: BACKUP")) {
state = RedundantState.BACKUP;
} else if (lines[0].startsWith("Status: FAULT")) {
} else if (details.startsWith("Status: FAULT")) {
state = RedundantState.FAULT;
} else {
state = RedundantState.UNKNOWN;
}
if (lines[1].startsWith("Bumped: YES")) {
isBumped = true;
} else {
isBumped = false;
}
return true;
}

public void setState(RedundantState state) {
public void setState(final RedundantState state) {
this.state = state;
}

public RedundantState getState() {
return state;
}

public boolean isBumped() {
return isBumped;
}

public void setIsBumped(boolean isBumped) {
this.isBumped = isBumped;
}

}
}
6 changes: 2 additions & 4 deletions core/src/com/cloud/agent/api/SetupGuestNetworkCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class SetupGuestNetworkCommand extends NetworkElementCommand {
String defaultDns1 = null;
String defaultDns2 = null;
boolean isRedundant = false;
Integer priority;
boolean add = true;
NicTO nic;

Expand Down Expand Up @@ -60,14 +59,13 @@ public boolean executeInSequence() {
protected SetupGuestNetworkCommand() {
}

public SetupGuestNetworkCommand(String dhcpRange, String networkDomain, boolean isRedundant, Integer priority, String defaultDns1, String defaultDns2, boolean add,
NicTO nic) {
public SetupGuestNetworkCommand(final String dhcpRange, final String networkDomain, final boolean isRedundant, final String defaultDns1, final String defaultDns2, final boolean add,
final NicTO nic) {
this.dhcpRange = dhcpRange;
this.networkDomain = networkDomain;
this.defaultDns1 = defaultDns1;
this.defaultDns2 = defaultDns2;
this.isRedundant = isRedundant;
this.priority = priority;
this.add = add;
this.nic = nic;
}
Expand Down
Loading

0 comments on commit 3d22a16

Please sign in to comment.