Skip to content

Commit 2eb80e0

Browse files
Merge branch '4.20'
2 parents 2105794 + ca62a7d commit 2eb80e0

File tree

10 files changed

+53
-20
lines changed

10 files changed

+53
-20
lines changed

engine/schema/src/main/java/com/cloud/network/security/SecurityGroupVMMapVO.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public class SecurityGroupVMMapVO implements InternalIdentity {
5050
@Column(name = "ip4_address", table = "nics", insertable = false, updatable = false)
5151
private String guestIpAddress;
5252

53+
@Column(name = "ip6_address", table = "nics", insertable = false, updatable = false)
54+
private String guestIpv6Address;
55+
5356
@Column(name = "state", table = "vm_instance", insertable = false, updatable = false)
5457
private State vmState;
5558

@@ -77,6 +80,10 @@ public String getGuestIpAddress() {
7780
return guestIpAddress;
7881
}
7982

83+
public String getGuestIpv6Address() {
84+
return guestIpv6Address;
85+
}
86+
8087
public long getInstanceId() {
8188
return instanceId;
8289
}

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3875,10 +3875,10 @@ public void detachAndAttachConfigDriveISO(final Connect conn, final String vmNam
38753875
public synchronized String attachOrDetachISO(final Connect conn, final String vmName, String isoPath, final boolean isAttach, final Integer diskSeq) throws LibvirtException, URISyntaxException,
38763876
InternalErrorException {
38773877
final DiskDef iso = new DiskDef();
3878-
if (isAttach && StringUtils.isNotBlank(isoPath) && isoPath.lastIndexOf("/") > 0) {
3879-
if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) && isoPath.contains(vmName)) {
3878+
if (isAttach && StringUtils.isNotBlank(isoPath)) {
3879+
if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) || isoPath.contains(vmName)) {
38803880
iso.defISODisk(isoPath, diskSeq, DiskDef.DiskType.FILE);
3881-
} else {
3881+
} else if (isoPath.lastIndexOf("/") > 0) {
38823882
final int index = isoPath.lastIndexOf("/");
38833883
final String path = isoPath.substring(0, index);
38843884
final String name = isoPath.substring(index + 1);
@@ -3902,7 +3902,6 @@ public synchronized String attachOrDetachISO(final Connect conn, final String vm
39023902
cleanupDisk(disk);
39033903
}
39043904
}
3905-
39063905
}
39073906
return result;
39083907
}

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ private boolean findSourceNode(Document doc, Node diskNode, String vmName, Strin
10181018
Node sourceNode = diskChildNode;
10191019
NamedNodeMap sourceNodeAttributes = sourceNode.getAttributes();
10201020
Node sourceNodeAttribute = sourceNodeAttributes.getNamedItem("file");
1021-
if ( sourceNodeAttribute.getNodeValue().contains(vmName)) {
1021+
if (sourceNodeAttribute != null && sourceNodeAttribute.getNodeValue().contains(vmName)) {
10221022
diskNode.removeChild(diskChildNode);
10231023
Element newChildSourceNode = doc.createElement("source");
10241024
newChildSourceNode.setAttribute("file", isoPath);

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,17 +322,19 @@ public KVMStoragePool getStoragePoolByURI(String uri) {
322322
String uuid = null;
323323
String sourceHost = "";
324324
StoragePoolType protocol = null;
325-
final String scheme = (storageUri.getScheme() != null) ? storageUri.getScheme().toLowerCase() : "";
326325
List<String> acceptedSchemes = List.of("nfs", "networkfilesystem", "filesystem");
327-
if (acceptedSchemes.contains(scheme)) {
328-
sourcePath = storageUri.getPath();
329-
sourcePath = sourcePath.replace("//", "/");
330-
sourceHost = storageUri.getHost();
331-
uuid = UUID.nameUUIDFromBytes(new String(sourceHost + sourcePath).getBytes()).toString();
332-
protocol = scheme.equals("filesystem") ? StoragePoolType.Filesystem: StoragePoolType.NetworkFilesystem;
326+
if (storageUri.getScheme() == null || !acceptedSchemes.contains(storageUri.getScheme().toLowerCase())) {
327+
throw new CloudRuntimeException("Empty or unsupported storage pool uri scheme");
333328
}
334329

335-
// secondary storage registers itself through here
330+
final String scheme = storageUri.getScheme().toLowerCase();
331+
sourcePath = storageUri.getPath();
332+
sourcePath = sourcePath.replace("//", "/");
333+
sourceHost = storageUri.getHost();
334+
uuid = UUID.nameUUIDFromBytes(new String(sourceHost + sourcePath).getBytes()).toString();
335+
protocol = scheme.equals("filesystem") ? StoragePoolType.Filesystem: StoragePoolType.NetworkFilesystem;
336+
337+
// storage registers itself through here
336338
return createStoragePool(uuid, sourceHost, 0, sourcePath, "", protocol, null, false);
337339
}
338340

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,10 +761,9 @@ private boolean decStoragePoolRefCount(String uuid) {
761761

762762
@Override
763763
public KVMStoragePool createStoragePool(String name, String host, int port, String path, String userInfo, StoragePoolType type, Map<String, String> details, boolean isPrimaryStorage) {
764-
logger.info("Attempting to create storage pool " + name + " (" + type.toString() + ") in libvirt");
765-
766-
StoragePool sp = null;
767-
Connect conn = null;
764+
logger.info("Attempting to create storage pool {} ({}) in libvirt", name, type);
765+
StoragePool sp;
766+
Connect conn;
768767
try {
769768
conn = LibvirtConnection.getConnection();
770769
} catch (LibvirtException e) {

plugins/metrics/src/main/java/org/apache/cloudstack/response/VmMetricsStatsResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class VmMetricsStatsResponse extends BaseResponse {
4040
private String displayName;
4141

4242
@SerializedName("stats")
43-
@Param(description = "the list of VM stats")
43+
@Param(description = "the list of VM stats", responseObject = StatsResponse.class)
4444
private List<StatsResponse> stats;
4545

4646
public void setId(String id) {

server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@ protected Map<PortAndProto, Set<String>> generateRulesForVM(Long userVmId, Secur
355355
String cidr = defaultNic.getIPv4Address();
356356
cidr = cidr + "/32";
357357
cidrs.add(cidr);
358+
if (defaultNic.getIPv6Address() != null) {
359+
cidrs.add(defaultNic.getIPv6Address() + "/64");
360+
}
358361
}
359362
}
360363
} else if (rule.getAllowedSourceIpCidr() != null) {

server/src/main/java/com/cloud/network/security/SecurityGroupManagerImpl2.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ protected Map<PortAndProto, Set<String>> generateRulesForVM(Long userVmId, Secur
249249
//did a join with the nics table
250250
String cidr = ngmapVO.getGuestIpAddress() + "/32";
251251
cidrs.add(cidr);
252+
if (ngmapVO.getGuestIpv6Address() != null) {
253+
cidrs.add(ngmapVO.getGuestIpv6Address() + "/64");
254+
}
252255
}
253256
} else if (rule.getAllowedSourceIpCidr() != null) {
254257
cidrs.add(rule.getAllowedSourceIpCidr());

systemvm/debian/opt/cloud/bin/checkrouter.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,33 @@
1818

1919
STATUS=UNKNOWN
2020

21+
get_guest_nics() {
22+
python3 -c "
23+
import json
24+
data = json.load(open('/etc/cloudstack/ips.json'))
25+
for nic, objs in data.items():
26+
if isinstance(objs, list):
27+
for obj in objs:
28+
if obj.get('nw_type') == 'guest' and obj.get('add'):
29+
print(nic)
30+
"
31+
}
32+
33+
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
34+
if [ "$ROUTER_TYPE" = "vpcrouter" ];then
35+
GUEST_NICS=$(get_guest_nics)
36+
if [ "$GUEST_NICS" = "" ];then
37+
echo "Status: ${STATUS}"
38+
exit
39+
fi
40+
fi
41+
2142
if [ "$(systemctl is-active keepalived)" != "active" ]
2243
then
2344
echo "Status: FAULT"
2445
exit
2546
fi
2647

27-
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
2848
if [ "$ROUTER_TYPE" = "router" ]
2949
then
3050
ROUTER_STATE=$(ip -4 addr show dev eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo "PRIMARY"; else echo "BACKUP"; fi')

ui/src/config/section/storage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export default {
228228
label: 'label.change.offering.for.volume',
229229
args: ['id', 'diskofferingid', 'size', 'miniops', 'maxiops', 'automigrate'],
230230
dataView: true,
231-
show: (record, store) => { return ['Allocated', 'Ready'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) },
231+
show: (record, store) => { return ['Allocated', 'Ready'].includes(record.state) },
232232
popup: true,
233233
component: shallowRef(defineAsyncComponent(() => import('@/views/storage/ChangeOfferingForVolume.vue')))
234234
},

0 commit comments

Comments
 (0)