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)
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)
private State vmState;
@ -77,6 +80,10 @@ public class SecurityGroupVMMapVO implements InternalIdentity {
return guestIpAddress;
}
public String getGuestIpv6Address() {
return guestIpv6Address;
}
public long getInstanceId() {
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,
InternalErrorException {
final DiskDef iso = new DiskDef();
if (isAttach && StringUtils.isNotBlank(isoPath) && isoPath.lastIndexOf("/") > 0) {
if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) && isoPath.contains(vmName)) {
if (isAttach && StringUtils.isNotBlank(isoPath)) {
if (isoPath.startsWith(getConfigPath() + "/" + ConfigDrive.CONFIGDRIVEDIR) || isoPath.contains(vmName)) {
iso.defISODisk(isoPath, diskSeq, DiskDef.DiskType.FILE);
} else {
} else if (isoPath.lastIndexOf("/") > 0) {
final int index = isoPath.lastIndexOf("/");
final String path = isoPath.substring(0, index);
final String name = isoPath.substring(index + 1);
@ -3902,7 +3902,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
cleanupDisk(disk);
}
}
}
return result;
}

View File

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

View File

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

View File

@ -761,10 +761,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
@Override
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");
StoragePool sp = null;
Connect conn = null;
logger.info("Attempting to create storage pool {} ({}) in libvirt", name, type);
StoragePool sp;
Connect conn;
try {
conn = LibvirtConnection.getConnection();
} catch (LibvirtException e) {

View File

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

View File

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

View File

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

View File

@ -18,13 +18,33 @@
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" ]
then
echo "Status: FAULT"
exit
fi
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
if [ "$ROUTER_TYPE" = "router" ]
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')

View File

@ -228,7 +228,7 @@ export default {
label: 'label.change.offering.for.volume',
args: ['id', 'diskofferingid', 'size', 'miniops', 'maxiops', 'automigrate'],
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,
component: shallowRef(defineAsyncComponent(() => import('@/views/storage/ChangeOfferingForVolume.vue')))
},