Skip to content

Commit 44abe66

Browse files
authored
Merge branch 'apache:main' into main
2 parents f846343 + 1b041ee commit 44abe66

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

scripts/vm/network/security_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ def verify_iptables_rules_for_bridge(brname):
14551455
expected_rules.append("-A %s -m state --state RELATED,ESTABLISHED -j ACCEPT" % (brfw))
14561456
expected_rules.append("-A %s -m physdev --physdev-is-in --physdev-is-bridged -j %s" % (brfw, brfwin))
14571457
expected_rules.append("-A %s -m physdev --physdev-is-out --physdev-is-bridged -j %s" % (brfw, brfwout))
1458-
phydev = execute("ip link show type bridge | awk '/^%s[ \t]/ {print $4}'" % brname ).strip()
1458+
phydev = get_bridge_physdev(brname)
14591459
expected_rules.append("-A %s -m physdev --physdev-out %s --physdev-is-bridged -j ACCEPT" % (brfw, phydev))
14601460

14611461
rules = execute("iptables-save |grep -w %s |grep -v \"^:\"" % brfw).split('\n')

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,11 @@ private void checkUnmanagedNicAndNetworkForImport(UnmanagedInstanceTO.Nic nic, N
608608
!networkBroadcastUri.equals(String.format("vlan://%d", nic.getVlan())))) {
609609
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("VLAN of network(ID: %s) %s is found different from the VLAN of nic(ID: %s) vlan://%d during VM import", network.getUuid(), networkBroadcastUri, nic.getNicId(), nic.getVlan()));
610610
}
611+
String pvLanType = nic.getPvlanType() == null ? "" : nic.getPvlanType().toLowerCase().substring(0, 1);
611612
if (nic.getVlan() != null && nic.getVlan() != 0 && nic.getPvlan() != null && nic.getPvlan() != 0 &&
612613
(Strings.isNullOrEmpty(network.getBroadcastUri().toString()) ||
613-
!networkBroadcastUri.equals(String.format("pvlan://%d-i%d", nic.getVlan(), nic.getPvlan())))) {
614-
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("PVLAN of network(ID: %s) %s is found different from the VLAN of nic(ID: %s) pvlan://%d-i%d during VM import", network.getUuid(), networkBroadcastUri, nic.getNicId(), nic.getVlan(), nic.getPvlan()));
614+
!networkBroadcastUri.equals(String.format("pvlan://%d-%s%d", nic.getVlan(), pvLanType, nic.getPvlan())))) {
615+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, String.format("PVLAN of network(ID: %s) %s is found different from the VLAN of nic(ID: %s) pvlan://%d-%s%d during VM import", network.getUuid(), networkBroadcastUri, nic.getNicId(), nic.getVlan(), pvLanType, nic.getPvlan()));
615616
}
616617
}
617618

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
# clear processed files in /var/cache/cloud/processed
20+
21+
THRESHOLD=80
22+
DIRECTORY=/var/cache/cloud/processed
23+
DAYS=180
24+
MIN_DAYS=5
25+
26+
if [ ! -d $DIRECTORY ];then
27+
echo "$DIRECTORY not found"
28+
exit 0
29+
fi
30+
31+
percent=$(df --output=pcent $DIRECTORY | tr -dc '0-9')
32+
33+
while [[ $percent -gt $THRESHOLD ]] && [[ $DAYS -gt $MIN_DAYS ]];do
34+
echo "Removing files in $DIRECTORY older than $DAYS days"
35+
find $DIRECTORY -type f -a -mtime +$DAYS -delete
36+
DAYS=$((DAYS-1))
37+
percent=$(df --output=pcent $DIRECTORY | tr -dc '0-9')
38+
done

test/integration/component/test_multiple_nic_support.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def setUpClass(cls):
225225
cls.virtual_machine1.default_network_id = nic.networkid
226226
break
227227
except Exception as e:
228-
cls.fail("Exception while deploying virtual machine: %s" % e)
228+
cls.fail(f"Exception while deploying virtual machine: {e}")
229229

230230
try:
231231
cls.virtual_machine2 = VirtualMachine.create(
@@ -244,7 +244,7 @@ def setUpClass(cls):
244244
cls.virtual_machine2.default_network_id = nic.networkid
245245
break
246246
except Exception as e:
247-
cls.fail("Exception while deploying virtual machine: %s" % e)
247+
cls.fail(f"Exception while deploying virtual machine: {e}")
248248

249249
cls._cleanup.append(cls.virtual_machine1)
250250
cls._cleanup.append(cls.virtual_machine2)
@@ -307,7 +307,7 @@ def verify_network_rules(self, vm_id):
307307
if len(result) > 0:
308308
self.fail("The iptables/ebtables rules for nic %s on vm %s on host %s are not correct" %(nic.ipaddress, vm.instancename, host.name))
309309

310-
@attr(tags=["adeancedsg"], required_hardware="false")
310+
@attr(tags=["advancedsg"], required_hardware="false")
311311
def test_01_create_vm_with_multiple_nics(self):
312312
"""Create Vm with multiple NIC's
313313

0 commit comments

Comments
 (0)