Skip to content

Commit fd6b755

Browse files
committed
Merge remote-tracking branch 'apache/4.22'
2 parents 3df8b2a + 9872bfd commit fd6b755

102 files changed

Lines changed: 6840 additions & 367 deletions

File tree

Some content is hidden

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

‎api/src/main/java/com/cloud/host/Host.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public static String[] toStrings(Host.Type... types) {
7878
String HOST_CDROM_MAX_COUNT = "host.cdrom.max.count";
7979
String GUEST_OS_CATEGORY_ID = "guest.os.category.id";
8080
String GUEST_OS_RULE = "guest.os.rule";
81+
String HOST_CPU_MAX_SPEED_MHZ = "host.cpu.max.speed.mhz";
8182

8283
int DEFAULT_SSH_PORT = 22;
8384

‎api/src/main/java/com/cloud/vm/VmDetailConstants.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public interface VmDetailConstants {
5858
// KVM specific, disk controllers
5959
String KVM_SKIP_FORCE_DISK_CONTROLLER = "skip.force.disk.controller";
6060

61+
// KVM specific, configuring special features
62+
String KVM_HINT_DEDICATED = "kvm.hint.dedicated";
63+
6164
// Mac OSX guest specific (internal)
6265
String SMC_PRESENT = "smc.present";
6366
String FIRMWARE = "firmware";

‎api/src/main/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmd.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import java.util.Map;
3333

3434
@APICommand(name = "addObjectStoragePool", description = "Adds a object storage pool", responseObject = ObjectStoreResponse.class, since = "4.19.0",
35-
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
35+
requestHasSensitiveInfo = true, responseHasSensitiveInfo = false)
3636
public class AddObjectStoragePoolCmd extends BaseCmd {
3737

3838
/////////////////////////////////////////////////////

‎api/src/main/java/org/apache/cloudstack/network/Ipv4GuestSubnetNetworkMap.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ enum State {
3636

3737
Long getParentId();
3838

39+
Long getDataCenterId();
40+
3941
String getSubnet();
4042

4143
Long getVpcId();

‎api/src/main/java/org/apache/cloudstack/storage/volume/VolumeImportUnmanageService.java‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import com.cloud.hypervisor.Hypervisor;
2121
import com.cloud.storage.Storage;
22+
import com.cloud.storage.StoragePool;
23+
import com.cloud.storage.Volume;
2224
import com.cloud.utils.component.PluggableService;
2325
import org.apache.cloudstack.api.command.admin.volume.ListVolumesForImportCmd;
2426
import org.apache.cloudstack.api.command.admin.volume.ImportVolumeCmd;
@@ -38,7 +40,8 @@ public interface VolumeImportUnmanageService extends PluggableService, Configura
3840

3941
List<Storage.StoragePoolType> SUPPORTED_STORAGE_POOL_TYPES_FOR_KVM = Arrays.asList(Storage.StoragePoolType.NetworkFilesystem,
4042
Storage.StoragePoolType.Filesystem, Storage.StoragePoolType.RBD, Storage.StoragePoolType.SharedMountPoint,
41-
Storage.StoragePoolType.Linstor);
43+
Storage.StoragePoolType.Linstor,
44+
Storage.StoragePoolType.StorPool);
4245

4346
ConfigKey<Boolean> AllowImportVolumeWithBackingFile = new ConfigKey<>(Boolean.class,
4447
"allow.import.volume.with.backing.file",
@@ -55,4 +58,10 @@ public interface VolumeImportUnmanageService extends PluggableService, Configura
5558

5659
boolean unmanageVolume(long volumeId);
5760

61+
/**
62+
* Lets a storage driver (e.g. StorPool) react to a volume becoming managed/unmanaged, from
63+
* this service or from another import path (e.g. VM import). No-op if unsupported.
64+
*/
65+
void notifyStorageDriverOfVolumeManagementChange(StoragePool pool, Volume volume, boolean imported);
66+
5867
}

‎api/src/test/java/org/apache/cloudstack/api/command/admin/storage/AddObjectStoragePoolCmdTest.java‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.cloud.exception.DiscoveryException;
2222
import com.cloud.storage.StorageService;
23+
import org.apache.cloudstack.api.APICommand;
2324
import org.apache.cloudstack.api.ResponseGenerator;
2425
import org.apache.cloudstack.api.response.ObjectStoreResponse;
2526
import org.apache.cloudstack.context.CallContext;
@@ -38,6 +39,8 @@
3839
import java.util.HashMap;
3940
import java.util.Map;
4041

42+
import static org.junit.Assert.assertNotNull;
43+
import static org.junit.Assert.assertTrue;
4144
import static org.mockito.ArgumentMatchers.any;
4245

4346
@RunWith(MockitoJUnitRunner.class)
@@ -98,4 +101,38 @@ public void testAddObjectStore() throws DiscoveryException {
98101
Mockito.verify(storageService, Mockito.times(1))
99102
.discoverObjectStore(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
100103
}
104+
105+
@Test
106+
public void testRequestIsMarkedAsContainingSensitiveInformation() {
107+
APICommand apiCommand = AddObjectStoragePoolCmd.class.getAnnotation(APICommand.class);
108+
109+
assertNotNull(apiCommand);
110+
assertTrue(apiCommand.requestHasSensitiveInfo());
111+
}
112+
113+
@Test
114+
public void testCredentialsAndProviderOptionsReachDiscoveryUnchanged() throws DiscoveryException {
115+
Map<String, String> expected = new HashMap<>();
116+
expected.put("accesskey", "ACCESS_SENTINEL");
117+
expected.put("secretkey", "SECRET+key&with=symbols");
118+
expected.put("validateSSL", "true");
119+
expected.put("s3Url", "https://s3.example.test");
120+
expected.put("iamUrl", "https://iam.example.test");
121+
Map<Integer, Map<String, String>> indexedDetails = new HashMap<>();
122+
int index = 0;
123+
for (Map.Entry<String, String> entry : expected.entrySet()) {
124+
Map<String, String> detail = new HashMap<>();
125+
detail.put("key", entry.getKey());
126+
detail.put("value", entry.getValue());
127+
indexedDetails.put(index++, detail);
128+
}
129+
ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "details", indexedDetails);
130+
Mockito.doReturn(objectStore).when(storageService).discoverObjectStore(Mockito.anyString(),
131+
Mockito.anyString(), Mockito.anyLong(), Mockito.anyString(), any());
132+
Mockito.doReturn(new ObjectStoreResponse()).when(responseGenerator).createObjectStoreResponse(any());
133+
134+
addObjectStoragePoolCmdSpy.execute();
135+
136+
Mockito.verify(storageService).discoverObjectStore(name, url, size, provider, expected);
137+
}
101138
}

‎client/bindir/cloud-update-xenserver-licenses.in‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import glob
2424
from random import choice
2525
import string
2626
from optparse import OptionParser
27-
import mysql.connector
27+
try:
28+
import mysql.connector as mysqldb
29+
except ImportError:
30+
import pymysql as mysqldb
2831
import paramiko
2932
from threading import Thread
3033

@@ -71,7 +74,7 @@ def e(msg):
7174

7275

7376
def getknownhosts(host, username, password):
74-
conn = mysql.connector.connect(host=host, user=username, password=password)
77+
conn = mysqldb.connect(host=host, user=username, password=password)
7578
cur = conn.cursor()
7679
cur.execute(
7780
"SELECT h.private_ip_address,d.value FROM cloud.host h inner join cloud.host_details d on (h.id = d.host_id) where d.name = 'username' and setup = 1"

‎core/src/main/java/org/apache/cloudstack/backup/TakeBackupCommand.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class TakeBackupCommand extends Command {
3939

4040
// Incremental backup fields (NAS provider; null/empty for legacy full-only callers).
4141
private String mode; // "full" or "incremental"; null => legacy behaviour (script default)
42+
private String method; // "qcow2" (bitmaps, push mode) or "content" (pull mode); null => "qcow2"
4243
private String bitmapNew; // Checkpoint/bitmap name to create with this backup (timestamp-based)
4344
private String bitmapParent; // Incremental: parent bitmap to read changes since
4445

@@ -134,6 +135,14 @@ public void setMode(String mode) {
134135
this.mode = mode;
135136
}
136137

138+
public String getMethod() {
139+
return method;
140+
}
141+
142+
public void setMethod(String method) {
143+
this.method = method;
144+
}
145+
137146
public String getBitmapNew() {
138147
return bitmapNew;
139148
}

‎debian/control‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Source: cloudstack
22
Section: libs
33
Priority: extra
44
Maintainer: The Apache CloudStack Team <dev@cloudstack.apache.org>
5-
Build-Depends: debhelper (>= 9), openjdk-17-jdk | java17-sdk | java17-jdk | zulu-17 | openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage,
6-
python-mysql.connector | python3-mysql.connector | mysql-connector-python-py3, maven (>= 3) | maven3,
5+
Build-Depends: debhelper (>= 9), openjdk-17-jdk | java17-sdk | java17-jdk | zulu-17 | openjdk-21-jdk | java21-sdk | java21-jdk | zulu-21 | openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage,
6+
python-mysql.connector | python3-mysql.connector | mysql-connector-python-py3 | python3-pymysql, maven (>= 3) | maven3,
77
python3 (>= 3), python3-setuptools,
88
nodejs (>= 12), lsb-release, dh-systemd | debhelper (>= 13)
99
Standards-Version: 3.8.1
@@ -17,14 +17,14 @@ Description: A common package which contains files which are shared by several C
1717

1818
Package: cloudstack-management
1919
Architecture: all
20-
Depends: ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), net-tools, sudo, python3-mysql.connector | mysql-connector-python-py3, augeas-tools, mysql-client | mariadb-client, adduser, bzip2, ipmitool, file, gawk, iproute2, qemu-utils, rng-tools, python3-dnspython, lsb-release, init-system-helpers (>= 1.14~), python3-setuptools
20+
Depends: ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17 | openjdk-21-jre-headless | java21-runtime-headless | java21-runtime | zulu-21, cloudstack-common (= ${source:Version}), net-tools, sudo, python3-mysql.connector | mysql-connector-python-py3 | python3-pymysql, augeas-tools, mysql-client | mariadb-client, adduser, bzip2, ipmitool, file, gawk, iproute2, qemu-utils, rng-tools, python3-dnspython, lsb-release, init-system-helpers (>= 1.14~), python3-setuptools
2121
Conflicts: cloud-server, cloud-client, cloud-client-ui
2222
Description: CloudStack server library
2323
The CloudStack management server
2424

2525
Package: cloudstack-agent
2626
Architecture: all
27-
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, ovmf, swtpm, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat, python3-libnbd, socat
27+
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17 | openjdk-21-jre-headless | java21-runtime-headless | java21-runtime | zulu-21, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, ovmf, swtpm, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat, python3-libnbd, socat
2828
Recommends: init-system-helpers
2929
Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
3030
Description: CloudStack agent
@@ -34,7 +34,7 @@ Description: CloudStack agent
3434

3535
Package: cloudstack-usage
3636
Architecture: all
37-
Depends: openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), init-system-helpers
37+
Depends: openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17 | openjdk-21-jre-headless | java21-runtime-headless | java21-runtime | zulu-21, cloudstack-common (= ${source:Version}), init-system-helpers
3838
Description: CloudStack usage monitor
3939
The CloudStack usage monitor provides usage accounting across the entire cloud for
4040
cloud operators to charge based on usage parameters.

‎engine/api/src/main/java/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
*/
1919
package org.apache.cloudstack.engine.subsystem.api.storage;
2020

21+
import java.util.List;
2122
import java.util.Map;
2223

2324
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
2425
import org.apache.cloudstack.storage.command.CommandResult;
26+
import org.apache.cloudstack.storage.volume.VolumeOnStorageTO;
2527

2628
import com.cloud.host.Host;
2729
import com.cloud.offering.DiskOffering;
@@ -228,4 +230,23 @@ default boolean informStorageForDiskOfferingChange() {
228230
}
229231

230232
default void updateStorageWithTheNewDiskOffering(Volume volume, DiskOffering newDiskOffering) {}
233+
234+
/**
235+
* intended for storage that can enumerate its own volumes available for import without hypervisor involvement
236+
* @param volumePath when not blank, restricts the result to the volume with this path, if found
237+
* @param keyword when not blank, restricts the result to volumes whose name contains this keyword
238+
* @param forUnmanage when volume will be unmanaged from CloudStack
239+
* @return null if the storage driver does not support listing volumes for import on its own,
240+
* in which case the caller falls back to querying a host via GetVolumesOnStorageCommand
241+
*/
242+
default List<VolumeOnStorageTO> listVolumesForImport(StoragePool pool, String volumePath, String keyword, boolean forUnmanage) {
243+
return null;
244+
}
245+
246+
/**
247+
* Called after a volume is imported into or unmanaged from CloudStack, so the driver can
248+
* mark/unmark it accordingly (e.g. tag it) for future {@link #listVolumesForImport} calls.
249+
*/
250+
default void volumeManagementChanged(StoragePool pool, Volume volume, boolean imported) {
251+
}
231252
}

0 commit comments

Comments
 (0)