diff --git a/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java b/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java index 273e74895b5a..96bc716f1ca8 100644 --- a/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java +++ b/api/src/main/java/com/cloud/agent/api/to/NetworkTO.java @@ -44,6 +44,7 @@ public class NetworkTO { protected String ip6Dns1; protected String ip6Dns2; protected boolean linkState = true; + protected boolean nwfilter = false; public NetworkTO() { } @@ -241,4 +242,11 @@ public void setLinkState(boolean linkState) { this.linkState = linkState; } + public boolean getNwfilter() { + return nwfilter; + } + + public void setNwfilter(boolean nwfilter) { + this.nwfilter = nwfilter; + } } diff --git a/core/src/main/java/com/cloud/resource/ServerResourceBase.java b/core/src/main/java/com/cloud/resource/ServerResourceBase.java index d646caf7df31..3517c7b62d24 100644 --- a/core/src/main/java/com/cloud/resource/ServerResourceBase.java +++ b/core/src/main/java/com/cloud/resource/ServerResourceBase.java @@ -20,6 +20,8 @@ package com.cloud.resource; import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.net.NetworkInterface; @@ -64,6 +66,7 @@ public abstract class ServerResourceBase implements ServerResource { protected NetworkInterface storageNic; protected NetworkInterface storageNic2; protected IAgentControl agentControl; + protected static final String DEFAULT_LOCAL_STORAGE_PATH = "/var/lib/libvirt/images/"; @Override public String getName() { @@ -178,9 +181,9 @@ protected Answer listHostDevices() { return new ListHostDeviceAnswer(true, hostDevicesText); } - protected Answer createImageRbd(String names, long sizes, String poolPath) { - sizes = (sizes * 1024); - String cmdout = Script.runSimpleBashScript("rbd -p " + poolPath + " create -s " + sizes + " " + names); + protected Answer createImageRbd(String poolUuid, String skey, String authUserName, String host, String names, long sizes, String poolPath) { + createRBDSecretKeyFileIfNoExist(poolUuid, DEFAULT_LOCAL_STORAGE_PATH, skey); + String cmdout = Script.runSimpleBashScript("rbd -p " + poolPath + " --id " + authUserName + " -m " + host + " -K " + DEFAULT_LOCAL_STORAGE_PATH + poolUuid + " create -s " + (sizes * 1024) + " " + names); if (cmdout == null) { logger.debug(cmdout); }else{ @@ -188,9 +191,9 @@ protected Answer createImageRbd(String names, long sizes, String poolPath) { return new ListRbdObjectsAnswer(true, names); } - protected Answer deleteImageRbd(String name, String poolPath) { - - String cmdout = Script.runSimpleBashScript("rbd -p " + poolPath + " rm " + name); + protected Answer deleteImageRbd(String poolUuid, String skey, String authUserName, String host, String name, String poolPath) { + createRBDSecretKeyFileIfNoExist(poolUuid, DEFAULT_LOCAL_STORAGE_PATH, skey); + String cmdout = Script.runSimpleBashScript("rbd -p " + poolPath + " --id " + authUserName + " -m " + host + " -K " + DEFAULT_LOCAL_STORAGE_PATH + poolUuid + " rm " + name); if (cmdout == null) { logger.debug(cmdout); }else{ @@ -198,7 +201,7 @@ protected Answer deleteImageRbd(String name, String poolPath) { return new ListRbdObjectsAnswer(true, name); } - protected Answer listRbdFilesAtPath(int startIndex, int pageSize, String poolPath, String keyword) { + protected Answer listRbdFilesAtPath(String poolUuid, String skey, String authUserName, String host, int startIndex, int pageSize, String poolPath, String keyword) { int count = 0; List names = new ArrayList<>(); List paths = new ArrayList<>(); @@ -207,13 +210,15 @@ protected Answer listRbdFilesAtPath(int startIndex, int pageSize, String poolPat List sizes = new ArrayList<>(); List modifiedList = new ArrayList<>(); + createRBDSecretKeyFileIfNoExist(poolUuid, DEFAULT_LOCAL_STORAGE_PATH, skey); + Script listCommand = new Script("/bin/bash", logger); listCommand.add("-c"); if (keyword != null && !keyword.isEmpty()) { - listCommand.add("rbd -p " + poolPath + " ls | grep " + keyword ); + listCommand.add("rbd ls -p " + poolPath + " --id " + authUserName + " -m " + host + " -K " + DEFAULT_LOCAL_STORAGE_PATH + poolUuid + " | grep " + keyword ); } else { - listCommand.add("rbd -p " + poolPath + " ls"); + listCommand.add("rbd ls -p " + poolPath + " --id " + authUserName + " -m " + host + " -K " + DEFAULT_LOCAL_STORAGE_PATH + poolUuid); } OutputInterpreter.AllLinesParser listParser = new OutputInterpreter.AllLinesParser(); String listResult = listCommand.execute(listParser); @@ -231,6 +236,9 @@ protected Answer listRbdFilesAtPath(int startIndex, int pageSize, String poolPat Script infoCommand = new Script("rbd"); infoCommand.add("-p", poolPath); + infoCommand.add("--id", authUserName); + infoCommand.add("-m", host); + infoCommand.add("-K", DEFAULT_LOCAL_STORAGE_PATH + poolUuid); infoCommand.add("info", imageName.trim()); OutputInterpreter.AllLinesParser infoParser = new OutputInterpreter.AllLinesParser(); String infoResult = infoCommand.execute(infoParser); @@ -265,49 +273,65 @@ protected Answer listRbdFilesAtPath(int startIndex, int pageSize, String poolPat return new ListDataStoreObjectsAnswer(true, count, names, paths, absPaths, isDirs, sizes, modifiedList); } + public void createRBDSecretKeyFileIfNoExist(String uuid, String localPath, String skey) { + File file = new File(localPath + File.separator + uuid); + try { + // 파일이 존재하지 않을 때만 생성 + if (!file.exists()) { + boolean isCreated = file.createNewFile(); + if (isCreated) { + // 파일 생성 후 내용 작성 + FileWriter writer = new FileWriter(file); + writer.write(skey); + writer.close(); + } + } + } catch (IOException e) {} + } -protected Answer listFilesAtPath(String nfsMountPoint, String relativePath, int startIndex, int pageSize, String keyword) { - int count = 0; - File file = new File(nfsMountPoint, relativePath); - List names = new ArrayList<>(); - List paths = new ArrayList<>(); - List absPaths = new ArrayList<>(); - List isDirs = new ArrayList<>(); - List sizes = new ArrayList<>(); - List modifiedList = new ArrayList<>(); - if (file.isFile()) { - count = 1; - names.add(file.getName()); - paths.add(file.getPath().replace(nfsMountPoint, "")); - absPaths.add(file.getPath()); - isDirs.add(file.isDirectory()); - sizes.add(file.length()); - modifiedList.add(file.lastModified()); - } else if (file.isDirectory()) { - String[] files = file.list(); - List filteredFiles = new ArrayList<>(); - if (keyword != null && !"".equals(keyword)) { - for (String fileName : files) { - if (fileName.contains(keyword)) { - filteredFiles.add(fileName); + protected Answer listFilesAtPath(String nfsMountPoint, String relativePath, int startIndex, int pageSize, String keyword) { + int count = 0; + File file = new File(nfsMountPoint, relativePath); + List names = new ArrayList<>(); + List paths = new ArrayList<>(); + List absPaths = new ArrayList<>(); + List isDirs = new ArrayList<>(); + List sizes = new ArrayList<>(); + List modifiedList = new ArrayList<>(); + if (file.isFile()) { + count = 1; + names.add(file.getName()); + paths.add(file.getPath().replace(nfsMountPoint, "")); + absPaths.add(file.getPath()); + isDirs.add(file.isDirectory()); + sizes.add(file.length()); + modifiedList.add(file.lastModified()); + } else if (file.isDirectory()) { + String[] files = file.list(); + List filteredFiles = new ArrayList<>(); + if (keyword != null && !"".equals(keyword)) { + for (String fileName : files) { + if (fileName.contains(keyword)) { + filteredFiles.add(fileName); + } } + } else { + filteredFiles.addAll(Arrays.asList(files)); + } + count = filteredFiles.size(); + for (int i = startIndex; i < startIndex + pageSize && i < count; i++) { + File f = new File(nfsMountPoint, relativePath + '/' + filteredFiles.get(i)); + names.add(f.getName()); + paths.add(f.getPath().replace(nfsMountPoint, "")); + absPaths.add(f.getPath()); + isDirs.add(f.isDirectory()); + sizes.add(f.length()); + modifiedList.add(f.lastModified()); } - } else { - filteredFiles.addAll(Arrays.asList(files)); - } - count = filteredFiles.size(); - for (int i = startIndex; i < startIndex + pageSize && i < count; i++) { - File f = new File(nfsMountPoint, relativePath + '/' + filteredFiles.get(i)); - names.add(f.getName()); - paths.add(f.getPath().replace(nfsMountPoint, "")); - absPaths.add(f.getPath()); - isDirs.add(f.isDirectory()); - sizes.add(f.length()); - modifiedList.add(f.lastModified()); } + return new ListDataStoreObjectsAnswer(file.exists(), count, names, paths, absPaths, isDirs, sizes, modifiedList); } - return new ListDataStoreObjectsAnswer(file.exists(), count, names, paths, absPaths, isDirs, sizes, modifiedList); -} + protected Answer listFilesAtPath(String nfsMountPoint, String relativePath, int startIndex, int pageSize) { int count = 0; File file = new File(nfsMountPoint, relativePath); @@ -340,6 +364,7 @@ protected Answer listFilesAtPath(String nfsMountPoint, String relativePath, int } return new ListDataStoreObjectsAnswer(file.exists(), count, names, paths, absPaths, isDirs, sizes, modifiedList); } + protected void fillNetworkInformation(final StartupCommand cmd) { String[] info = null; if (privateNic != null) { diff --git a/core/src/main/java/org/apache/cloudstack/storage/command/browser/CreateRbdObjectsCommand.java b/core/src/main/java/org/apache/cloudstack/storage/command/browser/CreateRbdObjectsCommand.java index e87a5313a893..4797bda9efd1 100644 --- a/core/src/main/java/org/apache/cloudstack/storage/command/browser/CreateRbdObjectsCommand.java +++ b/core/src/main/java/org/apache/cloudstack/storage/command/browser/CreateRbdObjectsCommand.java @@ -20,23 +20,27 @@ package org.apache.cloudstack.storage.command.browser; import com.cloud.agent.api.storage.StorageCommand; +import com.cloud.agent.api.to.DataStoreTO; public class CreateRbdObjectsCommand extends StorageCommand { - private String names; + private DataStoreTO store; - private long sizes; + private String names; - private String poolType; + private long sizes; - private String poolPath; + private String poolType; - private String keyword; + private String poolPath; - private Long poolId; + private String keyword; - public CreateRbdObjectsCommand(String names, long sizes) { + private Long poolId; + + public CreateRbdObjectsCommand(DataStoreTO store, String names, long sizes) { super(); + this.store = store; this.names = names; this.sizes = sizes; } @@ -46,6 +50,10 @@ public boolean executeInSequence() { return false; } + public DataStoreTO getStore() { + return store; + } + public String getNames() { return names; } diff --git a/core/src/main/java/org/apache/cloudstack/storage/command/browser/DeleteRbdObjectsCommand.java b/core/src/main/java/org/apache/cloudstack/storage/command/browser/DeleteRbdObjectsCommand.java index 2b536ac7a71e..aa97b4d8f5e3 100644 --- a/core/src/main/java/org/apache/cloudstack/storage/command/browser/DeleteRbdObjectsCommand.java +++ b/core/src/main/java/org/apache/cloudstack/storage/command/browser/DeleteRbdObjectsCommand.java @@ -20,17 +20,21 @@ package org.apache.cloudstack.storage.command.browser; import com.cloud.agent.api.storage.StorageCommand; +import com.cloud.agent.api.to.DataStoreTO; public class DeleteRbdObjectsCommand extends StorageCommand { - private String name; + private DataStoreTO store; - private String poolType; + private String name; - private String poolPath; + private String poolType; - public DeleteRbdObjectsCommand(String name) { + private String poolPath; + + public DeleteRbdObjectsCommand(DataStoreTO store, String name) { super(); + this.store = store; this.name = name; } @@ -39,6 +43,10 @@ public boolean executeInSequence() { return false; } + public DataStoreTO getStore() { + return store; + } + public String getName() { return name; } diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 8d6025978a69..eb5f381b5eda 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.FileNotFoundException; +import java.io.FileWriter; import java.io.IOException; import java.io.StringReader; import java.net.InetAddress; @@ -3768,7 +3769,7 @@ private void createVif(final LibvirtVMDef vm, final VirtualMachineTO vmSpec, fin enableOVSDriver = true; } - if (!nic.isSecurityGroupEnabled() && !enableOVSDriver) { + if (!nic.isSecurityGroupEnabled() && !enableOVSDriver && nic.getNwfilter()) { interfaceDef.setFilterrefFilterTag(); } if (vmSpec.getDetails() != null) { @@ -5514,7 +5515,8 @@ public Answer listHostDevices(ListHostDeviceCommand command) { public Answer listFilesAtPath(ListDataStoreObjectsCommand command) { DataStoreTO store = command.getStore(); if(command.getPoolType().equals("RBD")) { - return listRbdFilesAtPath(command.getStartIndex(), command.getPageSize(), command.getPoolPath(), command.getKeyword()); + KVMStoragePool storagePool = storagePoolManager.getStoragePool(StoragePoolType.RBD, store.getUuid()); + return listRbdFilesAtPath(storagePool.getUuid(), storagePool.getAuthSecret(), storagePool.getAuthUserName(), storagePool.getSourceHost(), command.getStartIndex(), command.getPageSize(), command.getPoolPath(), command.getKeyword()); } else { KVMStoragePool storagePool = storagePoolManager.getStoragePool(StoragePoolType.NetworkFilesystem, store.getUuid()); return listFilesAtPath(storagePool.getLocalPath(), command.getPath(), command.getStartIndex(), command.getPageSize(),command.getKeyword()); @@ -5522,15 +5524,19 @@ public Answer listFilesAtPath(ListDataStoreObjectsCommand command) { } public Answer createImageRbd(CreateRbdObjectsCommand command) { + DataStoreTO store = command.getStore(); if(command.getPoolType().equals("RBD")) { - return createImageRbd(command.getNames(), command.getSizes(), command.getPoolPath()); + KVMStoragePool storagePool = storagePoolManager.getStoragePool(StoragePoolType.RBD, store.getUuid()); + return createImageRbd(storagePool.getUuid(), storagePool.getAuthSecret(), storagePool.getAuthUserName(), storagePool.getSourceHost(), command.getNames(), command.getSizes(), command.getPoolPath()); } return null; } public Answer deleteImageRbd(DeleteRbdObjectsCommand command) { + DataStoreTO store = command.getStore(); if(command.getPoolType().equals("RBD")) { - return deleteImageRbd(command.getName(), command.getPoolPath()); + KVMStoragePool storagePool = storagePoolManager.getStoragePool(StoragePoolType.RBD, store.getUuid()); + return deleteImageRbd(storagePool.getUuid(), storagePool.getAuthSecret(), storagePool.getAuthUserName(), storagePool.getSourceHost(),command.getName(), command.getPoolPath()); } return null; } @@ -5754,8 +5760,9 @@ public String mapRbdDevice(final KVMPhysicalDisk disk, boolean kvdoEnable){ final String[] splitPoolImage = disk.getPath().split("/"); String device = Script.runSimpleBashScript("rbd showmapped | grep \""+splitPoolImage[0]+"[ ]*"+splitPoolImage[1]+"\" | grep -o \"[^ ]*[ ]*$\""); if(device == null) { + createRBDSecretKeyFileIfNoExist(pool.getUuid(), DEFAULT_LOCAL_STORAGE_PATH, pool.getAuthSecret()); //If not mapped, map and return mapped device - Script.runSimpleBashScript("rbd map " + disk.getPath() + " --id " + pool.getAuthUserName()); + Script.runSimpleBashScript("rbd map " + disk.getPath() + " -m " + pool.getSourceHost() + " --id " + pool.getAuthUserName() +" -K " + DEFAULT_LOCAL_STORAGE_PATH + pool.getUuid()); device = Script.runSimpleBashScript("rbd showmapped | grep \""+splitPoolImage[0]+"[ ]*"+splitPoolImage[1]+"\" | grep -o \"[^ ]*[ ]*$\""); } if(kvdoEnable){ @@ -5767,7 +5774,6 @@ public String mapRbdDevice(final KVMPhysicalDisk disk, boolean kvdoEnable){ logger.info("createKvdoCmdLine Action Error : "+e); } } - return device; } @@ -5788,7 +5794,9 @@ public String unmapRbdDevice(final KVMPhysicalDisk disk, boolean kvdoEnable){ logger.info("unmapRbdDevice Action error : "+e); } } - Script.runSimpleBashScript("rbd unmap " + disk.getPath() + " --id " + pool.getAuthUserName()); + createRBDSecretKeyFileIfNoExist(pool.getUuid(), DEFAULT_LOCAL_STORAGE_PATH, pool.getAuthSecret()); + + Script.runSimpleBashScript("rbd unmap " + disk.getPath() + " -m " + pool.getSourceHost() + " --id " + pool.getAuthUserName() +" -K " + DEFAULT_LOCAL_STORAGE_PATH + pool.getUuid()); device = Script.runSimpleBashScript("rbd showmapped | grep \""+splitPoolImage[0]+"[ ]*"+splitPoolImage[1]+"\" | grep -o \"[^ ]*[ ]*$\""); } return device; @@ -6251,4 +6259,20 @@ public static String convertDiskPathToUuid(String diskPath) { } return uuid; } + + public void createRBDSecretKeyFileIfNoExist(String uuid, String localPath, String skey) { + File file = new File(localPath + File.separator + uuid); + try { + // 파일이 존재하지 않을 때만 생성 + if (!file.exists()) { + boolean isCreated = file.createNewFile(); + if (isCreated) { + // 파일 생성 후 내용 작성 + FileWriter writer = new FileWriter(file); + writer.write(skey); + writer.close(); + } + } + } catch (IOException e) {} + } } diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtResizeVolumeCommandWrapper.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtResizeVolumeCommandWrapper.java index ef979141cda7..4f82da5605ad 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtResizeVolumeCommandWrapper.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtResizeVolumeCommandWrapper.java @@ -159,6 +159,7 @@ public Answer execute(final ResizeVolumeCommand command, final LibvirtComputingR resizecmd.add("-r", String.valueOf(shrinkOk)); resizecmd.add("-v", vmInstanceName); resizecmd.add("-k", String.valueOf(kvdoEnable)); + libvirtComputingResource.createRBDSecretKeyFileIfNoExist(pool.getUuid(), "/var/lib/libvirt/images/", pool.getAuthSecret()); final String result = resizecmd.execute(); if (result != null) { diff --git a/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java index 9985fb6627fe..4fb5dbc36f72 100644 --- a/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java +++ b/server/src/main/java/com/cloud/hypervisor/HypervisorGuruBase.java @@ -37,6 +37,7 @@ import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; +import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; import org.apache.cloudstack.vm.UnmanagedInstanceTO; import org.apache.commons.collections.CollectionUtils; @@ -120,6 +121,8 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis private UserVmManager userVmManager; @Inject private ConfigurationManager configurationManager; + @Inject + ConfigurationDao configDao; public static ConfigKey VmMinMemoryEqualsMemoryDividedByMemOverprovisioningFactor = new ConfigKey("Advanced", Boolean.class, "vm.min.memory.equals.memory.divided.by.mem.overprovisioning.factor", "true", "If we set this to 'true', a minimum memory (memory/ mem.overprovisioning.factor) will be set to the VM, independent of using a scalable service offering or not.", true, ConfigKey.Scope.Cluster); @@ -172,6 +175,7 @@ public NicTO toNicTO(NicProfile profile) { to.setIp6Dns2(profile.getIPv6Dns2()); to.setNetworkId(profile.getNetworkId()); to.setLinkState(profile.getLinkState()); + to.setNwfilter(Boolean.parseBoolean(configDao.getValueAndInitIfNotExist("enable.vm.network.filter.allow.all.traffic", "Advanced", "false"))); NetworkVO network = networkDao.findById(profile.getNetworkId()); to.setNetworkUuid(network.getUuid()); diff --git a/server/src/main/java/com/cloud/vm/UserVmManager.java b/server/src/main/java/com/cloud/vm/UserVmManager.java index 7cb585d3761b..fb59ca616680 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManager.java +++ b/server/src/main/java/com/cloud/vm/UserVmManager.java @@ -82,6 +82,8 @@ public interface UserVmManager extends UserVmService { "true", "If set to true, tags specified in `resource.limit.host.tags` are also included in vm.strict.host.tags.", true); + ConfigKey EnableVmNetwokFilterAllowAllTraffic = new ConfigKey("Advanced", Boolean.class, "enable.vm.network.filter.allow.all.traffic", "false", + "If true, the network security feature is enabled when creating a virtual machine, tag: item is enabled.", true); static final int MAX_USER_DATA_LENGTH_BYTES = 2048; diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java index 7890eb2953ce..6f11df914da8 100644 --- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java @@ -16,7 +16,6 @@ // under the License. package com.cloud.vm; -import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality; import static com.cloud.storage.Volume.IOPS_LIMIT; import static com.cloud.utils.NumbersUtil.toHumanReadableSize; import static org.apache.cloudstack.api.ApiConstants.MAX_IOPS; @@ -255,6 +254,7 @@ import com.cloud.host.Status; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality; import com.cloud.hypervisor.HypervisorGuru; import com.cloud.hypervisor.HypervisorGuruManager; import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao; @@ -8962,7 +8962,7 @@ public ConfigKey[] getConfigKeys() { return new ConfigKey[] {EnableDynamicallyScaleVm, AllowDiskOfferingChangeDuringScaleVm, AllowUserExpungeRecoverVm, VmIpFetchWaitInterval, VmIpFetchTrialMax, VmIpFetchThreadPoolMax, VmIpFetchTaskWorkers, AllowDeployVmIfGivenHostFails, EnableAdditionalVmConfig, DisplayVMOVFProperties, KvmAdditionalConfigAllowList, XenServerAdditionalConfigAllowList, VmwareAdditionalConfigAllowList, DestroyRootVolumeOnVmDestruction, - EnforceStrictResourceLimitHostTagCheck, StrictHostTags, AllowUserForceStopVm}; + EnforceStrictResourceLimitHostTagCheck, StrictHostTags, AllowUserForceStopVm, EnableVmNetwokFilterAllowAllTraffic}; } @Override diff --git a/server/src/main/java/org/apache/cloudstack/storage/browser/StorageBrowserImpl.java b/server/src/main/java/org/apache/cloudstack/storage/browser/StorageBrowserImpl.java index be00a2386868..1d6ac7ab104b 100644 --- a/server/src/main/java/org/apache/cloudstack/storage/browser/StorageBrowserImpl.java +++ b/server/src/main/java/org/apache/cloudstack/storage/browser/StorageBrowserImpl.java @@ -306,7 +306,7 @@ ListRbdObjectsAnswer deleteRbdObjectsInStore(DataStore dataStore, String name) { if (ep == null) { throw new CloudRuntimeException("No remote endpoint to send command"); } - DeleteRbdObjectsCommand deleteRICmd = new DeleteRbdObjectsCommand(name); + DeleteRbdObjectsCommand deleteRICmd = new DeleteRbdObjectsCommand(dataStore.getTO(), name); deleteRICmd.setWait(15); if (dataStore.getRole() == DataStoreRole.Primary) { @@ -338,7 +338,7 @@ ListRbdObjectsAnswer createRbdObjectsInStore(DataStore dataStore, long sizes, St if (ep == null) { throw new CloudRuntimeException("No remote endpoint to send command"); } - CreateRbdObjectsCommand createRICmd = new CreateRbdObjectsCommand(names, sizes); + CreateRbdObjectsCommand createRICmd = new CreateRbdObjectsCommand(dataStore.getTO(), names, sizes); createRICmd.setWait(15); if (dataStore.getRole() == DataStoreRole.Primary) { diff --git a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java index a6a0ae855beb..4cd4e8caa305 100644 --- a/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java +++ b/services/secondary-storage/server/src/main/java/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java @@ -68,8 +68,6 @@ import org.apache.cloudstack.storage.command.UploadStatusAnswer; import org.apache.cloudstack.storage.command.UploadStatusAnswer.UploadStatus; import org.apache.cloudstack.storage.command.UploadStatusCommand; -import org.apache.cloudstack.storage.command.browser.CreateRbdObjectsCommand; -import org.apache.cloudstack.storage.command.browser.DeleteRbdObjectsCommand; import org.apache.cloudstack.storage.command.browser.ListDataStoreObjectsCommand; import org.apache.cloudstack.storage.configdrive.ConfigDrive; import org.apache.cloudstack.storage.configdrive.ConfigDriveBuilder; @@ -332,10 +330,6 @@ public Answer executeRequest(Command cmd) { return execute((MoveVolumeCommand)cmd); } else if (cmd instanceof ListDataStoreObjectsCommand) { return execute((ListDataStoreObjectsCommand)cmd); - } else if (cmd instanceof CreateRbdObjectsCommand) { - return execute((CreateRbdObjectsCommand)cmd); - } else if (cmd instanceof DeleteRbdObjectsCommand) { - return execute((DeleteRbdObjectsCommand)cmd); } else if (cmd instanceof QuerySnapshotZoneCopyCommand) { return execute((QuerySnapshotZoneCopyCommand)cmd); } else { @@ -347,13 +341,6 @@ private Answer execute(ListDataStoreObjectsCommand cmd) { return listFilesAtPath(getRootDir(cmd.getStore().getUrl(), _nfsVersion), cmd.getPath(), cmd.getStartIndex(), cmd.getPageSize()); } - private Answer execute(CreateRbdObjectsCommand cmd) { - return createImageRbd(cmd.getNames(), cmd.getSizes(), cmd.getPoolPath()); - } - - private Answer execute(DeleteRbdObjectsCommand cmd) { - return deleteImageRbd(cmd.getName(), cmd.getPoolPath()); - } private Answer execute(HandleConfigDriveIsoCommand cmd) { if (cmd.isCreate()) { if (cmd.getIsoData() == null) {