Skip to content

Commit eb68c48

Browse files
authored
Merge branch 'ablecloud-team:ablestack-europa' into ablestack-europa
2 parents fb5cd36 + 6617228 commit eb68c48

38 files changed

Lines changed: 2105 additions & 1632 deletions

File tree

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,10 @@ public class ApiConstants {
14141414
public static final String LISTHOSTDEVICES = "listhostdevices";
14151415
public static final String HOSTDEVICES_NAME = "hostdevicesname";
14161416
public static final String HOSTDEVICES_TEXT = "hostdevicestext";
1417+
public static final String HOSTDEVICES_TYPE = "hostdevicestype";
1418+
public static final String DEVICE_TYPE = "devicetype";
1419+
public static final String LUN_PATH_MODE = "lunpathmode";
1420+
14171421
// Object Storage related
14181422
public static final String BUCKET_AVAILABLE = "bucketavailable";
14191423
public static final String BUCKET_LIMIT = "bucketlimit";
@@ -1423,8 +1427,6 @@ public class ApiConstants {
14231427
public static final String OBJECT_STORAGE_AVAILABLE = "objectstorageavailable";
14241428
public static final String OBJECT_STORAGE_LIMIT = "objectstoragelimit";
14251429
public static final String OBJECT_STORAGE_TOTAL = "objectstoragetotal";
1426-
public static final String HOSTDEVICES_TYPE = "hostdevicestype";
1427-
public static final String DEVICE_TYPE = "devicetype";
14281430

14291431
public static final String PARAMETER_DESCRIPTION_ACTIVATION_RULE = "Quota tariff's activation rule. It can receive a JS script that results in either " +
14301432
"a boolean or a numeric value: if it results in a boolean value, the tariff value will be applied according to the result; if it results in a numeric value, the " +

api/src/main/java/org/apache/cloudstack/api/command/admin/outofbandmanagement/ListHostLunDevicesCmd.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.apache.cloudstack.api.BaseListCmd;
2525
import org.apache.cloudstack.api.Parameter;
2626
import org.apache.cloudstack.api.response.ListHostLunDevicesResponse;
27-
import org.apache.cloudstack.context.CallContext;
2827
import org.apache.cloudstack.api.response.ListResponse;
28+
import org.apache.cloudstack.context.CallContext;
2929

3030

3131

@@ -42,6 +42,9 @@ public class ListHostLunDevicesCmd extends BaseListCmd {
4242
ApiArgValidator.PositiveNumber })
4343
private Long id;
4444

45+
@Parameter(name = ApiConstants.LUN_PATH_MODE, type = BaseCmd.CommandType.STRING, description = "LUN listing: single (paths not in multipath -ll) or multipath (dm/mpath from multipath -ll)")
46+
private String lunPathMode;
47+
4548
/////////////////////////////////////////////////////
4649
/////////////////// Accessors ///////////////////////a
4750
/////////////////////////////////////////////////////
@@ -50,6 +53,14 @@ public Long getId() {
5053
return id;
5154
}
5255

56+
public String getLunPathMode() {
57+
return lunPathMode;
58+
}
59+
60+
public void setLunPathMode(String lunPathMode) {
61+
this.lunPathMode = lunPathMode;
62+
}
63+
5364
/////////////////////////////////////////////////////
5465
/////////////// API Implementation///////////////////
5566
/////////////////////////////////////////////////////

core/src/main/java/com/cloud/agent/api/ListHostLunDeviceCommand.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,23 @@
2323

2424
public class ListHostLunDeviceCommand extends Command {
2525

26+
public static final String MODE_SINGLE = "single";
27+
public static final String MODE_MULTIPATH = "multipath";
28+
2629
private final Long id;
30+
private String lunPathMode = MODE_SINGLE;
2731
private List<String> hostDevicesName;
2832
private List<String> hostDevicesText;
2933

3034
public ListHostLunDeviceCommand(Long id) {
35+
this(id, MODE_SINGLE);
36+
}
37+
38+
public ListHostLunDeviceCommand(Long id, String lunPathMode) {
3139
this.id = id;
40+
if (lunPathMode != null && !lunPathMode.trim().isEmpty()) {
41+
this.lunPathMode = lunPathMode.trim().toLowerCase();
42+
}
3243
}
3344

3445
@Override
@@ -40,6 +51,16 @@ public Long getId() {
4051
return id;
4152
}
4253

54+
public String getLunPathMode() {
55+
return lunPathMode;
56+
}
57+
58+
public void setLunPathMode(String lunPathMode) {
59+
if (lunPathMode != null && !lunPathMode.trim().isEmpty()) {
60+
this.lunPathMode = lunPathMode.trim().toLowerCase();
61+
}
62+
}
63+
4364
public List<String> getHostDevicesName() {
4465
return hostDevicesName;
4566
}

core/src/main/java/com/cloud/agent/api/routing/LoadBalancerConfigCommand.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ public class LoadBalancerConfigCommand extends NetworkElementCommand {
3636
public String lbStatsAuth = "admin1:AdMiN123";
3737
public String lbStatsUri = "/admin?stats";
3838
public String maxconn = "";
39+
public String lbConnectTimeout = "5000";
40+
public String lbClientTimeout = "50000";
41+
public String lbServerTimeout = "50000";
3942
public String lbProtocol;
4043
public boolean keepAliveEnabled = false;
4144
NicTO nic;

core/src/main/java/com/cloud/network/HAProxyConfigurator.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
4646

4747
protected Logger logger = LogManager.getLogger(getClass());
4848
private static final String blankLine = "\t ";
49+
private static final String defaultConnectTimeout = "5000";
50+
private static final String defaultClientTimeout = "50000";
51+
private static final String defaultServerTimeout = "50000";
4952
private static String[] globalSection = {"global", "\tlog 127.0.0.1:3914 local0 warning", "\tmaxconn 4096", "\tmaxpipes 1024", "\tchroot /var/lib/haproxy",
5053
"\tuser haproxy", "\tgroup haproxy", "\tstats socket /run/haproxy/admin.sock", "\tdaemon"};
5154

@@ -82,7 +85,7 @@ public String[] generateConfiguration(final List<PortForwardingRuleTO> fwRules)
8285

8386
result.addAll(Arrays.asList(globalSection));
8487
result.add(blankLine);
85-
result.addAll(Arrays.asList(defaultsSection));
88+
result.addAll(getDefaultsSection(defaultConnectTimeout, defaultClientTimeout, defaultServerTimeout, false));
8689
result.add(blankLine);
8790

8891
if (pools.isEmpty()) {
@@ -631,10 +634,7 @@ public String[] generateConfiguration(final LoadBalancerConfigCommand lbCmd) {
631634
result.addAll(gSection);
632635

633636
result.add(blankLine);
634-
final List<String> dSection = Arrays.asList(defaultsSection);
635-
if (lbCmd.keepAliveEnabled) {
636-
dSection.set(7, "\tno option httpclose");
637-
}
637+
final List<String> dSection = getDefaultsSection(lbCmd.lbConnectTimeout, lbCmd.lbClientTimeout, lbCmd.lbServerTimeout, lbCmd.keepAliveEnabled);
638638

639639
if (logger.isDebugEnabled()) {
640640
for (final String s : dSection) {
@@ -751,4 +751,18 @@ private void addSslCertEntry(Set<SslCertEntry> sslCertEntries, LoadBalancerTO lb
751751
final SslCertEntry sslCertEntry = new SslCertEntry(name, cert.getCert(), cert.getKey(), cert.getChain(), cert.getPassword());
752752
sslCertEntries.add(sslCertEntry);
753753
}
754+
755+
private List<String> getDefaultsSection(final String connectTimeout, final String clientTimeout, final String serverTimeout, final boolean keepAliveEnabled) {
756+
final List<String> dSection = new ArrayList<>(Arrays.asList(defaultsSection));
757+
final String effectiveConnectTimeout = StringUtils.isBlank(connectTimeout) ? defaultConnectTimeout : connectTimeout;
758+
final String effectiveClientTimeout = StringUtils.isBlank(clientTimeout) ? defaultClientTimeout : clientTimeout;
759+
final String effectiveServerTimeout = StringUtils.isBlank(serverTimeout) ? defaultServerTimeout : serverTimeout;
760+
dSection.set(8, "\ttimeout connect " + effectiveConnectTimeout);
761+
dSection.set(9, "\ttimeout client " + effectiveClientTimeout);
762+
dSection.set(10, "\ttimeout server " + effectiveServerTimeout);
763+
if (keepAliveEnabled) {
764+
dSection.set(7, "\tno option httpclose");
765+
}
766+
return dSection;
767+
}
754768
}

0 commit comments

Comments
 (0)