mirror of https://github.com/apache/cloudstack.git
Merge branch '4.22'
This commit is contained in:
commit
4628385051
|
|
@ -35,9 +35,9 @@ public interface ObjectInDataStoreStateMachine extends StateObject<ObjectInDataS
|
|||
Failed("Failed to download Template"),
|
||||
Hidden("The object is hidden from the user");
|
||||
|
||||
String _description;
|
||||
final String _description;
|
||||
|
||||
private State(String description) {
|
||||
State(String description) {
|
||||
_description = description;
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public interface ObjectInDataStoreStateMachine extends StateObject<ObjectInDataS
|
|||
CreateRequested,
|
||||
CreateOnlyRequested,
|
||||
DestroyRequested,
|
||||
OperationSuccessed,
|
||||
OperationSucceeded,
|
||||
OperationFailed,
|
||||
CopyRequested,
|
||||
CopyingRequested,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
-- Licensed to the Apache Software Foundation (ASF) under one
|
||||
-- or more contributor license agreements. See the NOTICE file
|
||||
-- distributed with this work for additional information
|
||||
-- regarding copyright ownership. The ASF licenses this file
|
||||
-- to you under the Apache License, Version 2.0 (the
|
||||
-- "License"); you may not use this file except in compliance
|
||||
-- with the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing,
|
||||
-- software distributed under the License is distributed on an
|
||||
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
-- KIND, either express or implied. See the License for the
|
||||
-- specific language governing permissions and limitations
|
||||
-- under the License.
|
||||
|
||||
-- in cloud
|
||||
DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_DROP_COLUMN`;
|
||||
|
||||
-- Error 1091: Can't DROP column; check that column/key exists
|
||||
CREATE PROCEDURE `cloud`.`IDEMPOTENT_DROP_COLUMN` (
|
||||
IN in_table_name VARCHAR(200),
|
||||
IN in_column_name VARCHAR(200)
|
||||
)
|
||||
BEGIN
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR 1091 BEGIN END; SET @ddl = CONCAT('ALTER TABLE ', in_table_name, ' DROP COLUMN ', in_column_name); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END;
|
||||
|
|
@ -301,7 +301,7 @@ CALL `cloud`.`IDEMPOTENT_DROP_FOREIGN_KEY`('cloud.service_offering','fk_service_
|
|||
CALL `cloud`.`IDEMPOTENT_ADD_FOREIGN_KEY`('cloud.service_offering', 'fk_service_offering__vgpu_profile_id', '(vgpu_profile_id)', '`vgpu_profile`(`id`)');
|
||||
|
||||
-- Netris Plugin
|
||||
CREATE TABLE `cloud`.`netris_providers` (
|
||||
CREATE TABLE IF NOT EXISTS `cloud`.`netris_providers` (
|
||||
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
|
||||
`uuid` varchar(40),
|
||||
`zone_id` bigint unsigned NOT NULL COMMENT 'Zone ID',
|
||||
|
|
@ -321,11 +321,11 @@ CREATE TABLE `cloud`.`netris_providers` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Drop the Tungsten and NSX columns from the network offerings (replaced by checking the provider on the ntwk_offering_service_map table)
|
||||
ALTER TABLE `cloud`.`network_offerings` DROP COLUMN `for_tungsten`;
|
||||
ALTER TABLE `cloud`.`network_offerings` DROP COLUMN `for_nsx`;
|
||||
CALL `cloud`.`IDEMPOTENT_DROP_COLUMN`('cloud.network_offerings', 'for_tungsten');
|
||||
CALL `cloud`.`IDEMPOTENT_DROP_COLUMN`('cloud.network_offerings', 'for_nsx');
|
||||
|
||||
-- Drop the Tungsten and NSX columns from the VPC offerings (replaced by checking the provider on the vpc_offering_service_map table)
|
||||
ALTER TABLE `cloud`.`vpc_offerings` DROP COLUMN `for_nsx`;
|
||||
CALL `cloud`.`IDEMPOTENT_DROP_COLUMN`('cloud.vpc_offerings', 'for_nsx');
|
||||
|
||||
-- Add next_hop to the static_routes table
|
||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.static_routes', 'next_hop', 'varchar(50) COMMENT "next hop of the static route" AFTER `vpc_gateway_id`');
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ public class StorageCacheManagerImpl implements StorageCacheManager, Manager {
|
|||
if (result.isFailed()) {
|
||||
objOnCacheStore.processEvent(Event.OperationFailed);
|
||||
} else {
|
||||
objOnCacheStore.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
objOnCacheStore.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
objOnCacheStore.incRefCount();
|
||||
return objOnCacheStore;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
|||
return answer;
|
||||
}
|
||||
|
||||
objOnImageStore.processEvent(Event.OperationSuccessed, answer);
|
||||
objOnImageStore.processEvent(Event.OperationSucceeded, answer);
|
||||
|
||||
objOnImageStore.processEvent(Event.CopyingRequested);
|
||||
|
||||
|
|
@ -432,7 +432,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
|||
throw e;
|
||||
}
|
||||
|
||||
objOnImageStore.processEvent(Event.OperationSuccessed);
|
||||
objOnImageStore.processEvent(Event.OperationSucceeded);
|
||||
deleteVolumeOnSecondaryStore(objOnImageStore);
|
||||
return answer;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1058,7 +1058,7 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
|
|||
|
||||
//submit processEvent
|
||||
if (StringUtils.isEmpty(errMsg)) {
|
||||
snapshotInfo.processEvent(Event.OperationSuccessed);
|
||||
snapshotInfo.processEvent(Event.OperationSucceeded);
|
||||
} else {
|
||||
snapshotInfo.processEvent(Event.OperationFailed);
|
||||
}
|
||||
|
|
@ -1221,7 +1221,7 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
|
|||
// command to copy this data from cache to secondary storage. We
|
||||
// then clean up the cache.
|
||||
|
||||
destOnStore.processEvent(Event.OperationSuccessed, copyCmdAnswer);
|
||||
destOnStore.processEvent(Event.OperationSucceeded, copyCmdAnswer);
|
||||
|
||||
CopyCommand cmd = new CopyCommand(destOnStore.getTO(), destData.getTO(), primaryStorageDownloadWait,
|
||||
VirtualMachineManager.ExecuteInSequence.value());
|
||||
|
|
@ -1271,7 +1271,7 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
|
|||
|
||||
try {
|
||||
if (StringUtils.isEmpty(errMsg)) {
|
||||
snapshotInfo.processEvent(Event.OperationSuccessed);
|
||||
snapshotInfo.processEvent(Event.OperationSucceeded);
|
||||
}
|
||||
else {
|
||||
snapshotInfo.processEvent(Event.OperationFailed);
|
||||
|
|
@ -1404,7 +1404,7 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
|
|||
|
||||
try {
|
||||
if (StringUtils.isEmpty(errMsg)) {
|
||||
snapshotInfo.processEvent(Event.OperationSuccessed);
|
||||
snapshotInfo.processEvent(Event.OperationSucceeded);
|
||||
}
|
||||
else {
|
||||
snapshotInfo.processEvent(Event.OperationFailed);
|
||||
|
|
@ -2366,7 +2366,7 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
|
|||
|
||||
_volumeDao.update(volumeVO.getId(), volumeVO);
|
||||
|
||||
_volumeService.copyPoliciesBetweenVolumesAndDestroySourceVolumeAfterMigration(Event.OperationSuccessed, null, srcVolumeInfo, destVolumeInfo, false);
|
||||
_volumeService.copyPoliciesBetweenVolumesAndDestroySourceVolumeAfterMigration(Event.OperationSucceeded, null, srcVolumeInfo, destVolumeInfo, false);
|
||||
|
||||
// Update the volume ID for snapshots on secondary storage
|
||||
if (!_snapshotDao.listByVolumeId(srcVolumeInfo.getId()).isEmpty()) {
|
||||
|
|
@ -2704,7 +2704,7 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
|
|||
|
||||
try {
|
||||
if (StringUtils.isEmpty(errMsg)) {
|
||||
volumeInfo.processEvent(Event.OperationSuccessed);
|
||||
volumeInfo.processEvent(Event.OperationSucceeded);
|
||||
}
|
||||
else {
|
||||
volumeInfo.processEvent(Event.OperationFailed);
|
||||
|
|
|
|||
|
|
@ -257,9 +257,9 @@ public class SecondaryStorageServiceImpl implements SecondaryStorageService {
|
|||
}
|
||||
} else {
|
||||
if (destData instanceof VolumeInfo) {
|
||||
((VolumeInfo) destData).processEventOnly(ObjectInDataStoreStateMachine.Event.OperationSuccessed, answer);
|
||||
((VolumeInfo) destData).processEventOnly(ObjectInDataStoreStateMachine.Event.OperationSucceeded, answer);
|
||||
} else {
|
||||
destData.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed, answer);
|
||||
destData.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded, answer);
|
||||
}
|
||||
updateDataObject(srcData, destData);
|
||||
logger.debug("Deleting source data");
|
||||
|
|
|
|||
|
|
@ -671,7 +671,7 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
TemplateApiResult res = new TemplateApiResult(tmplt);
|
||||
if (result.isSuccess()) {
|
||||
logger.info("Copied template [{}] to image store [{}].", tmplt.getUniqueName(), tmplt.getDataStore().getName());
|
||||
tmplt.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
tmplt.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
publishTemplateCreation(tmplt);
|
||||
} else {
|
||||
logger.warn("Failed to copy template [{}] to image store [{}].", tmplt.getUniqueName(), tmplt.getDataStore().getName());
|
||||
|
|
@ -824,7 +824,7 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
}
|
||||
|
||||
try {
|
||||
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed);
|
||||
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded);
|
||||
} catch (Exception e) {
|
||||
result.setResult(e.toString());
|
||||
if (parentCallback != null) {
|
||||
|
|
@ -1033,7 +1033,7 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
CommandResult result = callback.getResult();
|
||||
TemplateObject vo = context.getTemplate();
|
||||
if (result.isSuccess()) {
|
||||
vo.processEvent(Event.OperationSuccessed);
|
||||
vo.processEvent(Event.OperationSucceeded);
|
||||
} else {
|
||||
vo.processEvent(Event.OperationFailed);
|
||||
}
|
||||
|
|
@ -1093,7 +1093,7 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
// no change to existing template_store_ref, will try to re-sync later if other call triggers this sync operation, like copy template
|
||||
} else {
|
||||
// this will update install path properly, next time it will not sync anymore.
|
||||
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
}
|
||||
future.complete(res);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1273,7 +1273,7 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
res.setResult(result.getResult());
|
||||
destTemplate.processEvent(Event.OperationFailed);
|
||||
} else {
|
||||
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
}
|
||||
future.complete(res);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1298,7 +1298,7 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
res.setResult(result.getResult());
|
||||
destTemplate.processEvent(Event.OperationFailed);
|
||||
} else {
|
||||
destTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
destTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
}
|
||||
future.complete(res);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1384,7 +1384,7 @@ public class TemplateServiceImpl implements TemplateService {
|
|||
TemplateApiResult dataDiskTemplateResult = new TemplateApiResult((TemplateObject)dataDiskTemplate);
|
||||
try {
|
||||
if (result.isSuccess()) {
|
||||
dataDiskTemplate.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
dataDiskTemplate.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
} else {
|
||||
dataDiskTemplate.processEvent(Event.OperationFailed);
|
||||
dataDiskTemplateResult.setResult(result.getResult());
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ public class SnapshotTest extends CloudStackTestNGBase {
|
|||
to.setSize(1000L);
|
||||
CopyCmdAnswer answer = new CopyCmdAnswer(to);
|
||||
templateOnStore.processEvent(Event.CreateOnlyRequested);
|
||||
templateOnStore.processEvent(Event.OperationSuccessed, answer);
|
||||
templateOnStore.processEvent(Event.OperationSucceeded, answer);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ public class VolumeTest extends CloudStackTestNGBase {
|
|||
to.setSize(100L);
|
||||
CopyCmdAnswer answer = new CopyCmdAnswer(to);
|
||||
templateOnStore.processEvent(Event.CreateOnlyRequested);
|
||||
templateOnStore.processEvent(Event.OperationSuccessed, answer);
|
||||
templateOnStore.processEvent(Event.OperationSucceeded, answer);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ public class VolumeTestVmware extends CloudStackTestNGBase {
|
|||
to.setPath(this.getImageInstallPath());
|
||||
CopyCmdAnswer answer = new CopyCmdAnswer(to);
|
||||
templateOnStore.processEvent(Event.CreateOnlyRequested);
|
||||
templateOnStore.processEvent(Event.OperationSuccessed, answer);
|
||||
templateOnStore.processEvent(Event.OperationSucceeded, answer);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public class DefaultSnapshotStrategy extends SnapshotStrategyBase {
|
|||
|
||||
CreateObjectAnswer createSnapshotAnswer = new CreateObjectAnswer(snapTO);
|
||||
|
||||
snapshotOnImageStore.processEvent(Event.OperationSuccessed, createSnapshotAnswer);
|
||||
snapshotOnImageStore.processEvent(Event.OperationSucceeded, createSnapshotAnswer);
|
||||
SnapshotObject snapObj = castSnapshotInfoToSnapshotObject(snapshot);
|
||||
try {
|
||||
snapObj.processEvent(Snapshot.Event.OperationNotPerformed);
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||
}
|
||||
|
||||
try {
|
||||
snapshot.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
snapshot.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
snapshot.processEvent(Snapshot.Event.OperationSucceeded);
|
||||
} catch (Exception e) {
|
||||
logger.debug("Failed to create snapshot: ", e);
|
||||
|
|
@ -515,7 +515,7 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||
|
||||
try {
|
||||
CopyCmdAnswer copyCmdAnswer = (CopyCmdAnswer)result.getAnswer();
|
||||
destSnapshot.processEvent(Event.OperationSuccessed, copyCmdAnswer);
|
||||
destSnapshot.processEvent(Event.OperationSucceeded, copyCmdAnswer);
|
||||
srcSnapshot.processEvent(Snapshot.Event.OperationSucceeded);
|
||||
snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), copyCmdAnswer);
|
||||
future.complete(snapResult);
|
||||
|
|
@ -540,7 +540,7 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||
}
|
||||
try {
|
||||
Answer answer = result.getAnswer();
|
||||
destSnapshot.processEvent(Event.OperationSuccessed);
|
||||
destSnapshot.processEvent(Event.OperationSucceeded);
|
||||
snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), answer);
|
||||
future.complete(snapResult);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -583,7 +583,7 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||
res = new SnapshotResult(context.snapshot, null);
|
||||
res.setResult(result.getResult());
|
||||
} else {
|
||||
snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed);
|
||||
snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationSucceeded);
|
||||
res = new SnapshotResult(context.snapshot, null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -803,7 +803,7 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||
// no change to existing snapshot_store_ref, will try to re-sync later if other call triggers this sync operation
|
||||
} else {
|
||||
// this will update install path properly, next time it will not sync anymore.
|
||||
destSnapshot.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
destSnapshot.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
}
|
||||
future.complete(res);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -833,7 +833,7 @@ public class SnapshotServiceImpl implements SnapshotService {
|
|||
try {
|
||||
SnapshotObject srcSnapshot = (SnapshotObject)snapshot;
|
||||
srcSnapshot.processEvent(Event.DestroyRequested);
|
||||
srcSnapshot.processEvent(Event.OperationSuccessed);
|
||||
srcSnapshot.processEvent(Event.OperationSucceeded);
|
||||
|
||||
srcSnapshot.processEvent(Snapshot.Event.OperationFailed);
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ public class DataObjectManagerImpl implements DataObjectManager {
|
|||
}
|
||||
|
||||
try {
|
||||
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationSuccessed);
|
||||
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationSucceeded);
|
||||
} catch (NoTransitionException e) {
|
||||
try {
|
||||
objectInDataStoreMgr.update(objInStrore, ObjectInDataStoreStateMachine.Event.OperationFailed);
|
||||
|
|
@ -267,7 +267,7 @@ public class DataObjectManagerImpl implements DataObjectManager {
|
|||
}
|
||||
|
||||
try {
|
||||
objectInDataStoreMgr.update(destObj, ObjectInDataStoreStateMachine.Event.OperationSuccessed);
|
||||
objectInDataStoreMgr.update(destObj, ObjectInDataStoreStateMachine.Event.OperationSucceeded);
|
||||
} catch (NoTransitionException e) {
|
||||
logger.debug("Failed to update copying state: ", e);
|
||||
try {
|
||||
|
|
@ -341,7 +341,7 @@ public class DataObjectManagerImpl implements DataObjectManager {
|
|||
|
||||
} else {
|
||||
try {
|
||||
objectInDataStoreMgr.update(destObj, Event.OperationSuccessed);
|
||||
objectInDataStoreMgr.update(destObj, Event.OperationSucceeded);
|
||||
} catch (NoTransitionException e) {
|
||||
logger.debug("delete failed", e);
|
||||
} catch (ConcurrentOperationException e) {
|
||||
|
|
@ -365,7 +365,7 @@ public class DataObjectManagerImpl implements DataObjectManager {
|
|||
event = ObjectInDataStoreStateMachine.Event.CreateRequested;
|
||||
objectInDataStoreMgr.update(objInStore, event);
|
||||
|
||||
objectInDataStoreMgr.update(objInStore, ObjectInDataStoreStateMachine.Event.OperationSuccessed);
|
||||
objectInDataStoreMgr.update(objInStore, ObjectInDataStoreStateMachine.Event.OperationSucceeded);
|
||||
} catch (NoTransitionException e) {
|
||||
logger.debug("Failed to update state", e);
|
||||
throw new CloudRuntimeException("Failed to update state", e);
|
||||
|
|
|
|||
|
|
@ -99,27 +99,27 @@ public class ObjectInDataStoreManagerImpl implements ObjectInDataStoreManager {
|
|||
stateMachines.addTransition(State.Allocated, Event.CreateOnlyRequested, State.Creating);
|
||||
stateMachines.addTransition(State.Allocated, Event.DestroyRequested, State.Destroying);
|
||||
stateMachines.addTransition(State.Allocated, Event.OperationFailed, State.Failed);
|
||||
stateMachines.addTransition(State.Allocated, Event.OperationSuccessed, State.Ready);
|
||||
stateMachines.addTransition(State.Allocated, Event.OperationSucceeded, State.Ready);
|
||||
stateMachines.addTransition(State.Creating, Event.OperationFailed, State.Allocated);
|
||||
stateMachines.addTransition(State.Creating, Event.OperationSuccessed, State.Ready);
|
||||
stateMachines.addTransition(State.Creating, Event.OperationSucceeded, State.Ready);
|
||||
stateMachines.addTransition(State.Ready, Event.CopyingRequested, State.Copying);
|
||||
stateMachines.addTransition(State.Copying, Event.OperationSuccessed, State.Ready);
|
||||
stateMachines.addTransition(State.Copying, Event.OperationSucceeded, State.Ready);
|
||||
stateMachines.addTransition(State.Copying, Event.OperationFailed, State.Ready);
|
||||
stateMachines.addTransition(State.Ready, Event.DestroyRequested, State.Destroying);
|
||||
stateMachines.addTransition(State.Destroying, Event.DestroyRequested, State.Destroying);
|
||||
stateMachines.addTransition(State.Destroying, Event.OperationSuccessed, State.Destroyed);
|
||||
stateMachines.addTransition(State.Destroying, Event.OperationSucceeded, State.Destroyed);
|
||||
stateMachines.addTransition(State.Destroying, Event.OperationFailed, State.Destroying);
|
||||
stateMachines.addTransition(State.Failed, Event.DestroyRequested, State.Destroying);
|
||||
// TODO: further investigate why an extra event is sent when it is
|
||||
// already Ready for DownloadListener
|
||||
stateMachines.addTransition(State.Ready, Event.OperationSuccessed, State.Ready);
|
||||
stateMachines.addTransition(State.Ready, Event.OperationSucceeded, State.Ready);
|
||||
// State transitions for data object migration
|
||||
stateMachines.addTransition(State.Ready, Event.MigrateDataRequested, State.Migrating);
|
||||
stateMachines.addTransition(State.Ready, Event.CopyRequested, State.Copying);
|
||||
stateMachines.addTransition(State.Allocated, Event.MigrateDataRequested, State.Migrating);
|
||||
stateMachines.addTransition(State.Migrating, Event.MigrationFailed, State.Failed);
|
||||
stateMachines.addTransition(State.Migrating, Event.MigrationSucceeded, State.Destroyed);
|
||||
stateMachines.addTransition(State.Migrating, Event.OperationSuccessed, State.Ready);
|
||||
stateMachines.addTransition(State.Migrating, Event.OperationSucceeded, State.Ready);
|
||||
stateMachines.addTransition(State.Migrating, Event.OperationFailed, State.Ready);
|
||||
stateMachines.addTransition(State.Hidden, Event.DestroyRequested, State.Destroying);
|
||||
}
|
||||
|
|
@ -360,9 +360,7 @@ public class ObjectInDataStoreManagerImpl implements ObjectInDataStoreManager {
|
|||
break;
|
||||
}
|
||||
} else if (data.getType() == DataObjectType.TEMPLATE && data.getDataStore().getRole() == DataStoreRole.Primary) {
|
||||
|
||||
result = this.stateMachines.transitTo(obj, event, null, templatePoolDao);
|
||||
|
||||
} else if (data.getType() == DataObjectType.SNAPSHOT && data.getDataStore().getRole() == DataStoreRole.Primary) {
|
||||
result = this.stateMachines.transitTo(obj, event, null, snapshotDataStoreDao);
|
||||
} else {
|
||||
|
|
@ -422,7 +420,5 @@ public class ObjectInDataStoreManagerImpl implements ObjectInDataStoreManager {
|
|||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ public class VolumeObject implements VolumeInfo {
|
|||
}
|
||||
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.DestroyRequested, Volume.Event.DestroyRequested);
|
||||
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.ExpungeRequested, Volume.Event.ExpungingRequested);
|
||||
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.OperationSuccessed, Volume.Event.OperationSucceeded);
|
||||
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.OperationSucceeded, Volume.Event.OperationSucceeded);
|
||||
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.MigrationCopySucceeded, Volume.Event.MigrationCopySucceeded);
|
||||
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.OperationFailed, Volume.Event.OperationFailed);
|
||||
mapOfEvents.put(ObjectInDataStoreStateMachine.Event.MigrationCopyFailed, Volume.Event.MigrationCopyFailed);
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
DataObject vo = context.getVolume();
|
||||
String errMsg = null;
|
||||
if (result.isSuccess()) {
|
||||
vo.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
vo.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
} else {
|
||||
vo.processEvent(Event.OperationFailed);
|
||||
errMsg = result.getResult();
|
||||
|
|
@ -485,7 +485,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
VolumeApiResult apiResult = new VolumeApiResult(vo);
|
||||
try {
|
||||
if (result.isSuccess()) {
|
||||
vo.processEvent(Event.OperationSuccessed);
|
||||
vo.processEvent(Event.OperationSucceeded);
|
||||
|
||||
if (vo.getPassphraseId() != null) {
|
||||
vo.deletePassphrase();
|
||||
|
|
@ -758,7 +758,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
|
||||
if (result.isSuccess()) {
|
||||
((TemplateObject)templateOnPrimaryStoreObj).setInstallPath(result.getPath());
|
||||
templateOnPrimaryStoreObj.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
templateOnPrimaryStoreObj.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
} else {
|
||||
templateOnPrimaryStoreObj.processEvent(Event.OperationFailed);
|
||||
}
|
||||
|
|
@ -778,7 +778,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
DataObject templateOnPrimaryStoreObj = context.destObj;
|
||||
|
||||
if (result.isSuccess()) {
|
||||
templateOnPrimaryStoreObj.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
templateOnPrimaryStoreObj.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
} else {
|
||||
templateOnPrimaryStoreObj.processEvent(Event.OperationFailed);
|
||||
}
|
||||
|
|
@ -802,7 +802,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
return null;
|
||||
}
|
||||
|
||||
templateOnPrimaryStoreObj.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
templateOnPrimaryStoreObj.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
createVolumeFromBaseImageAsync(context.volume, templateOnPrimaryStoreObj, context.dataStore, future);
|
||||
return null;
|
||||
}
|
||||
|
|
@ -853,7 +853,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
String deployAsIsConfiguration = context.deployAsIsConfiguration;
|
||||
|
||||
if (result.isSuccess()) {
|
||||
vo.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
vo.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
} else {
|
||||
|
||||
vo.processEvent(Event.OperationFailed);
|
||||
|
|
@ -908,7 +908,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
}
|
||||
|
||||
volDao.update(volume.getId(), volume);
|
||||
vo.processEvent(Event.OperationSuccessed);
|
||||
vo.processEvent(Event.OperationSucceeded);
|
||||
} else {
|
||||
volResult.setResult(result.getResult());
|
||||
|
||||
|
|
@ -972,7 +972,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
throw new CloudRuntimeException(String.format("Unable to create template %s on primary storage %s: %s", templateOnPrimary.getImage(), destPrimaryDataStore, errMesg));
|
||||
}
|
||||
|
||||
templateOnPrimary.processEvent(Event.OperationSuccessed);
|
||||
templateOnPrimary.processEvent(Event.OperationSucceeded);
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.debug("Failed to create template volume on storage", e);
|
||||
|
|
@ -1445,7 +1445,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
logger.debug("Failed to prepare ready bypassed template: {} on primary storage: {}", srcTemplateInfo, templateOnPrimary);
|
||||
throw new CloudRuntimeException(String.format("Failed to prepare ready bypassed template: %s on primary storage: %s", srcTemplateInfo, templateOnPrimary));
|
||||
}
|
||||
templateOnPrimary.processEvent(Event.OperationSuccessed);
|
||||
templateOnPrimary.processEvent(Event.OperationSucceeded);
|
||||
return templateOnPrimaryNow;
|
||||
} finally {
|
||||
revokeAccess(templateOnPrimary, destHost, destPrimaryDataStore);
|
||||
|
|
@ -1700,7 +1700,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
apiResult.setResult(result.getResult());
|
||||
event = Event.OperationFailed;
|
||||
} else {
|
||||
event = Event.OperationSuccessed;
|
||||
event = Event.OperationSucceeded;
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -1806,8 +1806,8 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
return null;
|
||||
}
|
||||
|
||||
srcVolume.processEvent(Event.OperationSuccessed);
|
||||
destVolume.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
srcVolume.processEvent(Event.OperationSucceeded);
|
||||
destVolume.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
srcVolume.getDataStore().delete(srcVolume);
|
||||
future.complete(res);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1857,8 +1857,8 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
res.setResult(result.getResult());
|
||||
future.complete(res);
|
||||
} else {
|
||||
srcVolume.processEvent(Event.OperationSuccessed); // back to Ready state in Volume table
|
||||
destVolume.processEventOnly(Event.OperationSuccessed, result.getAnswer());
|
||||
srcVolume.processEvent(Event.OperationSucceeded); // back to Ready state in Volume table
|
||||
destVolume.processEventOnly(Event.OperationSucceeded, result.getAnswer());
|
||||
future.complete(res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1940,7 +1940,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
if (destVolume.getStoragePoolType() == StoragePoolType.PowerFlex) {
|
||||
logger.info("Dest volume {} can be removed", destVolume);
|
||||
destVolume.processEvent(Event.ExpungeRequested);
|
||||
destVolume.processEvent(Event.OperationSuccessed);
|
||||
destVolume.processEvent(Event.OperationSucceeded);
|
||||
volDao.remove(destVolume.getId());
|
||||
future.complete(res);
|
||||
return null;
|
||||
|
|
@ -1973,7 +1973,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
|
||||
protected boolean destroySourceVolumeAfterMigration(Event destinationEvent, Answer destinationEventAnswer, VolumeInfo sourceVolume,
|
||||
VolumeInfo destinationVolume, boolean retryExpungeVolumeAsync) {
|
||||
sourceVolume.processEvent(Event.OperationSuccessed);
|
||||
sourceVolume.processEvent(Event.OperationSucceeded);
|
||||
destinationVolume.processEvent(destinationEvent, destinationEventAnswer);
|
||||
|
||||
VolumeVO sourceVolumeVo = ((VolumeObject) sourceVolume).getVolume();
|
||||
|
|
@ -1989,7 +1989,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
if (sourceVolume.getStoragePoolType() == StoragePoolType.PowerFlex) {
|
||||
logger.info("Source volume {} can be removed.", sourceVolumeVo);
|
||||
sourceVolume.processEvent(Event.ExpungeRequested);
|
||||
sourceVolume.processEvent(Event.OperationSuccessed);
|
||||
sourceVolume.processEvent(Event.OperationSucceeded);
|
||||
volDao.remove(sourceVolume.getId());
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2084,7 +2084,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
logger.debug("Failed to create dest volume {}, volume can be removed", destVolume);
|
||||
destroyVolume(destVolume.getId());
|
||||
destVolume.processEvent(Event.ExpungeRequested);
|
||||
destVolume.processEvent(Event.OperationSuccessed);
|
||||
destVolume.processEvent(Event.OperationSucceeded);
|
||||
volDao.remove(destVolume.getId());
|
||||
throw new CloudRuntimeException("Creation of a dest volume failed: " + createVolumeResult.getResult());
|
||||
}
|
||||
|
|
@ -2173,7 +2173,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
logger.debug("failed to clean up managed volume on storage", e);
|
||||
}
|
||||
} else {
|
||||
srcVolume.processEvent(Event.OperationSuccessed);
|
||||
srcVolume.processEvent(Event.OperationSucceeded);
|
||||
destVolume.processEvent(Event.MigrationCopySucceeded, result.getAnswer());
|
||||
volDao.updateUuid(srcVolume.getId(), destVolume.getId());
|
||||
volDao.detachVolume(srcVolume.getId());
|
||||
|
|
@ -2293,7 +2293,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
srcVolume.processEvent(Event.OperationFailed);
|
||||
future.complete(res);
|
||||
} else {
|
||||
srcVolume.processEvent(Event.OperationSuccessed);
|
||||
srcVolume.processEvent(Event.OperationSucceeded);
|
||||
if (srcVolume.getStoragePoolType() == StoragePoolType.PowerFlex) {
|
||||
future.complete(res);
|
||||
return null;
|
||||
|
|
@ -2380,7 +2380,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
for (Map.Entry<VolumeInfo, DataStore> entry : volumeToPool.entrySet()) {
|
||||
VolumeInfo volume = entry.getKey();
|
||||
snapshotMgr.cleanupSnapshotsByVolume(volume.getId());
|
||||
volume.processEvent(Event.OperationSuccessed);
|
||||
volume.processEvent(Event.OperationSucceeded);
|
||||
}
|
||||
future.complete(res);
|
||||
}
|
||||
|
|
@ -2448,7 +2448,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
}
|
||||
|
||||
} else {
|
||||
vo.processEvent(Event.OperationSuccessed, result.getAnswer());
|
||||
vo.processEvent(Event.OperationSucceeded, result.getAnswer());
|
||||
|
||||
if (vo.getSize() != null) {
|
||||
// publish usage events
|
||||
|
|
@ -2568,7 +2568,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
}
|
||||
|
||||
try {
|
||||
volume.processEvent(Event.OperationSuccessed);
|
||||
volume.processEvent(Event.OperationSucceeded);
|
||||
} catch (Exception e) {
|
||||
logger.debug("Failed to change volume state (after resize success)", e);
|
||||
}
|
||||
|
|
@ -2657,7 +2657,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
|
||||
if (volume.getState() == State.NotUploaded || volume.getState() == State.UploadInProgress) {
|
||||
VolumeObject volObj = (VolumeObject)volFactory.getVolume(volume.getId());
|
||||
volObj.processEvent(Event.OperationSuccessed);
|
||||
volObj.processEvent(Event.OperationSucceeded);
|
||||
}
|
||||
|
||||
if (volInfo.getSize() > 0) {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public class VolumeObjectTest extends TestCase{
|
|||
expectedResult.put(ObjectInDataStoreStateMachine.Event.MigrationRequested, Volume.Event.CopyRequested);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.DestroyRequested, Volume.Event.DestroyRequested);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.ExpungeRequested, Volume.Event.ExpungingRequested);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.OperationSuccessed, Volume.Event.OperationSucceeded);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.OperationSucceeded, Volume.Event.OperationSucceeded);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.MigrationCopySucceeded, Volume.Event.MigrationCopySucceeded);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.OperationFailed, Volume.Event.OperationFailed);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.MigrationCopyFailed, Volume.Event.MigrationCopyFailed);
|
||||
|
|
@ -177,7 +177,7 @@ public class VolumeObjectTest extends TestCase{
|
|||
expectedResult.put(ObjectInDataStoreStateMachine.Event.MigrationCopyRequested, Volume.Event.MigrationCopyRequested);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.DestroyRequested, Volume.Event.DestroyRequested);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.ExpungeRequested, Volume.Event.ExpungingRequested);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.OperationSuccessed, Volume.Event.OperationSucceeded);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.OperationSucceeded, Volume.Event.OperationSucceeded);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.MigrationCopySucceeded, Volume.Event.MigrationCopySucceeded);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.OperationFailed, Volume.Event.OperationFailed);
|
||||
expectedResult.put(ObjectInDataStoreStateMachine.Event.MigrationCopyFailed, Volume.Event.MigrationCopyFailed);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import org.apache.cloudstack.storage.datastore.client.ScaleIOGatewayClient;
|
|||
import org.apache.cloudstack.storage.datastore.util.ScaleIOUtil;
|
||||
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import org.apache.cloudstack.utils.security.ParserUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.libvirt.Connect;
|
||||
|
|
@ -237,7 +238,7 @@ public class LibvirtMigrateVolumeCommandWrapper extends CommandWrapper<MigrateVo
|
|||
|
||||
private String generateDestinationDiskLabel(String diskXml) throws ParserConfigurationException, IOException, SAXException {
|
||||
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory dbFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||
Document doc = dBuilder.parse(new ByteArrayInputStream(diskXml.getBytes("UTF-8")));
|
||||
doc.getDocumentElement().normalize();
|
||||
|
|
@ -251,7 +252,7 @@ public class LibvirtMigrateVolumeCommandWrapper extends CommandWrapper<MigrateVo
|
|||
protected String generateDestinationDiskXML(Domain dm, String srcVolumeId, String diskFilePath, String destSecretUUID) throws LibvirtException, ParserConfigurationException, IOException, TransformerException, SAXException {
|
||||
final String domXml = dm.getXMLDesc(0);
|
||||
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory dbFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
||||
Document doc = dBuilder.parse(new ByteArrayInputStream(domXml.getBytes("UTF-8")));
|
||||
doc.getDocumentElement().normalize();
|
||||
|
|
|
|||
|
|
@ -441,16 +441,30 @@ public class KubernetesClusterScaleWorker extends KubernetesClusterResourceModif
|
|||
if (this.nodeIds != null) {
|
||||
vmList = getKubernetesClusterVMMapsForNodes(this.nodeIds).stream().filter(vm -> !vm.isExternalNode()).collect(Collectors.toList());
|
||||
} else {
|
||||
vmList = getKubernetesClusterVMMaps();
|
||||
vmList = vmList.stream()
|
||||
.filter(vm -> !vm.isExternalNode() && !vm.isControlNode() && !vm.isEtcdNode())
|
||||
.collect(Collectors.toList());
|
||||
vmList = vmList.subList((int) (kubernetesCluster.getControlNodeCount() + clusterSize - 1), vmList.size());
|
||||
vmList = getWorkerNodesToRemove();
|
||||
if (vmList.isEmpty()) {
|
||||
logger.info("No nodes to remove from Kubernetes cluster: {}", kubernetesCluster);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Collections.reverse(vmList);
|
||||
removeNodesFromCluster(vmList);
|
||||
}
|
||||
|
||||
public List<KubernetesClusterVmMapVO> getWorkerNodesToRemove() {
|
||||
List<KubernetesClusterVmMapVO> workerVMsMap = getKubernetesClusterVMMaps().stream()
|
||||
.filter(vm -> !vm.isExternalNode() && !vm.isControlNode() && !vm.isEtcdNode())
|
||||
.collect(Collectors.toList());
|
||||
int totalWorkerNodes = workerVMsMap.size();
|
||||
int desiredWorkerNodes = clusterSize == null ? (int) kubernetesCluster.getNodeCount() : clusterSize.intValue();
|
||||
int toRemoveCount = Math.max(0, totalWorkerNodes - desiredWorkerNodes);
|
||||
if (toRemoveCount == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
int startIndex = Math.max(0, totalWorkerNodes - toRemoveCount);
|
||||
return new ArrayList<>(workerVMsMap.subList(startIndex, totalWorkerNodes));
|
||||
}
|
||||
|
||||
private void scaleUpKubernetesClusterSize(final long newVmCount) throws CloudRuntimeException {
|
||||
if (!kubernetesCluster.getState().equals(KubernetesCluster.State.Scaling)) {
|
||||
stateTransitTo(kubernetesCluster.getId(), KubernetesCluster.Event.ScaleUpRequested);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
package com.cloud.kubernetes.cluster.actionworkers;
|
||||
|
||||
import com.cloud.kubernetes.cluster.KubernetesCluster;
|
||||
import com.cloud.kubernetes.cluster.KubernetesClusterManagerImpl;
|
||||
import com.cloud.kubernetes.cluster.KubernetesClusterVmMapVO;
|
||||
import com.cloud.kubernetes.cluster.KubernetesClusterManagerImpl;
|
||||
import com.cloud.kubernetes.cluster.dao.KubernetesClusterVmMapDao;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
|
|
@ -29,15 +29,17 @@ import com.cloud.vm.dao.UserVmDao;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cloud.kubernetes.cluster.KubernetesServiceHelper.KubernetesClusterNodeType.DEFAULT;
|
||||
import static com.cloud.kubernetes.cluster.KubernetesServiceHelper.KubernetesClusterNodeType.CONTROL;
|
||||
import static com.cloud.kubernetes.cluster.KubernetesServiceHelper.KubernetesClusterNodeType.DEFAULT;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class KubernetesClusterScaleWorkerTest {
|
||||
|
|
@ -125,4 +127,64 @@ public class KubernetesClusterScaleWorkerTest {
|
|||
Assert.assertEquals(expectedCores, newClusterCapacity.first().longValue());
|
||||
Assert.assertEquals(expectedMemory, newClusterCapacity.second().longValue());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetWorkerNodesToRemoveForDownsize_singleRemoval() {
|
||||
KubernetesCluster kubernetesCluster = Mockito.mock(KubernetesCluster.class);
|
||||
KubernetesClusterManagerImpl clusterManager = Mockito.mock(KubernetesClusterManagerImpl.class);
|
||||
KubernetesClusterScaleWorker worker = new KubernetesClusterScaleWorker(kubernetesCluster, new java.util.HashMap<>(), 2L, null, false, null, null, clusterManager);
|
||||
KubernetesClusterScaleWorker spyWorker = Mockito.spy(worker);
|
||||
|
||||
KubernetesClusterVmMapVO vm1 = Mockito.mock(KubernetesClusterVmMapVO.class);
|
||||
Mockito.when(vm1.isExternalNode()).thenReturn(false);
|
||||
Mockito.when(vm1.isControlNode()).thenReturn(false);
|
||||
Mockito.when(vm1.isEtcdNode()).thenReturn(false);
|
||||
|
||||
KubernetesClusterVmMapVO vm2 = Mockito.mock(KubernetesClusterVmMapVO.class);
|
||||
Mockito.when(vm2.isExternalNode()).thenReturn(false);
|
||||
Mockito.when(vm2.isControlNode()).thenReturn(false);
|
||||
Mockito.when(vm2.isEtcdNode()).thenReturn(false);
|
||||
|
||||
KubernetesClusterVmMapVO vm3 = Mockito.mock(KubernetesClusterVmMapVO.class);
|
||||
Mockito.when(vm3.isExternalNode()).thenReturn(false);
|
||||
Mockito.when(vm3.isControlNode()).thenReturn(false);
|
||||
Mockito.when(vm3.isEtcdNode()).thenReturn(false);
|
||||
|
||||
Mockito.doReturn(Arrays.asList(vm1, vm2, vm3)).when(spyWorker).getKubernetesClusterVMMaps();
|
||||
|
||||
List<KubernetesClusterVmMapVO> toRemove = spyWorker.getWorkerNodesToRemove();
|
||||
|
||||
Assert.assertEquals(1, toRemove.size());
|
||||
Assert.assertSame(vm3, toRemove.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetWorkerNodesToRemoveForDownsize_noRemoval() {
|
||||
KubernetesCluster kubernetesCluster = Mockito.mock(KubernetesCluster.class);
|
||||
|
||||
KubernetesClusterScaleWorker worker = new KubernetesClusterScaleWorker(kubernetesCluster, new java.util.HashMap<>(), 3L, null, false, null, null, clusterManager);
|
||||
KubernetesClusterScaleWorker spyWorker = Mockito.spy(worker);
|
||||
|
||||
KubernetesClusterVmMapVO vm1 = Mockito.mock(KubernetesClusterVmMapVO.class);
|
||||
Mockito.when(vm1.isExternalNode()).thenReturn(false);
|
||||
Mockito.when(vm1.isControlNode()).thenReturn(false);
|
||||
Mockito.when(vm1.isEtcdNode()).thenReturn(false);
|
||||
|
||||
KubernetesClusterVmMapVO vm2 = Mockito.mock(KubernetesClusterVmMapVO.class);
|
||||
Mockito.when(vm2.isExternalNode()).thenReturn(false);
|
||||
Mockito.when(vm2.isControlNode()).thenReturn(false);
|
||||
Mockito.when(vm2.isEtcdNode()).thenReturn(false);
|
||||
|
||||
KubernetesClusterVmMapVO vm3 = Mockito.mock(KubernetesClusterVmMapVO.class);
|
||||
Mockito.when(vm3.isExternalNode()).thenReturn(false);
|
||||
Mockito.when(vm3.isControlNode()).thenReturn(false);
|
||||
Mockito.when(vm3.isEtcdNode()).thenReturn(false);
|
||||
|
||||
Mockito.doReturn(Arrays.asList(vm1, vm2, vm3)).when(spyWorker).getKubernetesClusterVMMaps();
|
||||
|
||||
List<KubernetesClusterVmMapVO> toRemove = spyWorker.getWorkerNodesToRemove();
|
||||
|
||||
Assert.assertTrue(toRemove.isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,22 +24,24 @@ All notable changes to Linstor CloudStack plugin will be documented in this file
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2025-12-18]
|
||||
|
||||
### Changed
|
||||
- Provide /dev/drbd/by-res/ resource paths to CloudStack for usage.
|
||||
|
||||
## [2025-10-03]
|
||||
|
||||
### Changed
|
||||
|
||||
- Revert qcow2 snapshot now use sparse/discard options to convert on thin devices.
|
||||
|
||||
## [2025-08-05]
|
||||
|
||||
### Fixed
|
||||
|
||||
- getVolumeStats wasn't correctly working if multiple Linstor clusters/primary storages are used.
|
||||
|
||||
## [2025-07-01]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Regression in 4.19.3 and 4.21.0 with templates from snapshots
|
||||
|
||||
## [2025-05-07]
|
||||
|
|
@ -50,25 +52,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [2025-03-13]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Implemented missing delete datastore, to correctly cleanup on datastore removal
|
||||
|
||||
## [2025-02-21]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Always try to delete cs-...-rst resource before doing a snapshot backup
|
||||
|
||||
## [2025-01-27]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Use of multiple primary storages on the same linstor controller
|
||||
|
||||
## [2025-01-20]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Volume snapshots on zfs used the wrong dataset path to hide/unhide snapdev
|
||||
|
||||
## [2024-12-19]
|
||||
|
|
@ -79,13 +77,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [2024-12-13]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Linstor heartbeat check now also ask linstor-controller if there is no connection between nodes
|
||||
|
||||
## [2024-12-11]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Only set allow-two-primaries if a live migration is performed
|
||||
|
||||
## [2024-10-28]
|
||||
|
|
@ -98,17 +94,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [2024-10-14]
|
||||
|
||||
### Added
|
||||
|
||||
- Support for ISO direct download to primary storage
|
||||
|
||||
## [2024-10-04]
|
||||
|
||||
### Added
|
||||
|
||||
- Enable qemu discard="unmap" for Linstor block disks
|
||||
|
||||
## [2024-08-27]
|
||||
|
||||
### Changed
|
||||
|
||||
- Allow two primaries(+protocol c) is now set on resource-connection level instead of rd
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
|
|||
makeResourceAvailable(api, foundRscName, false);
|
||||
|
||||
if (!resources.isEmpty() && !resources.get(0).getVolumes().isEmpty()) {
|
||||
final String devPath = resources.get(0).getVolumes().get(0).getDevicePath();
|
||||
final String devPath = LinstorUtil.getDevicePathFromResource(resources.get(0));
|
||||
logger.info("Linstor: Created drbd device: " + devPath);
|
||||
final KVMPhysicalDisk kvmDisk = new KVMPhysicalDisk(devPath, name, pool);
|
||||
kvmDisk.setFormat(QemuImg.PhysicalDiskFormat.RAW);
|
||||
|
|
@ -456,8 +456,9 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
|
|||
private Optional<ResourceWithVolumes> getResourceByPathOrName(
|
||||
final List<ResourceWithVolumes> resources, String path) {
|
||||
return resources.stream()
|
||||
.filter(rsc -> getLinstorRscName(path).equalsIgnoreCase(rsc.getName()) || rsc.getVolumes().stream()
|
||||
.anyMatch(v -> path.equals(v.getDevicePath())))
|
||||
.filter(rsc -> getLinstorRscName(path).equalsIgnoreCase(rsc.getName()) ||
|
||||
path.equals(LinstorUtil.formatDrbdByResDevicePath(rsc.getName())) ||
|
||||
rsc.getVolumes().stream().anyMatch(v -> path.equals(v.getDevicePath())))
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -264,6 +264,16 @@ public class LinstorUtil {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the device path for DRBD resources.
|
||||
* @param rscName
|
||||
* @return
|
||||
*/
|
||||
public static String formatDrbdByResDevicePath(String rscName)
|
||||
{
|
||||
return String.format("/dev/drbd/by-res/%s/0", rscName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get the device path for the given resource name.
|
||||
* This could be made a bit more direct after java-linstor api is fixed for layer data subtypes.
|
||||
|
|
@ -283,12 +293,7 @@ public class LinstorUtil {
|
|||
null);
|
||||
for (ResourceWithVolumes rsc : resources) {
|
||||
if (!rsc.getVolumes().isEmpty()) {
|
||||
// CloudStack resource always only have 1 volume
|
||||
String devicePath = rsc.getVolumes().get(0).getDevicePath();
|
||||
if (devicePath != null && !devicePath.isEmpty()) {
|
||||
LOGGER.debug("getDevicePath: {} -> {}", rscName, devicePath);
|
||||
return devicePath;
|
||||
}
|
||||
return LinstorUtil.getDevicePathFromResource(rsc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -297,6 +302,24 @@ public class LinstorUtil {
|
|||
throw new CloudRuntimeException("Linstor: " + errMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the resource has DRBD or not and deliver the correct device path.
|
||||
* @param rsc
|
||||
* @return
|
||||
*/
|
||||
public static String getDevicePathFromResource(ResourceWithVolumes rsc) {
|
||||
if (!rsc.getVolumes().isEmpty()) {
|
||||
// CloudStack resource always only have 1 volume
|
||||
if (rsc.getLayerObject().getDrbd() != null) {
|
||||
return formatDrbdByResDevicePath(rsc.getName());
|
||||
} else {
|
||||
return rsc.getVolumes().get(0).getDevicePath();
|
||||
}
|
||||
}
|
||||
throw new CloudRuntimeException(
|
||||
String.format("getDevicePath: Resource %s/%s doesn't have volumes", rsc.getNodeName(), rsc.getName()));
|
||||
}
|
||||
|
||||
public static ApiCallRcList applyAuxProps(DevelopersApi api, String rscName, String dispName, String vmName)
|
||||
throws ApiException
|
||||
{
|
||||
|
|
|
|||
|
|
@ -457,8 +457,8 @@ public class StorPoolDataMotionStrategy implements DataMotionStrategy {
|
|||
VolumeInfo destVolumeInfo = entry.getValue();
|
||||
|
||||
if (success) {
|
||||
srcVolumeInfo.processEvent(Event.OperationSuccessed);
|
||||
destVolumeInfo.processEvent(Event.OperationSuccessed);
|
||||
srcVolumeInfo.processEvent(Event.OperationSucceeded);
|
||||
destVolumeInfo.processEvent(Event.OperationSucceeded);
|
||||
|
||||
_volumeDao.updateUuid(srcVolumeInfo.getId(), destVolumeInfo.getId());
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ public class StorPoolSnapshotStrategy implements SnapshotStrategy {
|
|||
StorPoolUtil.spLog("StorpoolSnapshotStrategy.deleteSnapshot: executed successfully=%s, snapshot uuid=%s, name=%s", res, snapshotVO.getUuid(), name);
|
||||
}
|
||||
if (res) {
|
||||
processResult(snapshotInfos, Event.OperationSuccessed);
|
||||
processResult(snapshotInfos, Event.OperationSucceeded);
|
||||
cleanUpDestroyedRecords(snapshotId);
|
||||
} else {
|
||||
processResult(snapshotInfos, Event.OperationFailed);
|
||||
|
|
@ -261,7 +261,7 @@ public class StorPoolSnapshotStrategy implements SnapshotStrategy {
|
|||
if (parent.getPath() != null && parent.getPath().equalsIgnoreCase(snapshot.getPath())) {
|
||||
logger.debug("for empty delta snapshot, only mark it as destroyed in db");
|
||||
snapshot.processEvent(Event.DestroyRequested);
|
||||
snapshot.processEvent(Event.OperationSuccessed);
|
||||
snapshot.processEvent(Event.OperationSucceeded);
|
||||
deleted = true;
|
||||
if (!resultIsSet) {
|
||||
result = true;
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ public class DatabaseConfig {
|
|||
try {
|
||||
final File configFile = new File(_configFileName);
|
||||
|
||||
SAXParserFactory spfactory = SAXParserFactory.newInstance();
|
||||
SAXParserFactory spfactory = ParserUtils.getSaferSAXParserFactory();
|
||||
final SAXParser saxParser = spfactory.newSAXParser();
|
||||
final DbConfigXMLHandler handler = new DbConfigXMLHandler();
|
||||
handler.setParent(this);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
<script>
|
||||
import { ref, reactive, toRaw } from 'vue'
|
||||
import moment from 'moment'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
export default {
|
||||
name: 'DateTimeFilter',
|
||||
|
|
@ -84,20 +84,6 @@ export default {
|
|||
value: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
startDate () {
|
||||
if (this.startDateProp) {
|
||||
return moment(this.startDateProp)
|
||||
}
|
||||
return null
|
||||
},
|
||||
endDate () {
|
||||
if (this.endDateProp) {
|
||||
return moment(this.endDateProp)
|
||||
}
|
||||
return null
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
allDataIsChecked: false,
|
||||
|
|
@ -110,19 +96,27 @@ export default {
|
|||
submitButtonLabel: this.$t('label.ok')
|
||||
}
|
||||
},
|
||||
updated () {
|
||||
this.form.startDate = this.startDate
|
||||
this.form.endDate = this.endDate
|
||||
},
|
||||
created () {
|
||||
this.initForm()
|
||||
},
|
||||
watch: {
|
||||
startDateProp (newVal) {
|
||||
this.form.startDate = newVal ? dayjs(newVal) : null
|
||||
},
|
||||
endDateProp (newVal) {
|
||||
this.form.endDate = newVal ? dayjs(newVal) : null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initForm () {
|
||||
this.formRef = ref()
|
||||
// Use dayjs instead of moment - Ant Design Vue requires dayjs
|
||||
const startDate = this.startDateProp ? dayjs(this.startDateProp) : null
|
||||
const endDate = this.endDateProp ? dayjs(this.endDateProp) : null
|
||||
|
||||
this.form = reactive({
|
||||
startDate: this.startDate,
|
||||
endDate: this.endDate
|
||||
startDate: startDate,
|
||||
endDate: endDate
|
||||
})
|
||||
},
|
||||
handleSubmit (e) {
|
||||
|
|
@ -130,7 +124,12 @@ export default {
|
|||
this.formRef.value.validate().then(() => {
|
||||
this.submitButtonLabel = this.$t('label.refresh')
|
||||
const values = toRaw(this.form)
|
||||
this.$emit('onSubmit', values)
|
||||
// Convert dayjs objects back to JavaScript Date objects
|
||||
const result = {
|
||||
startDate: values.startDate ? values.startDate.toDate() : null,
|
||||
endDate: values.endDate ? values.endDate.toDate() : null
|
||||
}
|
||||
this.$emit('onSubmit', result)
|
||||
}).catch(error => {
|
||||
this.formRef.value.scrollToField(error.errorFields[0].name)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ export default {
|
|||
params.payloadUrl = this.payloadUrl
|
||||
}
|
||||
if (this.sslVerification) {
|
||||
params.payload = this.sslVerification
|
||||
params.sslVerification = this.sslVerification
|
||||
}
|
||||
if (this.secretKey) {
|
||||
params.secretKey = this.secretKey
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@
|
|||
<test-webhook-delivery-view
|
||||
ref="dispatchview"
|
||||
:payloadUrl="form.payloadurl"
|
||||
:sslVerification="form.sslverification"
|
||||
:sslVerification="isPayloadUrlHttps && form.sslverification"
|
||||
:secretKey="form.secretkey"
|
||||
:showActions="!(!form.payloadurl)" />
|
||||
<a-form-item name="state" ref="state">
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
|||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.cloudstack.utils.security.ParserUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
|
|
@ -67,7 +68,7 @@ public class VsmCommand {
|
|||
public static String getAddPortProfile(String name, PortProfileType type, BindingType binding, SwitchPortMode mode, int vlanid, String vdc, String espName) {
|
||||
try {
|
||||
// Create the document and root element.
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -100,7 +101,7 @@ public class VsmCommand {
|
|||
public static String getAddPortProfile(String name, PortProfileType type, BindingType binding, SwitchPortMode mode, int vlanid) {
|
||||
try {
|
||||
// Create the document and root element.
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -133,7 +134,7 @@ public class VsmCommand {
|
|||
public static String getUpdatePortProfile(String name, SwitchPortMode mode, List<Pair<VsmCommand.OperationType, String>> params) {
|
||||
try {
|
||||
// Create the document and root element.
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -166,7 +167,7 @@ public class VsmCommand {
|
|||
public static String getDeletePortProfile(String portName) {
|
||||
try {
|
||||
// Create the document and root element.
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -199,7 +200,7 @@ public class VsmCommand {
|
|||
public static String getAddPolicyMap(String name, int averageRate, int maxRate, int burstRate) {
|
||||
try {
|
||||
// Create the document and root element.
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -232,7 +233,7 @@ public class VsmCommand {
|
|||
public static String getDeletePolicyMap(String name) {
|
||||
try {
|
||||
// Create the document and root element.
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -265,7 +266,7 @@ public class VsmCommand {
|
|||
public static String getServicePolicy(String policyMap, String portProfile, boolean attach) {
|
||||
try {
|
||||
// Create the document and root element.
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -297,7 +298,7 @@ public class VsmCommand {
|
|||
|
||||
public static String getPortProfile(String name) {
|
||||
try {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -334,7 +335,7 @@ public class VsmCommand {
|
|||
|
||||
public static String getPolicyMap(String name) {
|
||||
try {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
@ -367,7 +368,7 @@ public class VsmCommand {
|
|||
|
||||
public static String getHello() {
|
||||
try {
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
|
||||
|
|
@ -395,7 +396,7 @@ public class VsmCommand {
|
|||
public static String getVServiceNode(String vlanId, String ipAddr) {
|
||||
try {
|
||||
// Create the document and root element.
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilderFactory docFactory = ParserUtils.getSaferDocumentBuilderFactory();
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = docBuilder.getDOMImplementation();
|
||||
Document doc = createDocument(domImpl);
|
||||
|
|
|
|||
Loading…
Reference in New Issue