mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	Merge remote-tracking branch 'apache/4.20'
This commit is contained in:
		
						commit
						6089c161a6
					
				@ -302,6 +302,8 @@ public interface StorageManager extends StorageService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    Answer sendToPool(StoragePool pool, long[] hostIdsToTryFirst, Command cmd) throws StorageUnavailableException;
 | 
					    Answer sendToPool(StoragePool pool, long[] hostIdsToTryFirst, Command cmd) throws StorageUnavailableException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void updateStoragePoolHostVOAndBytes(StoragePool pool, long hostId, ModifyStoragePoolAnswer mspAnswer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    CapacityVO getSecondaryStorageUsedStats(Long hostId, Long zoneId);
 | 
					    CapacityVO getSecondaryStorageUsedStats(Long hostId, Long zoneId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    CapacityVO getStoragePoolUsedStats(Long poolId, Long clusterId, Long podId, Long zoneId);
 | 
					    CapacityVO getStoragePoolUsedStats(Long poolId, Long clusterId, Long podId, Long zoneId);
 | 
				
			||||||
 | 
				
			|||||||
@ -476,8 +476,8 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl extends BasePrimaryDataStor
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public boolean cancelMaintain(DataStore store) {
 | 
					    public boolean cancelMaintain(DataStore store) {
 | 
				
			||||||
        storagePoolAutmation.cancelMaintain(store);
 | 
					 | 
				
			||||||
        dataStoreHelper.cancelMaintain(store);
 | 
					        dataStoreHelper.cancelMaintain(store);
 | 
				
			||||||
 | 
					        storagePoolAutmation.cancelMaintain(store);
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3072,7 +3072,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void updateStoragePoolHostVOAndBytes(StoragePool pool, long hostId, ModifyStoragePoolAnswer mspAnswer) {
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void updateStoragePoolHostVOAndBytes(StoragePool pool, long hostId, ModifyStoragePoolAnswer mspAnswer) {
 | 
				
			||||||
        StoragePoolHostVO poolHost = _storagePoolHostDao.findByPoolHost(pool.getId(), hostId);
 | 
					        StoragePoolHostVO poolHost = _storagePoolHostDao.findByPoolHost(pool.getId(), hostId);
 | 
				
			||||||
        if (poolHost == null) {
 | 
					        if (poolHost == null) {
 | 
				
			||||||
            poolHost = new StoragePoolHostVO(pool.getId(), hostId, mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/"));
 | 
					            poolHost = new StoragePoolHostVO(pool.getId(), hostId, mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/"));
 | 
				
			||||||
@ -3082,8 +3083,10 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        StoragePoolVO poolVO = _storagePoolDao.findById(pool.getId());
 | 
					        StoragePoolVO poolVO = _storagePoolDao.findById(pool.getId());
 | 
				
			||||||
        poolVO.setUsedBytes(mspAnswer.getPoolInfo().getCapacityBytes() - mspAnswer.getPoolInfo().getAvailableBytes());
 | 
					        if (!Storage.StoragePoolType.StorPool.equals(poolVO.getPoolType())) {
 | 
				
			||||||
        poolVO.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
 | 
					            poolVO.setUsedBytes(mspAnswer.getPoolInfo().getCapacityBytes() - mspAnswer.getPoolInfo().getAvailableBytes());
 | 
				
			||||||
 | 
					            poolVO.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        _storagePoolDao.update(pool.getId(), poolVO);
 | 
					        _storagePoolDao.update(pool.getId(), poolVO);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -363,6 +363,7 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
 | 
				
			|||||||
                if (logger.isDebugEnabled()) {
 | 
					                if (logger.isDebugEnabled()) {
 | 
				
			||||||
                    logger.debug("ModifyStoragePool add succeeded");
 | 
					                    logger.debug("ModifyStoragePool add succeeded");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                storageManager.updateStoragePoolHostVOAndBytes(pool, host.getId(), (ModifyStoragePoolAnswer) answer);
 | 
				
			||||||
                if (pool.getPoolType() == Storage.StoragePoolType.DatastoreCluster) {
 | 
					                if (pool.getPoolType() == Storage.StoragePoolType.DatastoreCluster) {
 | 
				
			||||||
                    logger.debug("Started synchronising datastore cluster storage pool {} with vCenter", pool);
 | 
					                    logger.debug("Started synchronising datastore cluster storage pool {} with vCenter", pool);
 | 
				
			||||||
                    storageManager.syncDatastoreClusterStoragePool(pool.getId(), ((ModifyStoragePoolAnswer) answer).getDatastoreClusterChildren(), host.getId());
 | 
					                    storageManager.syncDatastoreClusterStoragePool(pool.getId(), ((ModifyStoragePoolAnswer) answer).getDatastoreClusterChildren(), host.getId());
 | 
				
			||||||
 | 
				
			|||||||
@ -32,8 +32,8 @@
 | 
				
			|||||||
      "format": "qcow2",
 | 
					      "format": "qcow2",
 | 
				
			||||||
      "headless": true,
 | 
					      "headless": true,
 | 
				
			||||||
      "http_directory": "http",
 | 
					      "http_directory": "http",
 | 
				
			||||||
      "iso_checksum": "sha512:892cf1185a214d16ff62a18c6b89cdcd58719647c99916f6214bfca6f9915275d727b666c0b8fbf022c425ef18647e9759974abf7fc440431c39b50c296a98d3",
 | 
					      "iso_checksum": "sha512:55ab206cd8b0da2898767c3eb6ab5ebef101e3925ec91b3b5f0a286136195b7072588f6ac2d059c545c6938978704ae78cd18d7d9d2a86a7380e46ce27ee4e7b",
 | 
				
			||||||
      "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.11.0/arm64/iso-cd/debian-12.11.0-arm64-netinst.iso",
 | 
					      "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.12.0/arm64/iso-cd/debian-12.12.0-arm64-netinst.iso",
 | 
				
			||||||
      "net_device": "virtio-net",
 | 
					      "net_device": "virtio-net",
 | 
				
			||||||
      "output_directory": "../dist",
 | 
					      "output_directory": "../dist",
 | 
				
			||||||
      "qemu_binary": "qemu-system-aarch64",
 | 
					      "qemu_binary": "qemu-system-aarch64",
 | 
				
			||||||
 | 
				
			|||||||
@ -31,8 +31,8 @@
 | 
				
			|||||||
      "format": "qcow2",
 | 
					      "format": "qcow2",
 | 
				
			||||||
      "headless": true,
 | 
					      "headless": true,
 | 
				
			||||||
      "http_directory": "http",
 | 
					      "http_directory": "http",
 | 
				
			||||||
      "iso_checksum": "sha512:892cf1185a214d16ff62a18c6b89cdcd58719647c99916f6214bfca6f9915275d727b666c0b8fbf022c425ef18647e9759974abf7fc440431c39b50c296a98d3",
 | 
					      "iso_checksum": "sha512:55ab206cd8b0da2898767c3eb6ab5ebef101e3925ec91b3b5f0a286136195b7072588f6ac2d059c545c6938978704ae78cd18d7d9d2a86a7380e46ce27ee4e7b",
 | 
				
			||||||
      "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.11.0/arm64/iso-cd/debian-12.11.0-arm64-netinst.iso",
 | 
					      "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.12.0/arm64/iso-cd/debian-12.12.0-arm64-netinst.iso",
 | 
				
			||||||
      "net_device": "virtio-net",
 | 
					      "net_device": "virtio-net",
 | 
				
			||||||
      "output_directory": "../dist",
 | 
					      "output_directory": "../dist",
 | 
				
			||||||
      "qemu_binary": "qemu-system-aarch64",
 | 
					      "qemu_binary": "qemu-system-aarch64",
 | 
				
			||||||
 | 
				
			|||||||
@ -27,8 +27,8 @@
 | 
				
			|||||||
      "format": "qcow2",
 | 
					      "format": "qcow2",
 | 
				
			||||||
      "headless": true,
 | 
					      "headless": true,
 | 
				
			||||||
      "http_directory": "http",
 | 
					      "http_directory": "http",
 | 
				
			||||||
      "iso_checksum": "sha512:0921d8b297c63ac458d8a06f87cd4c353f751eb5fe30fd0d839ca09c0833d1d9934b02ee14bbd0c0ec4f8917dde793957801ae1af3c8122cdf28dde8f3c3e0da",
 | 
					      "iso_checksum": "sha512:c93055182057dd19a334260671c7e10880541b7721ad9c8df87be47e0a11d5bbf85018350ff224ff6a5f6a68320b07e95d539cef9dc020c93966bfaa86d4b2ce",
 | 
				
			||||||
      "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.11.0/amd64/iso-cd/debian-12.11.0-amd64-netinst.iso",
 | 
					      "iso_url": "https://cdimage.debian.org/mirror/cdimage/archive/12.12.0/amd64/iso-cd/debian-12.12.0-amd64-netinst.iso",
 | 
				
			||||||
      "net_device": "virtio-net",
 | 
					      "net_device": "virtio-net",
 | 
				
			||||||
      "output_directory": "../dist",
 | 
					      "output_directory": "../dist",
 | 
				
			||||||
      "qemuargs": [
 | 
					      "qemuargs": [
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								ui/public/config.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								ui/public/config.json
									
									
									
									
										vendored
									
									
								
							@ -104,6 +104,7 @@
 | 
				
			|||||||
  "showUserCategoryForModernImageSelection": true,
 | 
					  "showUserCategoryForModernImageSelection": true,
 | 
				
			||||||
  "showAllCategoryForModernImageSelection": false,
 | 
					  "showAllCategoryForModernImageSelection": false,
 | 
				
			||||||
  "docHelpMappings": {},
 | 
					  "docHelpMappings": {},
 | 
				
			||||||
 | 
					  "notifyLatestCSVersion": true,
 | 
				
			||||||
  "announcementBanner": {
 | 
					  "announcementBanner": {
 | 
				
			||||||
    "enabled": false,
 | 
					    "enabled": false,
 | 
				
			||||||
    "showIcon": false,
 | 
					    "showIcon": false,
 | 
				
			||||||
 | 
				
			|||||||
@ -338,7 +338,6 @@ const user = {
 | 
				
			|||||||
            const result = response.listusersresponse.user[0]
 | 
					            const result = response.listusersresponse.user[0]
 | 
				
			||||||
            commit('SET_INFO', result)
 | 
					            commit('SET_INFO', result)
 | 
				
			||||||
            commit('SET_NAME', result.firstname + ' ' + result.lastname)
 | 
					            commit('SET_NAME', result.firstname + ' ' + result.lastname)
 | 
				
			||||||
            store.dispatch('SetCsLatestVersion', result.rolename)
 | 
					 | 
				
			||||||
            resolve(cachedApis)
 | 
					            resolve(cachedApis)
 | 
				
			||||||
          }).catch(error => {
 | 
					          }).catch(error => {
 | 
				
			||||||
            reject(error)
 | 
					            reject(error)
 | 
				
			||||||
@ -588,6 +587,9 @@ const user = {
 | 
				
			|||||||
      commit('SET_DOMAIN_STORE', domainStore)
 | 
					      commit('SET_DOMAIN_STORE', domainStore)
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    SetCsLatestVersion ({ commit }, rolename) {
 | 
					    SetCsLatestVersion ({ commit }, rolename) {
 | 
				
			||||||
 | 
					      if (!vueProps.$config.notifyLatestCSVersion) {
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      const lastFetchTs = store.getters.latestVersion?.fetchedTs ? store.getters.latestVersion.fetchedTs : 0
 | 
					      const lastFetchTs = store.getters.latestVersion?.fetchedTs ? store.getters.latestVersion.fetchedTs : 0
 | 
				
			||||||
      if (rolename === 'Root Admin' && (+new Date() - lastFetchTs) > 24 * 60 * 60 * 1000) {
 | 
					      if (rolename === 'Root Admin' && (+new Date() - lastFetchTs) > 24 * 60 * 60 * 1000) {
 | 
				
			||||||
        axios.get(
 | 
					        axios.get(
 | 
				
			||||||
 | 
				
			|||||||
@ -396,7 +396,7 @@ export default {
 | 
				
			|||||||
          placeHolder: 'message.error.server',
 | 
					          placeHolder: 'message.error.server',
 | 
				
			||||||
          required: true,
 | 
					          required: true,
 | 
				
			||||||
          display: {
 | 
					          display: {
 | 
				
			||||||
            primaryStorageProtocol: ['nfs', 'iscsi', 'gluster', 'SMB', 'Linstor']
 | 
					            primaryStorageProtocol: ['nfs', 'iscsi', 'gluster', 'SMB', 'Linstor', 'datastorecluster', 'vmfs']
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
				
			|||||||
@ -1569,10 +1569,10 @@ export default {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        path += '/' + this.prefillContent.primaryStorageVmfsDatastore
 | 
					        path += '/' + this.prefillContent.primaryStorageVmfsDatastore
 | 
				
			||||||
        if (protocol === 'vmfs') {
 | 
					        if (protocol === 'vmfs') {
 | 
				
			||||||
          url = this.vmfsURL('dummy', path)
 | 
					          url = this.vmfsURL(server, path)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (protocol === 'datastorecluster') {
 | 
					        if (protocol === 'datastorecluster') {
 | 
				
			||||||
          url = this.datastoreclusterURL('dummy', path)
 | 
					          url = this.datastoreclusterURL(server, path)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      } else if (protocol === 'iscsi') {
 | 
					      } else if (protocol === 'iscsi') {
 | 
				
			||||||
        let iqn = this.prefillContent?.primaryStorageTargetIQN || ''
 | 
					        let iqn = this.prefillContent?.primaryStorageTargetIQN || ''
 | 
				
			||||||
 | 
				
			|||||||
@ -414,7 +414,7 @@ export default {
 | 
				
			|||||||
          for (const index in net.traffics) {
 | 
					          for (const index in net.traffics) {
 | 
				
			||||||
            if (this.hypervisor === 'VMware') {
 | 
					            if (this.hypervisor === 'VMware') {
 | 
				
			||||||
              delete this.physicalNetworks[idx].traffics[index].label
 | 
					              delete this.physicalNetworks[idx].traffics[index].label
 | 
				
			||||||
            } else {
 | 
					            } else if (!net.traffics[index].label) {
 | 
				
			||||||
              this.physicalNetworks[idx].traffics[index].label = ''
 | 
					              this.physicalNetworks[idx].traffics[index].label = ''
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            const traffic = net.traffics[index]
 | 
					            const traffic = net.traffics[index]
 | 
				
			||||||
 | 
				
			|||||||
@ -28,6 +28,7 @@ import java.net.URI;
 | 
				
			|||||||
import java.net.URISyntaxException;
 | 
					import java.net.URISyntaxException;
 | 
				
			||||||
import java.net.URL;
 | 
					import java.net.URL;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.Arrays;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Properties;
 | 
					import java.util.Properties;
 | 
				
			||||||
import java.util.concurrent.Callable;
 | 
					import java.util.concurrent.Callable;
 | 
				
			||||||
@ -157,13 +158,7 @@ public class Script implements Callable<String> {
 | 
				
			|||||||
        boolean obscureParam = false;
 | 
					        boolean obscureParam = false;
 | 
				
			||||||
        for (int i = 0; i < command.length; i++) {
 | 
					        for (int i = 0; i < command.length; i++) {
 | 
				
			||||||
            String cmd = command[i];
 | 
					            String cmd = command[i];
 | 
				
			||||||
            if (StringUtils.isNotEmpty(cmd) && cmd.startsWith("vi://")) {
 | 
					            if (sanitizeViCmdParameter(cmd, builder) || sanitizeRbdFileFormatCmdParameter(cmd, builder)) {
 | 
				
			||||||
                String[] tokens = cmd.split("@");
 | 
					 | 
				
			||||||
                if (tokens.length >= 2) {
 | 
					 | 
				
			||||||
                    builder.append("vi://").append("******@").append(tokens[1]).append(" ");
 | 
					 | 
				
			||||||
                } else {
 | 
					 | 
				
			||||||
                    builder.append("vi://").append("******").append(" ");
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (obscureParam) {
 | 
					            if (obscureParam) {
 | 
				
			||||||
@ -181,6 +176,41 @@ public class Script implements Callable<String> {
 | 
				
			|||||||
        return builder.toString();
 | 
					        return builder.toString();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private boolean sanitizeViCmdParameter(String cmd, StringBuilder builder) {
 | 
				
			||||||
 | 
					        if (StringUtils.isEmpty(cmd) || !cmd.startsWith("vi://")) {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        String[] tokens = cmd.split("@");
 | 
				
			||||||
 | 
					        if (tokens.length >= 2) {
 | 
				
			||||||
 | 
					            builder.append("vi://").append("******@").append(tokens[1]).append(" ");
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            builder.append("vi://").append("******").append(" ");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private boolean sanitizeRbdFileFormatCmdParameter(String cmd, StringBuilder builder) {
 | 
				
			||||||
 | 
					        if (StringUtils.isEmpty(cmd) || !cmd.startsWith("rbd:") || !cmd.contains("key=")) {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        String[] tokens = cmd.split("key=");
 | 
				
			||||||
 | 
					        if (tokens.length != 2) {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        String tokenWithKey = tokens[1];
 | 
				
			||||||
 | 
					        String[] options = tokenWithKey.split(":");
 | 
				
			||||||
 | 
					        if (options.length > 1) {
 | 
				
			||||||
 | 
					            String optionsAfterKey = String.join(":", Arrays.copyOfRange(options, 1, options.length));
 | 
				
			||||||
 | 
					            builder.append(tokens[0]).append("key=").append("******").append(":").append(optionsAfterKey).append(" ");
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            builder.append(tokens[0]).append("key=").append("******").append(" ");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public long getTimeout() {
 | 
					    public long getTimeout() {
 | 
				
			||||||
        return _timeout;
 | 
					        return _timeout;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user