Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
fd36fcd
<fix>[zbs]: fix linked-clone parent volume residual
MaJin1996 Jun 1, 2026
b997400
Merge branch 'fix/ZSTAC-85707' into '5.5.28'
Jun 2, 2026
9877fbb
<fix>[eip]: fix EIP attach release race
Jun 2, 2026
3d42dfb
<fix>[portForwarding]: serialize rule creation
Jun 2, 2026
cd215ed
Merge branch 'codex/ZSTAC-83309-eip-attach-race-5.5.28' into '5.5.28'
Jun 2, 2026
275bd28
<fix>[ceph]: cap & parallelize host conn check
MaJin1996 May 29, 2026
1485344
Merge branch 'fix/ZSTAC-85421@@2' into '5.5.28'
MaJin1996 Jun 3, 2026
2124cd6
Merge branch 'bugfix-ZSTAC-77673' into '5.5.28'
Jun 4, 2026
e986a62
<fix>[network]: add IPv6 host and bridge switches
Jun 4, 2026
da6789a
<feature>[kvm]: add iothread vq mapping data path
May 24, 2026
53e54a2
Merge branch 'shixin-ZSTAC-85691@@2' into '5.5.28'
Jun 4, 2026
4ada5a5
<fix>[virtualrouter]: configure dnsmasq query limits
ruansteve Jun 4, 2026
0e884bb
Merge branch 'shixin-ZSTAC-85197' into '5.5.28'
Jun 5, 2026
4af8c5b
<fix>[upgrade]: compare incoming version in updateAgentVersion
Apr 29, 2026
8733506
Merge branch 'fix/ZSTAC-84886-5.5.28' into '5.5.28'
Jun 5, 2026
037dc31
<fix>[kvm]: cache hypervisor metadata lookup
AlanJager Jun 8, 2026
c19ba5c
Merge branch 'fix/ZSTAC-65322-hypervisor-metadata-cache@@2' into '5.5…
Jun 8, 2026
8d3aa6f
<fix>[upgrade]: prevent automatic agent upgrade during grayscale
ruansteve Jun 9, 2026
73ec38e
<fix>[flatNetworkProvider]: batch host reconnect userdata
Jun 9, 2026
3c7a58d
Merge branch 'shixin-ZSTAC-85435@@2' into '5.5.28'
Jun 9, 2026
e7e1b25
Merge branch 'shixin-ZSTAC-85772@@2' into '5.5.28'
Jun 9, 2026
12bbd86
<fix>[kvm]: refine iothread vq mapping support
May 24, 2026
5478e1a
<fix>[vhost]: block online vhost attach without shared memory
MaJin1996 Jun 10, 2026
1426ecb
Merge branch 'fix/ZSTAC-85554' into '5.5.28'
Jun 10, 2026
48bad06
<fix>[errorcode]: add Cloud diagnostic error response
Ezreal-07 Jun 11, 2026
60f4465
Merge branch 'fix-85921' into '5.5.28'
Jun 11, 2026
fc9e9a5
<fix>[kvm]: Add KVM VM CPU hardware virtualization config
Ezreal-07 Jun 11, 2026
e8ffa26
Merge branch 'fv-83181@@3' into '5.5.28'
Jun 12, 2026
48df761
<fix>[pci-device]: clean duplicate mdev refs
Jun 12, 2026
ffeb4e2
Merge branch 'fix/ZSTAC-84442-5.5.28@@2' into '5.5.28'
Jun 12, 2026
4d4096a
<feature>[license]: add license auth info api
liang-hanyu Jun 1, 2026
7dabfb8
<feature>[license]: complete auth info output
liang-hanyu Jun 2, 2026
9c510f1
<fix>[license]: support LS HTTPS SDK
liang-hanyu Jun 3, 2026
d94ce5b
Merge branch 'sync-hanyu-5524-to-5528@@2' into '5.5.28'
Jun 16, 2026
40c3b66
<fix>[iam2]: add scim receiver runtime
liang-hanyu Jun 10, 2026
9418fbe
<fix>[iam2]: enforce scim uuid contract
liang-hanyu Jun 16, 2026
4e92c82
<feature>[license]: manage license server lifecycle
Jun 7, 2026
dac611e
Merge branch 'cherry-pick-490df41e' into '5.5.28'
Jun 17, 2026
0c54f13
Merge branch 'fix-4158@@2' into '5.5.28'
Jun 22, 2026
325c3f5
<feature>[volume-cache]: add VM local volume cache
Feb 28, 2026
9b8a71b
<fix>[volume-cache]: move cache configuration to premium
Apr 20, 2026
a73f0fd
<fix>[volume-cache]: set CacheTO in extension point
Mar 24, 2026
18dc9af
<refactor>[volume-cache]: simplify naming and decouple LVM
Apr 20, 2026
a4b9e98
<refactor>[volume-cache]: align REST URLs with class names
Apr 27, 2026
d4eaeb6
<fix>[volume-cache]: rename GC pool in-use cache field
May 14, 2026
8ec7b16
<fix>[volume-cache]: add flush progress context
Jun 11, 2026
4c24cec
<fix>[volume-cache]: expose disable dry-run capacity fields
Jun 9, 2026
dd6b1c9
Merge branch 'feature-5.5.6-local-cache@@3' into '5.5.28'
Jun 25, 2026
0dfe389
<fix>[search]: fix zql field query total
Jun 24, 2026
768a99d
Merge branch 'shixin-ZSTAC-78110' into '5.5.28'
Jun 26, 2026
28e3500
<fix>[scim]: add source tracking contract
liang-hanyu Jun 25, 2026
505e92f
Merge branch 'zcf-4419@@2' into '5.5.28'
Jun 26, 2026
926c4c1
<feature>[mgt-ipv6]: support IPv6 management network
ruansteve Jun 28, 2026
c392caf
<fix>[mgt-ipv6]: address review issues
ruansteve Jun 29, 2026
49cda3a
<fix>[vm]: publish HA start state change
liang-hanyu Jun 4, 2026
430ea54
Merge branch 'fix-84393@@2' into '5.5.28'
Jun 29, 2026
8b799fb
<fix>[mgt-ipv6]: fix console proxy gc race
Jun 29, 2026
205eb3a
<fix>[drs]: enlarge drs migration result column
liang-hanyu Jun 29, 2026
90a7f4c
<fix>[virtualrouter]: reserve management VIP ports
ruansteve Jun 29, 2026
9a69106
<fix>[mgt-ipv6]: address mr review comments
ruansteve Jun 29, 2026
18cb4e9
<fix>[mgt-ipv6]: handle remaining review issues
ruansteve Jun 29, 2026
5e1004b
<fix>[mgt-ipv6]: serialize system l3 ip range creation
ruansteve Jun 29, 2026
94eec43
<fix>[mgt-ipv6]: fix ipv6 regression cases
Jun 29, 2026
26aacf9
<fix>[mgt-ipv6]: sync console proxy api doc
Jun 29, 2026
32a3de0
<fix>[mgt-ipv6]: match api doc template eof
Jun 29, 2026
8eeac1c
Merge branch 'shixin-ZSTAC-79206-5.5.28@@4' into '5.5.28'
Jun 29, 2026
ad60d25
<fix>[migration]: Fix storage migration host filters
Jun 30, 2026
3e5f9d3
<feature>[zwatch]: backport alarm optimize api to 5.5.28
PandaWuu Jun 30, 2026
0331cd4
<fix>[plugin]: add newDriverInstance for isolated drivers
liang-hanyu Mar 19, 2026
97955e0
Merge branch 'feature-5.5.28-zbs@@3' into '5.5.28'
Jun 30, 2026
ecc4d4d
Merge branch 'fix-63316@@2' into '5.5.28'
Jun 30, 2026
60bd4ea
<fix>[management-node]: recreate mn record idempotently
Jun 30, 2026
f461646
Merge branch 'bugfix/ZSTAC-86212-5.5.28@@2' into '5.5.28'
Jun 30, 2026
8225d3a
Merge branch 'fix-ZSTAC-75332-review-fix@@2' into '5.5.28'
Jun 30, 2026
ca3fe4b
<test>[management-node]: stabilize heartbeat cleanup case
Jun 30, 2026
1f65e4e
<fix>[zbs]: try next mds on sync failure
Jun 29, 2026
4313cc3
<fix>[scim]: remove receiver version gate
liang-hanyu Jun 30, 2026
964b288
<fix>[identity]: allow ZIAM role policy updates
liang-hanyu Jun 30, 2026
2f40cc2
<test>[management-node]: keep heartbeat case node state intact
ruansteve Jun 30, 2026
1e3fbad
Merge branch 'fix/ZSTAC-80595' into '5.5.28'
Jun 30, 2026
5561bd9
Merge branch 'zcf-4469@@2' into '5.5.28'
Jun 30, 2026
87184c3
Merge branch 'shixin-ZSTAC-86384' into '5.5.28'
Jun 30, 2026
085757f
Merge branch 'fix-82729@@2' into '5.5.28'
Jul 1, 2026
4c4dbf8
<fix>[pciDevice]: add share error code
Jun 24, 2026
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
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AttachedVolumePrimaryStorageAllocatorFlow extends AbstractHostAlloc
public void allocate() {
throwExceptionIfIAmTheFirstFlow();

if (VmOperation.NewCreate.toString().equals(spec.getVmOperation())) {
if (VmOperation.NewCreate.toString().equals(spec.getVmOperation()) || VmOperation.MigrateStorage.toString().equals(spec.getVmOperation())) {
next(candidates);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ private List<HostVO> filterHostHavingAccessiblePrimaryStorage(List<String> huuid
private List<HostVO> allocateFromCandidates() {
List<String> huuids = getHostUuidsFromCandidates();
Set<String> requiredPsUuids = spec.getRequiredPrimaryStorageUuids();
if (!VmOperation.NewCreate.toString().equals(spec.getVmOperation())) {
return filterHostHavingAccessiblePrimaryStorage(huuids, spec);
} else {
if (VmOperation.NewCreate.toString().equals(spec.getVmOperation()) || VmOperation.MigrateStorage.toString().equals(spec.getVmOperation())) {
huuids = filterHostHavingAccessiblePrimaryStorage(huuids, spec)
.stream().map(ResourceVO::getUuid).collect(Collectors.toList());
} else {
return filterHostHavingAccessiblePrimaryStorage(huuids, spec);
}

if (huuids.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ public class TagAllocatorFlow extends AbstractHostAllocatorFlow {
private List<InstanceOfferingTagAllocatorExtensionPoint> instanceOfferingExtensions;
private List<DiskOfferingTagAllocatorExtensionPoint> diskOfferingExtensions;

public TagAllocatorFlow() {
private void loadExtensions() {
instanceOfferingExtensions = pluginRgty.getExtensionList(InstanceOfferingTagAllocatorExtensionPoint.class);
diskOfferingExtensions = pluginRgty.getExtensionList(DiskOfferingTagAllocatorExtensionPoint.class);
}

@Override
public void allocate() {
throwExceptionIfIAmTheFirstFlow();
loadExtensions();

if (!instanceOfferingExtensions.isEmpty()) {
SimpleQuery<SystemTagVO> q = dbf.createQuery(SystemTagVO.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
import org.zstack.header.apimediator.ApiMessageInterceptionException;
import org.zstack.header.apimediator.ApiMessageInterceptor;
import org.zstack.header.apimediator.StopRoutingException;
import org.zstack.header.cluster.ClusterVO;
import org.zstack.header.cluster.ClusterVO_;
import org.zstack.header.host.*;
import org.zstack.header.message.APIMessage;
import org.zstack.header.zone.ManagementNetworkIpVersionManager;
import org.zstack.utils.ShellResult;
import org.zstack.utils.ShellUtils;
import org.zstack.utils.network.IPv6NetworkUtils;
import org.zstack.utils.network.NetworkUtils;

import static org.zstack.core.Platform.argerr;
Expand All @@ -28,12 +32,19 @@
* To change this template use File | Settings | File Templates.
*/
public class HostApiInterceptor implements ApiMessageInterceptor {
private static final String INVALID_MANAGEMENT_IP_ERROR =
"managementIp[%s] is not a valid IPv4 address, IPv6 address, or hostname";
private static final String RESERVED_MANAGEMENT_IPV6_ERROR =
"managementIp[%s] is an IPv6 address that cannot be used as a management address";

@Autowired
private CloudBus bus;
@Autowired
private ErrorFacade errf;
@Autowired
private DatabaseFacade dbf;
@Autowired
private ManagementNetworkIpVersionManager managementNetworkIpVersionManager;

private void setServiceId(APIMessage msg) {
if (msg instanceof HostMessage) {
Expand Down Expand Up @@ -112,18 +123,70 @@ private void validate(APIDeleteHostMsg msg) {

private void validate(APIUpdateHostMsg msg) {
if (msg.getManagementIp() != null) {
msg.setManagementIp(validateManagementEndpoint(msg.getManagementIp()));

SimpleQuery<HostVO> q = dbf.createQuery(HostVO.class);
q.add(HostVO_.managementIp, Op.EQ, msg.getManagementIp());
if (q.isExists()) {
throw new ApiMessageInterceptionException(argerr(ORG_ZSTACK_COMPUTE_HOST_10112, "there has been a host having managementIp[%s]", msg.getManagementIp()));
}

String zoneUuid = Q.New(HostVO.class)
.select(HostVO_.zoneUuid)
.eq(HostVO_.uuid, msg.getUuid())
.findValue();
managementNetworkIpVersionManager.validateEndpointInZone(zoneUuid, msg.getManagementIp(),
"host", msg.getUuid(), ORG_ZSTACK_COMPUTE_HOST_10130);
}
}

private void validate(APIAddHostMsg msg) {
if (!NetworkUtils.isIpv4Address(msg.getManagementIp()) && !NetworkUtils.isHostname(msg.getManagementIp())) {
throw new ApiMessageInterceptionException(argerr(ORG_ZSTACK_COMPUTE_HOST_10113, "managementIp[%s] is neither an IPv4 address nor a valid hostname", msg.getManagementIp()));
validateManagementEndpoint(msg);
String zoneUuid = Q.New(ClusterVO.class)
.select(ClusterVO_.zoneUuid)
.eq(ClusterVO_.uuid, msg.getClusterUuid())
.findValue();
managementNetworkIpVersionManager.validateEndpointInZone(zoneUuid, msg.getManagementIp(),
"host", msg.getName(), ORG_ZSTACK_COMPUTE_HOST_10130);
}

static void validateManagementEndpoint(APIAddHostMsg msg) {
String managementIp = msg.getManagementIp();
msg.setManagementIp(validateManagementEndpoint(managementIp));
}

static String validateManagementEndpoint(String managementIp) {
if (IPv6NetworkUtils.isIpv6Address(managementIp)) {
if (!IPv6NetworkUtils.isValidManagementIpv6Address(managementIp)) {
throw new ApiMessageInterceptionException(argerr(
ORG_ZSTACK_COMPUTE_HOST_10129,
RESERVED_MANAGEMENT_IPV6_ERROR,
managementIp));
}
} else if (!isValidManagementEndpoint(managementIp)) {
throw new ApiMessageInterceptionException(argerr(
ORG_ZSTACK_COMPUTE_HOST_10128,
INVALID_MANAGEMENT_IP_ERROR,
managementIp));
}

if (IPv6NetworkUtils.isIpv6Address(managementIp)) {
return IPv6NetworkUtils.getIpv6AddressCanonicalString(managementIp);
}

return managementIp;
}

static String getManagementEndpointValidationErrorCode(String managementIp) {
if (IPv6NetworkUtils.isIpv6Address(managementIp)) {
return IPv6NetworkUtils.isValidManagementIpv6Address(managementIp) ? null : ORG_ZSTACK_COMPUTE_HOST_10129;
}

return isValidManagementEndpoint(managementIp) ? null : ORG_ZSTACK_COMPUTE_HOST_10128;
}

private static boolean isValidManagementEndpoint(String endpoint) {
return IPv6NetworkUtils.isValidManagementEndpoint(endpoint);
}

private void validate(APIChangeHostStateMsg msg){
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 @@ -188,6 +188,8 @@ protected void handleApiMessage(APIMessage msg) {
handle((APIPowerResetHostMsg) msg);
} else if (msg instanceof APIGetHostPowerStatusMsg) {
handle((APIGetHostPowerStatusMsg) msg);
} else if (msg instanceof APIGetBlockDevicesMsg) {
handle((APIGetBlockDevicesMsg) msg);
} else {
bus.dealWithUnknownMessage(msg);
}
Expand All @@ -214,6 +216,27 @@ public void run(MessageReply reply) {
});
}

private void handle(APIGetBlockDevicesMsg msg) {
APIGetBlockDevicesEvent event = new APIGetBlockDevicesEvent(msg.getId());
GetBlockDevicesOnHostMsg gmsg = new GetBlockDevicesOnHostMsg();
gmsg.setHostUuid(msg.getHostUuid());
gmsg.setIncludeInUse(msg.isIncludeInUse());
bus.makeTargetServiceIdByResourceUuid(gmsg, HostConstant.SERVICE_ID, msg.getHostUuid());
bus.send(gmsg, new CloudBusCallBack(msg) {
@Override
public void run(MessageReply reply) {
if (!reply.isSuccess()) {
event.setSuccess(false);
event.setError(reply.getError());
} else {
GetBlockDevicesOnHostReply r = reply.castReply();
event.setBlockDevices(r.getBlockDevices());
}
bus.publish(event);
}
});
}

private void handle(APIPowerResetHostMsg msg) {
final APIPowerResetHostEvent event = new APIPowerResetHostEvent(msg.getId());
RebootHostMsg rebootHostMsg = new RebootHostMsg();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.zstack.core.cloudbus.CloudBus;
import org.zstack.core.cloudbus.CloudBusCallBack;
import org.zstack.core.db.DatabaseFacade;
import org.zstack.core.db.Q;
import org.zstack.core.db.SQL;
import org.zstack.core.errorcode.ErrorFacade;
import org.zstack.header.allocator.*;
Expand All @@ -15,7 +14,6 @@
import org.zstack.header.core.workflow.Flow;
import org.zstack.header.core.workflow.FlowRollback;
import org.zstack.header.core.workflow.FlowTrigger;
import org.zstack.header.errorcode.ErrorCode;
import org.zstack.header.exception.CloudRuntimeException;
import org.zstack.header.host.HostInventory;
import org.zstack.header.host.HostVO;
Expand All @@ -24,8 +22,6 @@
import org.zstack.header.message.APIMessage;
import org.zstack.header.message.MessageReply;
import org.zstack.header.network.l3.L3NetworkInventory;
import org.zstack.header.storage.primary.PrimaryStorageClusterRefVO;
import org.zstack.header.storage.primary.PrimaryStorageClusterRefVO_;
import org.zstack.header.vm.*;
import org.zstack.header.vm.VmInstanceConstant.VmOperation;
import org.zstack.utils.CollectionUtils;
Expand Down Expand Up @@ -162,6 +158,7 @@ public void run(final FlowTrigger chain, Map data) {
}

AllocateHostMsg msg = this.prepareMsg(spec);
extEmitter.beforeVmAllocateHost(msg, spec);

bus.send(msg, new CloudBusCallBack(chain) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public String call(L3NetworkInventory arg) {
msg.setAvoidHostUuids(spec.getAvoidHostUuids());
amsg = msg;

extEmitter.beforeVmAllocateHost(amsg, spec);
bus.send(amsg, new CloudBusCallBack(chain) {
@Override
public void run(MessageReply reply) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ public class VmCreateOnHypervisorFlow implements Flow {
@Autowired
private EventFacade evtf;

private final List<VmBeforeCreateOnHypervisorExtensionPoint> exts = pluginRgty.getExtensionList(VmBeforeCreateOnHypervisorExtensionPoint.class);

private void fireExtensions(VmInstanceSpec spec) {
for (VmBeforeCreateOnHypervisorExtensionPoint ext : exts) {
for (VmBeforeCreateOnHypervisorExtensionPoint ext : pluginRgty.getExtensionList(VmBeforeCreateOnHypervisorExtensionPoint.class)) {
ext.beforeCreateVmOnHypervisor(spec);
}
}
Expand Down
17 changes: 6 additions & 11 deletions compute/src/main/java/org/zstack/compute/vm/VmInstanceBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ protected VmInstanceVO changeVmStateInDb(VmInstanceStateEvent stateEvent) {
}

protected VmInstanceVO changeVmStateInDb(VmInstanceStateEvent stateEvent, Runnable runnable) {
return changeVmStateInDb(stateEvent, runnable, null);
}

protected VmInstanceVO changeVmStateInDb(VmInstanceStateEvent stateEvent, Runnable runnable, String stateChangeSource) {
VmInstanceState bs = self.getState();
final VmInstanceState state = self.getState().nextState(stateEvent);

Expand Down Expand Up @@ -385,6 +389,7 @@ protected void scripts() {
data.setVmUuid(self.getUuid());
data.setOldState(bs.toString());
data.setNewState(state.toString());
data.setStateChangeSource(stateChangeSource);
data.setInventory(getSelfInventory());
evtf.fire(VmCanonicalEvents.VM_FULL_STATE_CHANGED_PATH, data);

Expand Down Expand Up @@ -1024,17 +1029,7 @@ public void done(ErrorCodeList errorCodeList) {
String hostUuid = self.getHostUuid();
String suspectHostUuid = StringUtils.trimToNull(hostUuid);
String peerHostUuid = StringUtils.trimToNull(msg.getAccessiblePeerHostUuid());
UpdateQuery sql = SQL.New(VmInstanceVO.class)
.eq(VmInstanceVO_.uuid, self.getUuid())
.set(VmInstanceVO_.state, VmInstanceState.Stopped)
.set(VmInstanceVO_.hostUuid, null);

if (hostUuid != null) {
sql.set(VmInstanceVO_.lastHostUuid, hostUuid);
}

sql.update();
refreshVO();
changeVmStateInDb(VmInstanceStateEvent.stopped, null, HaStartVmInstanceMsg.class.getName());
if (suspectHostUuid == null) {
logger.debug(String.format("HA-start vm[%s]: skip creating pre-fence tag because suspect host is absent",
self.getUuid()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.zstack.core.errorcode.ErrorFacade;
import org.zstack.core.workflow.FlowChainBuilder;
import org.zstack.header.Component;
import org.zstack.header.allocator.AllocateHostMsg;
import org.zstack.header.core.Completion;
import org.zstack.header.core.NoErrorCompletion;
import org.zstack.header.core.WhileDoneCompletion;
Expand Down Expand Up @@ -52,6 +53,7 @@ public class VmInstanceExtensionPointEmitter implements Component {
private List<VmNicChangeStateExtensionPoint> vmNicChangeStateExtensionPoints;
private List<SshKeyPairAssociateExtensionPoint> sshKeyPairAssociateExtensionPoints;
private List<AfterUpdateVmNicMacExtensionPoint> afterUpdateVmNicMacExtensionPoints;
private List<BeforeVmAllocateHostExtensionPoint> beforeVmAllocateHostExtensions;

public List<ErrorCode> handleSystemTag(String vmUuid, List<String> tags){
List<ErrorCode> errorCodes = new ArrayList<>();
Expand Down Expand Up @@ -614,6 +616,10 @@ public void cloneSshKeyPairsToVm(String originVmUuid, String destVmUuid) {
});
}

public void beforeVmAllocateHost(AllocateHostMsg msg, VmInstanceSpec spec) {
CollectionUtils.safeForEach(beforeVmAllocateHostExtensions, ext -> ext.beforeVmAllocateHost(msg, spec));
}

private void populateExtensions() {
VmInstanceBeforeStartExtensions = pluginRgty.getExtensionList(VmInstanceBeforeStartExtensionPoint.class);
VmInstanceResumeExtensionPoints = pluginRgty.getExtensionList(VmInstanceResumeExtensionPoint.class);
Expand All @@ -632,6 +638,7 @@ private void populateExtensions() {
vmNicChangeStateExtensionPoints = pluginRgty.getExtensionList(VmNicChangeStateExtensionPoint.class);
sshKeyPairAssociateExtensionPoints = pluginRgty.getExtensionList(SshKeyPairAssociateExtensionPoint.class);
afterUpdateVmNicMacExtensionPoints = pluginRgty.getExtensionList(AfterUpdateVmNicMacExtensionPoint.class);
beforeVmAllocateHostExtensions = pluginRgty.getExtensionList(BeforeVmAllocateHostExtensionPoint.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ public class VmInstantiateResourceForChangeImageFlow implements Flow {
@Autowired
private PluginRegistry pluginRgty;

private final List<ChangeVmImageExtensionPoint> extensions = pluginRgty.getExtensionList(ChangeVmImageExtensionPoint.class);

private List<ChangeVmImageExtensionPoint> getExtensions() {
return pluginRgty.getExtensionList(ChangeVmImageExtensionPoint.class);
}

private void runExtensions(final Iterator<ChangeVmImageExtensionPoint> it, final VmInstanceSpec spec, final FlowTrigger chain) {
if (!it.hasNext()) {
Expand All @@ -53,6 +54,7 @@ public void fail(ErrorCode errorCode) {
@Override
public void run(FlowTrigger chain, Map data) {
VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());
List<ChangeVmImageExtensionPoint> extensions = getExtensions();
for (ChangeVmImageExtensionPoint extp : extensions) {
try {
extp.preBeforeInstantiateVmResource(spec);
Expand Down Expand Up @@ -89,6 +91,6 @@ public void fail(ErrorCode errorCode) {
@Override
public void rollback(FlowRollback chain, Map data) {
VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());
rollbackExtensions(extensions.iterator(), spec, chain);
rollbackExtensions(getExtensions().iterator(), spec, chain);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ public class VmInstantiateResourcePostFlow implements Flow {
@Autowired
private PluginRegistry pluginRgty;

private final List<PostVmInstantiateResourceExtensionPoint> extensions = pluginRgty.getExtensionList(PostVmInstantiateResourceExtensionPoint.class);

private List<PostVmInstantiateResourceExtensionPoint> getExtensions() {
return pluginRgty.getExtensionList(PostVmInstantiateResourceExtensionPoint.class);
}

public void run(FlowTrigger trigger, Map data) {
VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());
List<PostVmInstantiateResourceExtensionPoint> extensions = getExtensions();
for (PostVmInstantiateResourceExtensionPoint ext : extensions) {
ext.postBeforeInstantiateVmResource(spec);
}
Expand Down Expand Up @@ -64,7 +66,7 @@ public void fail(ErrorCode errorCode) {
@Override
public void rollback(FlowRollback trigger, Map data) {
VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());
rollbackExtensions(extensions.iterator(), spec, trigger);
rollbackExtensions(getExtensions().iterator(), spec, trigger);
}

private void rollbackExtensions(final Iterator<PostVmInstantiateResourceExtensionPoint> iterator, final VmInstanceSpec spec, final FlowRollback trigger) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ public class VmInstantiateResourcePreFlow implements Flow {
@Autowired
private PluginRegistry pluginRgty;

private final List<PreVmInstantiateResourceExtensionPoint> extensions = pluginRgty.getExtensionList(PreVmInstantiateResourceExtensionPoint.class);

private List<PreVmInstantiateResourceExtensionPoint> getExtensions() {
return pluginRgty.getExtensionList(PreVmInstantiateResourceExtensionPoint.class);
}

private void runExtensions(final Iterator<PreVmInstantiateResourceExtensionPoint> it, final VmInstanceSpec spec, final FlowTrigger chain) {
if (!it.hasNext()) {
Expand Down Expand Up @@ -61,6 +62,7 @@ public void fail(ErrorCode errorCode) {
@Override
public void run(FlowTrigger chain, Map data) {
VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());
List<PreVmInstantiateResourceExtensionPoint> extensions = getExtensions();
for (PreVmInstantiateResourceExtensionPoint extp : extensions) {
try {
extp.preBeforeInstantiateVmResource(spec);
Expand Down Expand Up @@ -97,6 +99,6 @@ public void fail(ErrorCode errorCode) {
@Override
public void rollback(FlowRollback chain, Map data) {
VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString());
rollbackExtensions(extensions.iterator(), spec, chain);
rollbackExtensions(getExtensions().iterator(), spec, chain);
}
}
Loading