Merge branch '4.20'

This commit is contained in:
Suresh Kumar Anaparti 2025-08-29 15:36:16 +05:30
commit 2eb80e0361
No known key found for this signature in database
GPG Key ID: D7CEAE3A9E71D0AA
10 changed files with 53 additions and 20 deletions

View File

@ -50,6 +50,9 @@ public class SecurityGroupVMMapVO implements InternalIdentity {
@Column(name = "ip4_address", table = "nics", insertable = false, updatable = false) @Column(name = "ip4_address", table = "nics", insertable = false, updatable = false)
private String guestIpAddress; private String guestIpAddress;
@Column(name = "ip6_address", table = "nics", insertable = false, updatable = false)
private String guestIpv6Address;
@Column(name = "state", table = "vm_instance", insertable = false, updatable = false) @Column(name = "state", table = "vm_instance", insertable = false, updatable = false)
private State vmState; private State vmState;
@ -77,6 +80,10 @@ public class SecurityGroupVMMapVO implements InternalIdentity {
return guestIpAddress; return guestIpAddress;
} }
public String getGuestIpv6Address() {
return guestIpv6Address;
}
public long getInstanceId() { public long getInstanceId() {
return instanceId; return instanceId;
} }

View File

@ -3875,10 +3875,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
public synchronized String attachOrDetachISO(final Connect conn, final String vmName, String isoPath, final boolean isAttach, final Integer diskSeq) throws LibvirtException, URISyntaxException, public synchronized String attachOrDetachISO(final Connect conn, final String vmName, String isoPath, final boolean isAttach, final Integer diskSeq) throws LibvirtException, URISyntaxException,
InternalErrorException { InternalErrorException {
final DiskDef iso = new DiskDef(); final DiskDef iso = new DiskDef();
if (isAttach && StringUtils.isNotBlank(isoPath) && isoPath.lastIndexOf("/") > 0) { if (isAttach && StringUtils.isNotBlank(isoPath)) {
if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) && isoPath.contains(vmName)) { if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) || isoPath.contains(vmName)) {
iso.defISODisk(isoPath, diskSeq, DiskDef.DiskType.FILE); iso.defISODisk(isoPath, diskSeq, DiskDef.DiskType.FILE);
} else { } else if (isoPath.lastIndexOf("/") > 0) {
final int index = isoPath.lastIndexOf("/"); final int index = isoPath.lastIndexOf("/");
final String path = isoPath.substring(0, index); final String path = isoPath.substring(0, index);
final String name = isoPath.substring(index + 1); final String name = isoPath.substring(index + 1);
@ -3902,7 +3902,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
cleanupDisk(disk); cleanupDisk(disk);
} }
} }
} }
return result; return result;
} }

View File

