Skip to content

Commit 62259f7

Browse files
Merge branch 'main' into api-keypair-restructure
2 parents 72a62ed + f8d8a9c commit 62259f7

File tree

583 files changed

+37237
-2087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

583 files changed

+37237
-2087
lines changed

.asf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ github:
5959
- hsato03
6060
- bernardodemarco
6161
- abh1sar
62+
- FelipeM525
6263

6364
protected_branches: ~
6465

agent/conf/log4j-cloud.xml.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ under the License.
3030
<Policies>
3131
<TimeBasedTriggeringPolicy/>
3232
</Policies>
33-
<PatternLayout pattern="%d{ISO8601} %-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%ex%n"/>
33+
<PatternLayout pattern="%d{DEFAULT} %-5p [%c{3}] (%t:%x) (logid:%X{logcontextid}) %m%ex%n"/>
3434
</RollingFile>
3535

3636
<!-- ============================== -->

agent/src/main/java/com/cloud/agent/Agent.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,13 @@ protected void setupStartupCommand(final StartupCommand startup) {
504504
startup.setGuid(getResourceGuid());
505505
startup.setResourceName(getResourceName());
506506
startup.setVersion(getVersion());
507+
startup.setArch(getAgentArch());
508+
}
509+
510+
protected String getAgentArch() {
511+
final Script command = new Script("/usr/bin/arch", 500, logger);
512+
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
513+
return command.execute(parser);
507514
}
508515

509516
@Override
@@ -858,11 +865,21 @@ public void processReadyCommand(final Command cmd) {
858865
setId(ready.getHostId());
859866
}
860867

868+
verifyAgentArch(ready.getArch());
861869
processManagementServerList(ready.getMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval());
862870

863871
logger.info("Ready command is processed for agent id = {}", getId());
864872
}
865873

874+
private void verifyAgentArch(String arch) {
875+
if (StringUtils.isNotBlank(arch)) {
876+
String agentArch = getAgentArch();
877+
if (!arch.equals(agentArch)) {
878+
logger.error("Unexpected arch {}, expected {}", agentArch, arch);
879+
}
880+
}
881+
}
882+
866883
public void processOtherTask(final Task task) {
867884
final Object obj = task.get();
868885
if (obj instanceof Response) {
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api.to;
18+
19+
import org.apache.cloudstack.storage.object.Bucket;
20+
21+
public final class BucketTO {
22+
23+
private String name;
24+
25+
private String accessKey;
26+
27+
private String secretKey;
28+
29+
public BucketTO(Bucket bucket) {
30+
this.name = bucket.getName();
31+
this.accessKey = bucket.getAccessKey();
32+
this.secretKey = bucket.getSecretKey();
33+
}
34+
35+
public BucketTO(String name) {
36+
this.name = name;
37+
}
38+
39+
public String getName() {
40+
return this.name;
41+
}
42+
43+
public String getAccessKey() {
44+
return this.accessKey;
45+
}
46+
47+
public String getSecretKey() {
48+
return this.secretKey;
49+
}
50+
}

api/src/main/java/com/cloud/agent/api/to/FirewallRuleTO.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,7 @@ public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, Firewa
155155
rule.getIcmpType(),
156156
rule.getIcmpCode());
157157
this.trafficType = trafficType;
158-
if (FirewallRule.Purpose.Ipv6Firewall.equals(purpose)) {
159-
this.destCidrList = rule.getDestinationCidrList();
160-
}
158+
this.destCidrList = rule.getDestinationCidrList();
161159
}
162160

163161
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType,
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.bgp;
18+
19+
import org.apache.cloudstack.acl.InfrastructureEntity;
20+
import org.apache.cloudstack.api.Identity;
21+
import org.apache.cloudstack.api.InternalIdentity;
22+
23+
import java.util.Date;
24+
25+
public interface ASNumber extends InfrastructureEntity, InternalIdentity, Identity {
26+
27+
Long getAccountId();
28+
Long getDomainId();
29+
long getAsNumber();
30+
long getAsNumberRangeId();
31+
long getDataCenterId();
32+
Date getAllocatedTime();
33+
boolean isAllocated();
34+
Long getNetworkId();
35+
Long getVpcId();
36+
Date getCreated();
37+
Date getRemoved();
38+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.bgp;
18+
19+
import org.apache.cloudstack.acl.InfrastructureEntity;
20+
import org.apache.cloudstack.api.Identity;
21+
import org.apache.cloudstack.api.InternalIdentity;
22+
23+
import java.util.Date;
24+
25+
public interface ASNumberRange extends InfrastructureEntity, InternalIdentity, Identity {
26+
27+
long getStartASNumber();
28+
long getEndASNumber();
29+
long getDataCenterId();
30+
Date getCreated();
31+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.bgp;
18+
19+
import com.cloud.exception.ResourceUnavailableException;
20+
import com.cloud.network.Network;
21+
import com.cloud.network.vpc.Vpc;
22+
import com.cloud.utils.Pair;
23+
import org.apache.cloudstack.api.command.user.bgp.ListASNumbersCmd;
24+
25+
import java.util.List;
26+
27+
public interface BGPService {
28+
29+
ASNumberRange createASNumberRange(long zoneId, long startASNumber, long endASNumber);
30+
List<ASNumberRange> listASNumberRanges(Long zoneId);
31+
Pair<List<ASNumber>, Integer> listASNumbers(ListASNumbersCmd cmd);
32+
boolean allocateASNumber(long zoneId, Long asNumber, Long networkId, Long vpcId);
33+
Pair<Boolean, String> releaseASNumber(long zoneId, long asNumber, boolean isReleaseNetworkDestroy);
34+
boolean deleteASRange(long id);
35+
36+
boolean applyBgpPeers(Network network, boolean continueOnError) throws ResourceUnavailableException;
37+
38+
boolean applyBgpPeers(Vpc vpc, boolean continueOnError) throws ResourceUnavailableException;
39+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.cpu;
18+
19+
import com.cloud.utils.exception.CloudRuntimeException;
20+
import org.apache.commons.lang3.StringUtils;
21+
22+
import java.util.LinkedHashMap;
23+
import java.util.Map;
24+
25+
public class CPU {
26+
27+
public static final String archX86Identifier = "i686";
28+
public static final String archX86_64Identifier = "x86_64";
29+
public static final String archARM64Identifier = "aarch64";
30+
31+
public static class CPUArch {
32+
private static final Map<String, CPUArch> cpuArchMap = new LinkedHashMap<>();
33+
34+
public static final CPUArch archX86 = new CPUArch(archX86Identifier, 32);
35+
public static final CPUArch amd64 = new CPUArch(archX86_64Identifier, 64);
36+
public static final CPUArch arm64 = new CPUArch(archARM64Identifier, 64);
37+
38+
private String type;
39+
private int bits;
40+
41+
public CPUArch(String type, int bits) {
42+
this.type = type;
43+
this.bits = bits;
44+
cpuArchMap.put(type, this);
45+
}
46+
47+
public String getType() {
48+
return this.type;
49+
}
50+
51+
public int getBits() {
52+
return this.bits;
53+
}
54+
55+
public static CPUArch fromType(String type) {
56+
if (StringUtils.isBlank(type)) {
57+
return amd64;
58+
}
59+
switch (type) {
60+
case archX86Identifier: return archX86;
61+
case archX86_64Identifier: return amd64;
62+
case archARM64Identifier: return arm64;
63+
default: throw new CloudRuntimeException(String.format("Unsupported arch type: %s", type));
64+
}
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)