Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
74946e6
Merge branch 'ZSV-9771-fix' into 'zsv_4.10.20'
Aug 22, 2025
db38b98
<test>[testlib]: introduce VmDiskSpec
Aug 23, 2025
e20b738
Merge branch 'zsv-1' into 'zsv_4.10.20'
Aug 23, 2025
51cb2f2
<fix>[compute]: try to remove dataVolumeSystemTagsOnIndex
Aug 24, 2025
bbec650
Merge branch 'zsv-2' into 'zsv_4.10.20'
Aug 25, 2025
4f1a770
<fix>[compute]: try to remove dataDiskOfferingUuids in VmInstanceSpec
Aug 25, 2025
8e131d9
<fix>[core]: fix QueryMore "notIn" methods
Aug 26, 2025
f3ed776
Merge branch 'zsv-5' into 'zsv_4.10.20'
Aug 26, 2025
303854e
Merge branch 'zsv-1@@2' into 'zsv_4.10.20'
Aug 27, 2025
fbe468e
<fix>[conf]: add lun missing error xml
Aug 28, 2025
3b6999e
<fix>[compute]: fix IllegalStateException in HostOsVersionAllocatorFlow
Aug 28, 2025
95d8513
<fix>[build]: remove deprecated modules
Aug 26, 2025
600e170
Merge branch 'zsv-7' into 'zsv_4.10.20'
Aug 28, 2025
dae4426
Merge branch 'zsv-5@@2' into 'zsv_4.10.20'
Aug 29, 2025
f51878d
Merge branch 'zsv-3@@2' into 'zsv_4.10.20'
Aug 29, 2025
ed09f6c
<test>[configuration]: rewrite deprecated cases
Aug 30, 2025
f04a145
<fix>[tag]: enhance tag error printing
Aug 30, 2025
6f1a586
Merge branch 'zsv-3' into 'zsv_4.10.20'
Aug 30, 2025
394cc90
<test>[configuration]: rewrite deprecated cases
Aug 30, 2025
424def6
<test>[identity]: rewrite deprecated cases
Aug 31, 2025
8257140
<test>[image]: rewrite deprecated cases
Aug 31, 2025
5ee5714
Merge branch 'zsv-6' into 'zsv_4.10.20'
Aug 31, 2025
b1a2816
<fix>[compute]: support CreateVmInstanceAction.diskAO.systemTags
Aug 29, 2025
e7d52ca
<fix>[compute]: clean "driver::virtio" tag when validate CreateVmAction
Aug 30, 2025
9d03c53
Merge branch 'zsv-5' into 'zsv_4.10.20'
Sep 1, 2025
f4c5524
<fix>[compute]: split diskAO to rootDisk and dataDisks
Sep 1, 2025
39690a4
Merge branch 'zsv-3@@2' into 'zsv_4.10.20'
Sep 1, 2025
6916c8e
Merge branch 'zsv-2@@2' into 'zsv_4.10.20'
Sep 1, 2025
e703967
<test>[testlib]: remove deprecated parameters in VmSpec
Sep 1, 2025
f3bf8ae
<test>[vm]: rewrite deprecated cases
Sep 1, 2025
ba08191
Merge branch 'zsv-1@@2' into 'zsv_4.10.20'
Sep 1, 2025
10ff8d3
<test>[compute]: rewrite VmAllocatePrimaryStorageFlow
Sep 1, 2025
c2ee51f
Merge branch 'zsv-2' into 'zsv_4.10.20'
Sep 2, 2025
0c876ac
Merge branch 'zsv-3' into 'zsv_4.10.20'
Sep 2, 2025
92ad85b
<fix>[header]: merge VmSpec.requiredPsUuid to VmSpec.rootDisk
Sep 2, 2025
6a5f8ba
Merge branch 'zsv-6@@2' into 'zsv_4.10.20'
Sep 3, 2025
c63776f
<fix>[tag]: add field SystemTag.ephemeral
Sep 3, 2025
25b9b0f
<fix>[compute]: support DiskAO.primaryStorageUuid for root volume
Sep 2, 2025
0dfdec1
<fix>[tag]: enhance TagManagerImpl.findMatchingSystemTag
Sep 3, 2025
8d3ac4d
<fix>[tag]: add more markable field in SystemTag
Sep 3, 2025
2d3beb1
<fix>[localstorage]: fix DiskAO usage in LocalStorageAllocateFlow
Sep 4, 2025
24807af
Merge branch 'zsv-9@@2' into 'zsv_4.10.20'
Sep 4, 2025
33cae6f
<chore>[tag]: code optimization in TagManagerImpl
Sep 4, 2025
fa61e24
Merge branch 'zsv-4' into 'zsv_4.10.20'
Sep 4, 2025
dc45743
<fix>[plugin]: support to modify ssh port of ansible runner
Aug 1, 2025
6fbe44e
<fix>[plugin]: introducing check host storage connection for zbs prim…
Aug 6, 2025
71624b1
<fix>[plugin]: add check host storage connection response
Aug 13, 2025
991e23d
<fix>[plugin]: update size unit
Aug 7, 2025
79139b1
<fix>[plugin]: add resize volume extension point
Aug 12, 2025
e8a6ad7
<fix>[plugin]: set heartbeat volume size
Aug 18, 2025
eb7a2c7
<fix>[plugin]: introducing get facts
Aug 13, 2025
7d71dd0
<fix>[plugin]: set default unit is gigabyte
Aug 19, 2025
5190137
Merge branch '4.10.20-ZSV-8257@@3' into 'zsv_4.10.20'
Sep 5, 2025
badd6e6
Merge branch 'zsv-8' into 'zsv_4.10.20'
Sep 8, 2025
04a3728
<fix>[tag]: work on system tag
Sep 9, 2025
d8f5b05
Merge branch 'zsv-7' into 'zsv_4.10.20'
Sep 9, 2025
7653443
<fix>[storage]: support specifying the initial size of LV
Sep 10, 2025
8a40b12
Merge branch 'zsv-1@@2' into 'zsv_4.10.20'
Sep 11, 2025
f5ebd7b
<fix>[utils]: use form-data in get webssh
Sep 15, 2025
514c4d9
Merge branch 'zsv-6' into 'zsv_4.10.20'
Sep 16, 2025
9cba015
<chore>[header]: add method ErrorableValue.cast
Sep 8, 2025
87dff63
Merge branch 'zsv-0' into 'zsv_4.10.20'
Sep 17, 2025
a05caec
<fix>[network]: skip getting ip address capacity of l3 without IPAM
Sep 1, 2025
ec4adf5
Merge branch 'ZSV-9958@@2' into 'zsv_4.10.20'
Sep 24, 2025
4f6b49e
<feature>[guesttools]: support vm custom specification
Aug 27, 2025
fe63b5a
Merge branch 'ZSV-9396@@4' into 'zsv_4.10.20'
Sep 29, 2025
a7a17df
bump version to 4.10.20
Oct 9, 2025
7eca99a
Merge branch 'bump-version' into 'zsv_4.10.20'
yuerong996 Oct 9, 2025
b77b57d
<fix>[compute]: allow linux hostname with dots
Oct 11, 2025
3a3bdbf
Merge branch 'ZSV-10003@@2' into 'zsv_4.10.20'
Oct 11, 2025
5d5ef1a
Revert "<fix>[compute]: allow linux hostname with dots"
Oct 11, 2025
475537a
<fix>[compute]: allow linux hostname with dots
Oct 11, 2025
9113b7f
Merge branch 'ZSV-10003@@2' into 'zsv_4.10.20'
Oct 11, 2025
5680eea
<fix>[conf]: reset sharedblock qcow2 allocation
taogan21 Sep 19, 2025
9f39915
Merge branch 'ZSV-9938@@2' into 'zsv_4.10.20'
Oct 15, 2025
991dda0
<fix>[cluster]: change update os parallelism degree to 10
Oct 23, 2025
191ba24
Merge branch 'zsv-6@@2' into 'zsv_4.10.20'
Oct 24, 2025
9260763
<fix>[compute]: kernel interface support storage traffic type
Sep 30, 2025
721a6c2
Merge branch 'ZSV-9972@@3' into 'zsv_4.10.20'
Oct 30, 2025
7d5d939
<feature>[externalservice]: introduce VOps external service
Oct 30, 2025
397cb97
Merge branch 'zsv-4' into 'zsv_4.10.20'
Oct 30, 2025
827216d
<fix>[header]: introduce AsyncResponseFetcher
Oct 30, 2025
a081d4b
Merge branch 'zsv-5' into 'zsv_4.10.20'
Oct 31, 2025
35dafdc
<feature>[conf]: introduce managements module
Aug 21, 2025
2ac095a
<feature>[managements]: add APIGetManagementNodesStatusMsg
Oct 17, 2025
35ec645
<feature>[managements]: support zsha2 demote
Oct 22, 2025
62d2b06
Merge branch 'zsv-ldap@@2' into 'zsv_4.10.20'
Nov 5, 2025
4dd7888
<feature>[header]: upload and install storage package
taogan21 Sep 23, 2025
92b4ea0
<fix>[host]: supports both querying current hostname and updating to …
taogan21 Oct 27, 2025
7b32462
Merge branch '20-sds-ZSV-9928@@3' into 'zsv_4.10.20'
yuerong996 Nov 5, 2025
93645af
<fix>[zsv]: enhance APICheckCephPluginMsg
taogan21 Nov 5, 2025
e9cd8c8
<fix>[softwarePackage]: add APIQuerySoftwarePackageMsg
taogan21 Nov 6, 2025
9a8e560
<fix>[ceph]: correctly roll back CephOsdGroupVO availableCapacity
taogan21 Nov 7, 2025
76e40e8
<fix>[sdk]: support multi client config
MaJin1996 Dec 13, 2024
afb247b
Merge branch 'check-ZSV-9928@@2' into 'zsv_4.10.20'
Nov 7, 2025
70757ee
Merge branch 'query-softwarepackage-ZSV-9928@@2' into 'zsv_4.10.20'
Nov 7, 2025
2fafd25
Merge branch 'ZSV-10425@@2' into 'zsv_4.10.20'
Nov 7, 2025
c787fd7
Merge branch 'ZSV-10416' into 'zsv_4.10.20'
Nov 7, 2025
2b169df
<feature>[softwarePackage]: add APIUninstallSoftwarePackageMsg
taogan21 Nov 5, 2025
ec4b21e
<fix>[zbs]: zbs support getting active clients
PandaWuu Sep 18, 2025
11b81a8
Merge branch 'ZSV-9883@@3' into 'zsv_4.10.20'
Nov 10, 2025
2795fa4
<fix>[storage]: zbs support cdp
PandaWuu Jul 16, 2025
61fcdc8
<fix>[plugin]: support for batch volume query
May 6, 2025
555b55e
<fix>[zbs]: decrease db info reload times
PandaWuu Oct 16, 2025
1b03ee3
Merge branch 'ZSV-8903@@2' into 'zsv_4.10.20'
Nov 10, 2025
ed3f4c7
Merge branch 'ZSV-8897@@3' into 'zsv_4.10.20'
Nov 10, 2025
8e35214
<fix>[ansible]: enhance Ssh tools
Nov 10, 2025
94a257c
Merge branch 'ZSV-10070' into 'zsv_4.10.20'
Nov 11, 2025
6c510c5
Merge branch 'zsv-3@@2' into 'zsv_4.10.20'
Nov 11, 2025
717aa37
<fix>[ansible]: fix host pswd shell
Nov 11, 2025
d14d797
Merge branch 'zsv-3' into 'zsv_4.10.20'
Nov 11, 2025
af76b9b
<fix>[utils]: enhance Ssh tools
Nov 11, 2025
7483da2
<fix>[ansible]: fix sudo password echo
Nov 11, 2025
9c76caf
<chore>[utils]: add TODO for refactoring SshShell
Nov 11, 2025
0b4a30b
Merge branch 'zsv-3' into 'zsv_4.10.20'
Nov 11, 2025
99e8c9d
Merge branch 'uninstall-storate-ZSV-9928@@2' into 'zsv_4.10.20'
Nov 11, 2025
4d21c85
<fix>[crypto]: fix encryption image cache error
Nov 11, 2025
c8d93de
<fix>[root]: upgrade spring security to 5.7.13
Nov 11, 2025
52dbf1e
Merge branch 'zsv-0' into 'zsv_4.10.20'
Nov 12, 2025
bf779c3
Merge branch 'zsv-8@@2' into 'zsv_4.10.20'
Nov 12, 2025
7e05ce9
<fix>[utils]: fix error in scp upload
Nov 12, 2025
40382ed
Merge branch 'zsv-4' into 'zsv_4.10.20'
Nov 12, 2025
632d824
<fix>[storage]: when the snapshot group creation fails, delete the su…
taogan21 Sep 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MAJOR=4
MINOR=10
UPDATE=16
UPDATE=20
45 changes: 5 additions & 40 deletions build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,6 @@
<artifactId>cloudformation</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>hybrid</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>zwatch</artifactId>
Expand All @@ -317,21 +312,11 @@
<artifactId>sharedblock</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>ministorage</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>storage-device</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>mini</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>autoscaling</artifactId>
Expand All @@ -357,11 +342,6 @@
<artifactId>xdragon</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>aliyun-storage</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>block-primary-storage</artifactId>
Expand Down Expand Up @@ -402,21 +382,6 @@
<artifactId>baremetal</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>baremetal2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>external-api-adapter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>aliyun-proxy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>upgrade-hack</artifactId>
Expand Down Expand Up @@ -468,11 +433,6 @@
<artifactId>vpcFirewall</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>sns-aliyun-sms</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>guesttools</artifactId>
Expand Down Expand Up @@ -578,6 +538,11 @@
<artifactId>hostNetworkInterface</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.zstack</groupId>
<artifactId>managements</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.zstack.compute.host.HostManager;
import org.zstack.core.Platform;
import org.zstack.core.db.Q;
import org.zstack.header.allocator.AbstractHostAllocatorFlow;
import org.zstack.header.allocator.HostCandidate;
Expand Down Expand Up @@ -72,7 +71,8 @@ public void allocate() {

private Map<String, HostOperationSystem> generateHostUuidOsMap(List<HostVO> hostList) {
final Map<String, String> hostHypervisorTypeMap = hostList.stream()
.collect(Collectors.toMap(ResourceVO::getUuid, HostAO::getHypervisorType));
.collect(Collectors.toMap(ResourceVO::getUuid, HostAO::getHypervisorType,
(existing, replacement) -> replacement));
final Set<String> hypervisorTypeSet = new HashSet<>(hostHypervisorTypeMap.values());

final Map<String, HostOperationSystem> results = new HashMap<>(hostList.size());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.zstack.compute.host;

import org.springframework.beans.factory.annotation.Autowired;
import org.zstack.compute.vm.VmHostnameUtils;
import org.zstack.core.CoreGlobalProperty;
import org.zstack.core.componentloader.PluginRegistry;
import org.zstack.core.upgrade.UpgradeGlobalConfig;
Expand All @@ -17,6 +18,7 @@
import org.zstack.header.apimediator.ApiMessageInterceptor;
import org.zstack.header.apimediator.StopRoutingException;
import org.zstack.header.host.*;
import org.zstack.header.image.ImagePlatform;
import org.zstack.header.message.APIMessage;
import org.zstack.utils.ShellResult;
import org.zstack.utils.ShellUtils;
Expand Down Expand Up @@ -73,6 +75,8 @@ public APIMessage intercept(APIMessage msg) throws ApiMessageInterceptionExcepti
validate((APIGetPhysicalMachineBlockDevicesMsg) msg);
} else if (msg instanceof APIMountBlockDeviceMsg) {
validate((APIMountBlockDeviceMsg) msg);
} else if (msg instanceof APIUpdateHostnameMsg) {
validate((APIUpdateHostnameMsg) msg);
}

return msg;
Expand Down Expand Up @@ -169,6 +173,10 @@ private void validate(APIMountBlockDeviceMsg msg) {
validateMountPoint(msg.getMountPoint());
}

private void validate(APIUpdateHostnameMsg msg) {
VmHostnameUtils.validateHostname(msg.getHostname(), false);
}

private void validatePath(String path) {
if (path == null || path.isEmpty()) {
throw new ApiMessageInterceptionException(operr("path cannot be empty"));
Expand Down
23 changes: 23 additions & 0 deletions compute/src/main/java/org/zstack/compute/host/HostBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,34 @@ protected void handleApiMessage(APIMessage msg) {
handle((APIGetHostPowerStatusMsg) msg);
} else if (msg instanceof APIUpdateHostNqnMsg) {
handle((APIUpdateHostNqnMsg) msg);
} else if (msg instanceof APIUpdateHostnameMsg) {
handle((APIUpdateHostnameMsg) msg);
} else {
bus.dealWithUnknownMessage(msg);
}
}

private void handle(APIUpdateHostnameMsg msg) {
APIUpdateHostnameEvent event = new APIUpdateHostnameEvent(msg.getId());
UpdateHostnameMsg umsg = new UpdateHostnameMsg();
umsg.setUuid(msg.getUuid());
umsg.setHostname(msg.getHostname());
bus.makeTargetServiceIdByResourceUuid(umsg, HostConstant.SERVICE_ID, msg.getHostUuid());
bus.send(umsg, new CloudBusCallBack(msg) {
@Override
public void run(MessageReply reply) {
UpdateHostnameReply r = reply.castReply();
if (!r.isSuccess()) {
event.setSuccess(false);
event.setError(r.getError());
} else {
event.setInventory(r.getInventory());
}
bus.publish(event);
}
});
}

private void handle(APIUpdateHostNqnMsg msg) {
APIUpdateHostNqnEvent event = new APIUpdateHostNqnEvent(msg.getId());
UpdateHostNqnMsg umsg = new UpdateHostNqnMsg();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

import java.util.*;

import static org.zstack.utils.CollectionUtils.isEmpty;

@Configurable(preConstruction = true, autowire = Autowire.BY_TYPE)
public class ApplianceVmAllocatePrimaryStorageFlow implements Flow {
protected static final CLogger logger = Utils.getLogger(ApplianceVmAllocatePrimaryStorageFlow.class);
Expand Down Expand Up @@ -64,7 +66,7 @@ public void run(final FlowTrigger trigger, final Map data) {
List<String> primaryStorageTypes = hostAllocatorMgr.getBackupStoragePrimaryStorageMetrics().get(bsType);
DebugUtils.Assert(primaryStorageTypes != null, "why primaryStorageTypes is null");

DebugUtils.Assert(spec.getDataDiskOfferings().size() == 0, "create appliance vm can not with data volume");
DebugUtils.Assert(isEmpty(spec.getDeprecatedDisksSpecs()), "create appliance vm can not with data volume");

for (PrimaryStorageAllocatorStrategyExtensionPoint ext : pluginRgty.getExtensionList(PrimaryStorageAllocatorStrategyExtensionPoint.class)) {
String allocatorStrategyType = ext.getAllocatorStrategy(destHost);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package org.zstack.compute.vm;

import org.zstack.header.configuration.VmCustomSpecificationStruct;
import org.zstack.header.host.CpuArchitecture;
import org.zstack.header.vm.CreateVmInstanceMsg;
import org.zstack.header.vm.DiskAO;
import org.zstack.header.vm.InstantiateNewCreatedVmInstanceMsg;
import org.zstack.header.vm.VmCreationStrategy;
import org.zstack.header.vm.VmNicSpec;
import org.zstack.header.vm.*;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -16,7 +13,6 @@
* Created by xing5 on 2016/9/13.
*/
public class InstantiateVmFromNewCreatedStruct {
private List<String> dataDiskOfferingUuids;
private List<String> dataVolumeTemplateUuids;
private Map<String, List<String>> dataVolumeFromTemplateSystemTags;
private List<VmNicSpec> l3NetworkUuids;
Expand All @@ -28,12 +24,14 @@ public class InstantiateVmFromNewCreatedStruct {
private String requiredHostUuid;
private List<String> softAvoidHostUuids;
private List<String> avoidHostUuids;
private Map<String, List<String>> dataVolumeSystemTagsOnIndex;
private List<String> disableL3Networks;
private List<String> sshKeyPairUuids;
private final List<String> candidatePrimaryStorageUuidsForRootVolume = new ArrayList<>();
private final List<String> candidatePrimaryStorageUuidsForDataVolume = new ArrayList<>();
private List<DiskAO> diskAOs;
private DiskAO rootDisk;
private List<DiskAO> dataDisks;
private List<DiskAO> deprecatedDataVolumeSpecs = new ArrayList<>();
private VmCustomSpecificationStruct vmCustomSpecification;

public List<String> getCandidatePrimaryStorageUuidsForRootVolume() {
return candidatePrimaryStorageUuidsForRootVolume;
Expand All @@ -57,13 +55,36 @@ public void setCandidatePrimaryStorageUuidsForDataVolume(List<String> candidateP
}
}

public DiskAO getRootDisk() {
return rootDisk;
}

public void setRootDisk(DiskAO rootDisk) {
this.rootDisk = rootDisk;
}

public List<DiskAO> getDataDisks() {
return dataDisks;
}

public void setDataDisks(List<DiskAO> dataDisks) {
this.dataDisks = dataDisks;
}

public List<DiskAO> getDeprecatedDataVolumeSpecs() {
return deprecatedDataVolumeSpecs;
}

public List<DiskAO> getDiskAOs() {
return diskAOs;
public void setDeprecatedDataVolumeSpecs(List<DiskAO> deprecatedDataVolumeSpecs) {
this.deprecatedDataVolumeSpecs = deprecatedDataVolumeSpecs;
}

public void setDiskAOs(List<DiskAO> diskAOs) {
this.diskAOs = diskAOs;
public VmCustomSpecificationStruct getVmCustomSpecification() {
return vmCustomSpecification;
}

public void setVmCustomSpecification(VmCustomSpecificationStruct vmCustomSpecification) {
this.vmCustomSpecification = vmCustomSpecification;
}

public List<String> getRootVolumeSystemTags() {
Expand All @@ -86,14 +107,6 @@ public static String makeLabelKey(String vmUuid) {
return String.format("not-start-vm-%s", vmUuid);
}

public List<String> getDataDiskOfferingUuids() {
return dataDiskOfferingUuids;
}

public void setDataDiskOfferingUuids(List<String> dataDiskOfferingUuids) {
this.dataDiskOfferingUuids = dataDiskOfferingUuids;
}

public List<String> getDataVolumeTemplateUuids() {
return dataVolumeTemplateUuids;
}
Expand Down Expand Up @@ -136,7 +149,6 @@ public CpuArchitecture getArchitecture() {

public static InstantiateVmFromNewCreatedStruct fromMessage(InstantiateNewCreatedVmInstanceMsg msg) {
InstantiateVmFromNewCreatedStruct struct = new InstantiateVmFromNewCreatedStruct();
struct.setDataDiskOfferingUuids(msg.getDataDiskOfferingUuids());
struct.setDataVolumeTemplateUuids(msg.getDataVolumeTemplateUuids());
struct.setDataVolumeFromTemplateSystemTags(msg.getDataVolumeFromTemplateSystemTags());
struct.setL3NetworkUuids(msg.getL3NetworkUuids());
Expand All @@ -150,15 +162,16 @@ public static InstantiateVmFromNewCreatedStruct fromMessage(InstantiateNewCreate
struct.setRequiredHostUuid(msg.getHostUuid());
struct.setSoftAvoidHostUuids(msg.getSoftAvoidHostUuids());
struct.setAvoidHostUuids(msg.getAvoidHostUuids());
struct.setDataVolumeSystemTagsOnIndex(msg.getDataVolumeSystemTagsOnIndex());
struct.setDisableL3Networks(msg.getDisableL3Networks());
struct.setDiskAOs(msg.getDiskAOs());
struct.setRootDisk(msg.getRootDisk());
struct.setDataDisks(msg.getDataDisks());
struct.setDeprecatedDataVolumeSpecs(msg.getDeprecatedDataVolumeSpecs());
struct.setVmCustomSpecification(msg.getVmCustomSpecification());
return struct;
}

public static InstantiateVmFromNewCreatedStruct fromMessage(CreateVmInstanceMsg msg) {
InstantiateVmFromNewCreatedStruct struct = new InstantiateVmFromNewCreatedStruct();
struct.setDataDiskOfferingUuids(msg.getDataDiskOfferingUuids());
struct.setDataVolumeTemplateUuids(msg.getDataVolumeTemplateUuids());
struct.setDataVolumeFromTemplateSystemTags(msg.getDataVolumeFromTemplateSystemTags());
struct.setL3NetworkUuids(msg.getL3NetworkSpecs());
Expand All @@ -169,9 +182,11 @@ public static InstantiateVmFromNewCreatedStruct fromMessage(CreateVmInstanceMsg
struct.setRootVolumeSystemTags(msg.getRootVolumeSystemTags());
struct.setDataVolumeSystemTags(msg.getDataVolumeSystemTags());
struct.setRequiredHostUuid(msg.getHostUuid());
struct.setDataVolumeSystemTagsOnIndex(msg.getDataVolumeSystemTagsOnIndex());
struct.setDisableL3Networks(msg.getDisableL3Networks());
struct.setDiskAOs(msg.getDiskAOs());
struct.setRootDisk(msg.getRootDisk());
struct.setDataDisks(msg.getDataDisks());
struct.setDeprecatedDataVolumeSpecs(msg.getDeprecatedDataVolumeSpecs());
struct.setVmCustomSpecification(msg.getVmCustomSpecification());
return struct;
}

Expand Down Expand Up @@ -231,12 +246,29 @@ public void setDataVolumeFromTemplateSystemTags(Map<String, List<String>> dataVo
this.dataVolumeFromTemplateSystemTags = dataVolumeFromTemplateSystemTags;
}

public Map<String, List<String>> getDataVolumeSystemTagsOnIndex() {
return dataVolumeSystemTagsOnIndex;
}

@Deprecated
public void setDataVolumeSystemTagsOnIndex(Map<String, List<String>> dataVolumeSystemTagsOnIndex) {
this.dataVolumeSystemTagsOnIndex = dataVolumeSystemTagsOnIndex;
if (dataVolumeSystemTagsOnIndex == null) {
return;
}

int maxIndex = dataVolumeSystemTagsOnIndex.keySet().stream().mapToInt(Integer::parseInt).max().orElse(-1);
for (int i = deprecatedDataVolumeSpecs.size(); i <= maxIndex; i++) {
deprecatedDataVolumeSpecs.add(DiskAO.nonRootDisk());
}

for (int i = 0; i <= maxIndex; i++) {
String key = i + "";
if (!dataVolumeSystemTagsOnIndex.containsKey(key)) {
continue;
}

final DiskAO diskAO = deprecatedDataVolumeSpecs.get(i);
if (diskAO.getSystemTags() == null) {
diskAO.setSystemTags(new ArrayList<>());
}
diskAO.getSystemTags().addAll(dataVolumeSystemTagsOnIndex.get(key));
}
}

public List<String> getDisableL3Networks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ private boolean dataVolumePsUnique(VmInstanceSpec spec) {
}

private boolean needCreateDataVolume(VmInstanceSpec spec) {
return !CollectionUtils.isEmpty(spec.getDataDiskOfferings());
return !CollectionUtils.isEmpty(spec.getDeprecatedDisksSpecs());
}

private FlowChain buildAllocateHostAndPrimaryStorageFlowChain(final FlowTrigger trigger, VmInstanceSpec spec) {
Expand Down Expand Up @@ -451,8 +451,7 @@ private List<List<String>> getPrimaryStorageCombinationFromSpec(VmInstanceSpec s
autoAllocateDataVolumePs = true;
dataPs.addAll(availPsForDataVolume);
}
String dataVolumeStrategy = spec.getDataDiskOfferings().get(0).getAllocatorStrategy();
sortPrimaryStorages(dataPs, dataVolumeStrategy, null);
sortPrimaryStorages(dataPs, PrimaryStorageConstant.DEFAULT_PRIMARY_STORAGE_ALLOCATION_STRATEGY_TYPE, null);
} else {
dataPs.add(null);
}
Expand Down
Loading