@ -1018,7 +1018,7 @@ public final class LibvirtMigrateCommandWrapper extends CommandWrapper<MigrateCo
Node sourceNode = diskChildNode; Node sourceNode = diskChildNode;
NamedNodeMap sourceNodeAttributes = sourceNode.getAttributes(); NamedNodeMap sourceNodeAttributes = sourceNode.getAttributes();
Node sourceNodeAttribute = sourceNodeAttributes.getNamedItem("file"); Node sourceNodeAttribute = sourceNodeAttributes.getNamedItem("file");
if ( sourceNodeAttribute.getNodeValue().contains(vmName)) { if (sourceNodeAttribute != null && sourceNodeAttribute.getNodeValue().contains(vmName)) {
diskNode.removeChild(diskChildNode); diskNode.removeChild(diskChildNode);
Element newChildSourceNode = doc.createElement("source"); Element newChildSourceNode = doc.createElement("source");
newChildSourceNode.setAttribute("file", isoPath); newChildSourceNode.setAttribute("file", isoPath);

View File

@ -322,17 +322,19 @@ public class KVMStoragePoolManager {
String uuid = null; String uuid = null;
String sourceHost = ""; String sourceHost = "";
StoragePoolType protocol = null; StoragePoolType protocol = null;
final String scheme = (storageUri.getScheme() != null) ? storageUri.getScheme().toLowerCase() : "";
List<String> acceptedSchemes = List.of("nfs", "networkfilesystem", "filesystem"); List<String> acceptedSchemes = List.of("nfs", "networkfilesystem", "filesystem");
if (acceptedSchemes.contains(scheme)) { if (storageUri.getScheme() == null || !acceptedSchemes.contains(storageUri.getScheme().toLowerCase())) {
throw new CloudRuntimeException("Empty or unsupported storage pool uri scheme");
}
final String scheme = storageUri.getScheme().toLowerCase();
sourcePath = storageUri.getPath(); sourcePath = storageUri.getPath();
sourcePath = sourcePath.replace("//", "/"); sourcePath = sourcePath.replace("//", "/");
sourceHost = storageUri.getHost(); sourceHost = storageUri.getHost();
uuid = UUID.nameUUIDFromBytes(new String(sourceHost + sourcePath).getBytes()).toString(); uuid = UUID.nameUUIDFromBytes(new String(sourceHost + sourcePath).getBytes()).toString();
protocol = scheme.equals("filesystem") ? StoragePoolType.Filesystem: StoragePoolType.NetworkFilesystem; protocol = scheme.equals("filesystem") ? StoragePoolType.Filesystem: StoragePoolType.NetworkFilesystem;
}
// secondary storage registers itself through here // storage registers itself through here
return createStoragePool(uuid, sourceHost, 0, sourcePath, "", protocol, null, false); return createStoragePool(uuid, sourceHost, 0, sourcePath, "", protocol, null, false);
} }

View File

@ -761,10 +761,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
@Override @Override
public KVMStoragePool createStoragePool(String name, String host, int port, String path, String userInfo, StoragePoolType type, Map<String, String> details, boolean isPrimaryStorage) { public KVMStoragePool createStoragePool(String name, String host, int port, String path, String userInfo, StoragePoolType type, Map<String, String> details, boolean isPrimaryStorage) {
logger.info("Attempting to create storage pool " + name + " (" + type.toString() + ") in libvirt"); logger.info("Attempting to create storage pool {} ({}) in libvirt", name, type);
StoragePool sp;
StoragePool sp = null; Connect conn;
Connect conn = null;
try { try {
conn = LibvirtConnection.getConnection(); conn = LibvirtConnection.getConnection();
} catch (LibvirtException e) { } catch (LibvirtException e) {

View File

@ -40,7 +40,7 @@ public class VmMetricsStatsResponse extends BaseResponse {
private String displayName; private String displayName;
@SerializedName("stats") @SerializedName("stats")
@Param(description = "the list of VM stats") @Param(description = "the list of VM stats", responseObject = StatsResponse.class)
private List<StatsResponse> stats; private List<StatsResponse> stats;
public void setId(String id) { public void setId(String id) {

View File

@ -355,6 +355,9 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
String cidr = defaultNic.getIPv4Address(); String cidr = defaultNic.getIPv4Address();
cidr = cidr + "/32"; cidr = cidr + "/32";
cidrs.add(cidr); cidrs.add(cidr);
if (defaultNic.getIPv6Address() != null) {
cidrs.add(defaultNic.getIPv6Address() + "/64");
}
} }
} }
} else if (rule.getAllowedSourceIpCidr() != null) { } else if (rule.getAllowedSourceIpCidr() != null) {

View File

@ -249,6 +249,9 @@ public class SecurityGroupManagerImpl2 extends SecurityGroupManagerImpl {
//did a join with the nics table //did a join with the nics table
String cidr = ngmapVO.getGuestIpAddress() + "/32"; String cidr = ngmapVO.getGuestIpAddress() + "/32";
cidrs.add(cidr); cidrs.add(cidr);
if (ngmapVO.getGuestIpv6Address() != null) {
cidrs.add(ngmapVO.getGuestIpv6Address() + "/64");
}
} }
} else if (rule.getAllowedSourceIpCidr() != null) { } else if (rule.getAllowedSourceIpCidr() != null) {
cidrs.add(rule.getAllowedSourceIpCidr()); cidrs.add(rule.getAllowedSourceIpCidr());

View File

@ -18,13 +18,33 @@
STATUS=UNKNOWN STATUS=UNKNOWN
get_guest_nics() {
python3 -c "
import json
data = json.load(open('/etc/cloudstack/ips.json'))
for nic, objs in data.items():
if isinstance(objs, list):
for obj in objs:
if obj.get('nw_type') == 'guest' and obj.get('add'):
print(nic)
"
}
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
if [ "$ROUTER_TYPE" = "vpcrouter" ];then
GUEST_NICS=$(get_guest_nics)
if [ "$GUEST_NICS" = "" ];then
echo "Status: ${STATUS}"
exit
fi
fi
if [ "$(systemctl is-active keepalived)" != "active" ] if [ "$(systemctl is-active keepalived)" != "active" ]
then then
echo "Status: FAULT" echo "Status: FAULT"
exit exit
fi fi
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
if [ "$ROUTER_TYPE" = "router" ] if [ "$ROUTER_TYPE" = "router" ]
then then
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') 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')

View File

@ -228,7 +228,7 @@ export default {
label: 'label.change.offering.for.volume', label: 'label.change.offering.for.volume',
args: ['id', 'diskofferingid', 'size', 'miniops', 'maxiops', 'automigrate'], args: ['id', 'diskofferingid', 'size', 'miniops', 'maxiops', 'automigrate'],
dataView: true, dataView: true,
show: (record, store) => { return ['Allocated', 'Ready'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) }, show: (record, store) => { return ['Allocated', 'Ready'].includes(record.state) },
popup: true, popup: true,
component: shallowRef(defineAsyncComponent(() => import('@/views/storage/ChangeOfferingForVolume.vue'))) component: shallowRef(defineAsyncComponent(() => import('@/views/storage/ChangeOfferingForVolume.vue')))
}, },