GeezerVison is showing github.com — CLOUDSTACK-10013: Fixes based on code review and test failures · nerdalize/cloudstack@d19629a
File treeExpand file treeCollapse file tree Open diff view settings orchestration/src/com/cloud/vm schema/resources/META-INF/db
plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource hypervisor/kvm/discoverer
services/secondary-storage controller/src/org/apache/cloudstack/secondarystorage server/src/org/apache/cloudstack/storage
appliance/systemvmtemplate
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: LICENSE -59Lines changed: 0 additions & 59 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -271,65 +271,6 @@ Within the scripts/vm/hypervisor/xenserver directory | 271 | 271 | from OpenStack, LLC http://www.openstack.org | 272 | 272 | swift | 273 | 273 |
| 274 | | -Within the tools/appliance/definitions/{devcloud,systemvmtemplate,systemvmtemplate64} directory | 275 | | - licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) | 276 | | - | 277 | | - Copyright (c) 2010-2012 Patrick Debois | 278 | | - | 279 | | - Permission is hereby granted, free of charge, to any person obtaining | 280 | | - a copy of this software and associated documentation files (the | 281 | | - "Software"), to deal in the Software without restriction, including | 282 | | - without limitation the rights to use, copy, modify, merge, publish, | 283 | | - distribute, sublicense, and/or sell copies of the Software, and to | 284 | | - permit persons to whom the Software is furnished to do so, subject to | 285 | | - the following conditions: | 286 | | - | 287 | | - The above copyright notice and this permission notice shall be | 288 | | - included in all copies or substantial portions of the Software. | 289 | | - | 290 | | - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 291 | | - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 292 | | - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 293 | | - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 294 | | - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 295 | | - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 296 | | - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 297 | | - | 298 | | - from Patrick Debois http://www.jedi.be/blog/ | 299 | | - base.sh from https://github.com/jedi4ever/veewee | 300 | | - cleanup.sh from https://github.com/jedi4ever/veewee | 301 | | - definition.rb from https://github.com/jedi4ever/veewee | 302 | | - preseed.cfg from https://github.com/jedi4ever/veewee | 303 | | - zerodisk.sh from https://github.com/jedi4ever/veewee | 304 | | - | 305 | | -Within the tools/devcloud/src/deps/boxes/basebox-build directory | 306 | | - licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) | 307 | | - | 308 | | - Copyright (c) 2010-2012 Patrick Debois | 309 | | - | 310 | | - Permission is hereby granted, free of charge, to any person obtaining | 311 | | - a copy of this software and associated documentation files (the | 312 | | - "Software"), to deal in the Software without restriction, including | 313 | | - without limitation the rights to use, copy, modify, merge, publish, | 314 | | - distribute, sublicense, and/or sell copies of the Software, and to | 315 | | - permit persons to whom the Software is furnished to do so, subject to | 316 | | - the following conditions: | 317 | | - | 318 | | - The above copyright notice and this permission notice shall be | 319 | | - included in all copies or substantial portions of the Software. | 320 | | - | 321 | | - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 322 | | - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 323 | | - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 324 | | - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 325 | | - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 326 | | - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 327 | | - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 328 | | - | 329 | | - from Patrick Debois http://www.jedi.be/blog/ | 330 | | - definition.rb from https://github.com/jedi4ever/veewee | 331 | | - preseed.cfg from https://github.com/jedi4ever/veewee | 332 | | - | 333 | 274 | Within the ui/lib directory | 334 | 275 | placed in the public domain | 335 | 276 | by Eric Meyer http://meyerweb.com/eric/ | |
Collapse file Copy file name to clipboardExpand all lines: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +22-10Lines changed: 22 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -839,6 +839,21 @@ public void advanceStart(final String vmUuid, final Map<VirtualMachineProfile.Pa | 839 | 839 | } | 840 | 840 | } | 841 | 841 |
| | 842 | + private void setupAgentSecurity(final Host vmHost, final Map<String, String> sshAccessDetails, final VirtualMachine vm) throws AgentUnavailableException, OperationTimedoutException { | | 843 | + final String csr = caManager.generateKeyStoreAndCsr(vmHost, sshAccessDetails); | | 844 | + if (!Strings.isNullOrEmpty(csr)) { | | 845 | + final Map<String, String> ipAddressDetails = new HashMap<>(sshAccessDetails); | | 846 | + ipAddressDetails.remove(NetworkElementCommand.ROUTER_NAME); | | 847 | + final Certificate certificate = caManager.issueCertificate(csr, Arrays.asList(vm.getHostName(), vm.getInstanceName()), | | 848 | + new ArrayList<>(ipAddressDetails.values()), CAManager.CertValidityPeriod.value(), null); | | 849 | + final boolean result = caManager.deployCertificate(vmHost, certificate, false, sshAccessDetails); | | 850 | + if (!result) { | | 851 | + s_logger.error("Failed to setup certificate for system vm: " + vm.getInstanceName()); | | 852 | + } | | 853 | + } else { | | 854 | + s_logger.error("Failed to setup keystore and generate CSR for system vm: " + vm.getInstanceName()); | | 855 | + } | | 856 | + } | 842 | 857 |
| 843 | 858 | @Override | 844 | 859 | public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfile.Param, Object> params, final DeploymentPlan planToDeploy, final DeploymentPlanner planner) | @@ -1088,18 +1103,15 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil | 1088 | 1103 | if (vmHost != null && (VirtualMachine.Type.ConsoleProxy.equals(vm.getType()) || | 1089 | 1104 | VirtualMachine.Type.SecondaryStorageVm.equals(vm.getType())) && caManager.canProvisionCertificates()) { | 1090 | 1105 | final Map<String, String> sshAccessDetails = _networkMgr.getSystemVMAccessDetails(vm); | 1091 | | - final String csr = caManager.generateKeyStoreAndCsr(vmHost, sshAccessDetails); | 1092 | | - if (!Strings.isNullOrEmpty(csr)) { | 1093 | | - final Map<String, String> ipAddressDetails = new HashMap<>(sshAccessDetails); | 1094 | | - ipAddressDetails.remove(NetworkElementCommand.ROUTER_NAME); | 1095 | | - final Certificate certificate = caManager.issueCertificate(csr, Arrays.asList(vm.getHostName(), vm.getInstanceName()), new ArrayList<>(ipAddressDetails.values()), CAManager.CertValidityPeriod.value(), null); | 1096 | | - final boolean result = caManager.deployCertificate(vmHost, certificate, false, sshAccessDetails); | 1097 | | - if (!result) { | 1098 | | - s_logger.error("Failed to setup certificate for system vm: " + vm.getInstanceName()); | | 1106 | + for (int retries = 3; retries > 0; retries--) { | | 1107 | + try { | | 1108 | + setupAgentSecurity(vmHost, sshAccessDetails, vm); | | 1109 | + return; | | 1110 | + } catch (final Exception e) { | | 1111 | + s_logger.error("Retrying after catching exception while trying to secure agent for systemvm id=" + vm.getId(), e); | 1099 | 1112 | } | 1100 | | - } else { | 1101 | | - s_logger.error("Failed to setup keystore and generate CSR for system vm: " + vm.getInstanceName()); | 1102 | 1113 | } | | 1114 | + throw new CloudRuntimeException("Failed to setup and secure agent for systemvm id=" + vm.getId()); | 1103 | 1115 | } | 1104 | 1116 | return; | 1105 | 1117 | } else { | |
Collapse file Copy file name to clipboardExpand all lines: engine/schema/resources/META-INF/db/schema-41000to41100.sql -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -493,9 +493,6 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis | 493 | 493 | -- Change monitor patch for apache2 in systemvm | 494 | 494 | UPDATE `cloud`.`monitoring_services` SET pidfile="/var/run/apache2/apache2.pid" WHERE process_name="apache2" AND service_name="apache2"; | 495 | 495 |
| 496 | | --- Boost secondary storage systemvm | 497 | | -UPDATE `cloud`.`service_offering` SET ram_size=1024, cpu=2 WHERE vm_type="secondarystoragevm" and cpu=1 and ram_size=512; | 498 | | - | 499 | 496 | -- Use 'Other Linux 64-bit' as guest os for the default systemvmtemplate for VMware | 500 | 497 | -- This fixes a memory allocation issue to systemvms on VMware/ESXi | 501 | 498 | UPDATE `cloud`.`vm_template` SET guest_os_id=99 WHERE id=8; |
Collapse file Copy file name to clipboardExpand all lines: plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +13-7Lines changed: 13 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 102 | 102 | import com.vmware.vim25.VirtualMachineVideoCard; | 103 | 103 | import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec; | 104 | 104 |
| | 105 | +import org.apache.cloudstack.api.ApiConstants; | 105 | 106 | import org.apache.cloudstack.storage.command.CopyCommand; | 106 | 107 | import org.apache.cloudstack.storage.command.StorageSubSystemCommand; | 107 | 108 | import org.apache.cloudstack.storage.resource.NfsSecondaryStorageResource; | @@ -2178,8 +2179,9 @@ protected StartAnswer execute(StartCommand cmd) { | 2178 | 2179 | hyperHost.setRestartPriorityForVM(vmMo, DasVmPriority.HIGH.value()); | 2179 | 2180 | } | 2180 | 2181 |
| 2181 | | - // For resizing root disk. | 2182 | | - if (rootDiskTO != null && !hasSnapshot) { | | 2182 | + // Resizing root disk only when explicit requested by user | | 2183 | + final Map<String, String> vmDetails = cmd.getVirtualMachine().getDetails(); | | 2184 | + if (rootDiskTO != null && !hasSnapshot && (vmDetails != null && vmDetails.containsKey(ApiConstants.ROOT_DISK_SIZE))) { | 2183 | 2185 | resizeRootDiskOnVMStart(vmMo, rootDiskTO, hyperHost, context); | 2184 | 2186 | } | 2185 | 2187 |
| @@ -2254,20 +2256,24 @@ private void resizeRootDiskOnVMStart(VirtualMachineMO vmMo, DiskTO rootDiskTO, V | 2254 | 2256 | final Pair<VirtualDisk, String> vdisk = getVirtualDiskInfo(vmMo, appendFileType(rootDiskTO.getPath(), ".vmdk")); | 2255 | 2257 | assert(vdisk != null); | 2256 | 2258 |
| 2257 | | - final Long reqSize = ((VolumeObjectTO)rootDiskTO.getData()).getSize() / 1024; | | 2259 | + Long reqSize = 0L; | | 2260 | + final VolumeObjectTO volumeTO = ((VolumeObjectTO)rootDiskTO.getData()); | | 2261 | + if (volumeTO != null) { | | 2262 | + reqSize = volumeTO.getSize() / 1024; | | 2263 | + } | 2258 | 2264 | final VirtualDisk disk = vdisk.first(); | 2259 | 2265 | if (reqSize > disk.getCapacityInKB()) { | 2260 | 2266 | final VirtualMachineDiskInfo diskInfo = getMatchingExistingDisk(vmMo.getDiskInfoBuilder(), rootDiskTO, hyperHost, context); | 2261 | 2267 | assert (diskInfo != null); | 2262 | 2268 | final String[] diskChain = diskInfo.getDiskChain(); | 2263 | 2269 |
| 2264 | 2270 | if (diskChain != null && diskChain.length > 1) { | 2265 | | - s_logger.warn("Disk chain length for the VM is greater than one, skipping resizing of root disk."); | 2266 | | - return; | | 2271 | + s_logger.warn("Disk chain length for the VM is greater than one, this is not supported"); | | 2272 | + throw new CloudRuntimeException("Unsupported VM disk chain length: "+ diskChain.length); | 2267 | 2273 | } | 2268 | 2274 | if (diskInfo.getDiskDeviceBusName() == null || !diskInfo.getDiskDeviceBusName().toLowerCase().startsWith("scsi")) { | 2269 | | - s_logger.warn("Resizing of root disk is only support for scsi device/bus, the provide disk's device bus name is " + diskInfo.getDiskDeviceBusName()); | 2270 | | - return; | | 2275 | + s_logger.warn("Resizing of root disk is only support for scsi device/bus, the provide VM's disk device bus name is " + diskInfo.getDiskDeviceBusName()); | | 2276 | + throw new CloudRuntimeException("Unsupported VM root disk device bus: "+ diskInfo.getDiskDeviceBusName()); | 2271 | 2277 | } | 2272 | 2278 |
| 2273 | 2279 | disk.setCapacityInKB(reqSize); | |
Collapse file Copy file name to clipboardExpand all lines: pom.xml -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 883 | 883 | <exclude>tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf</exclude> | 884 | 884 | <exclude>tools/appliance/*/template.json</exclude> | 885 | 885 | <exclude>tools/cli/cloudmonkey.egg-info/*</exclude> | 886 | | - <exclude>tools/devcloud/src/deps/boxes/basebox-build/definition.rb</exclude> | 887 | | - <exclude>tools/devcloud/src/deps/boxes/basebox-build/preseed.cfg</exclude> | 888 | 886 | <exclude>tools/marvin/Marvin.egg-info/*</exclude> | 889 | 887 | <exclude>ui/css/token-input-facebook.css</exclude> | 890 | 888 | <exclude>ui/l10n/*</exclude> | |
Collapse file Copy file name to clipboardExpand all lines: python/lib/cloudutils/utilities.py +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -217,10 +217,7 @@ class serviceOpsRedhat7(serviceOps): | 217 | 217 | def isServiceRunning(self, servicename): | 218 | 218 | try: | 219 | 219 | o = bash("systemctl is-active " + servicename) | 220 | | - if "inactive" not in o.getStdout(): | 221 | | - return True | 222 | | - else: | 223 | | - return False | | 220 | + return "inactive" not in o.getStdout() | 224 | 221 | except: | 225 | 222 | return False | 226 | 223 |
| |
Collapse file Copy file name to clipboardExpand all lines: scripts/util/keystore-cert-import +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 89 | 89 |
| 90 | 90 | # Restart cloud service if we're in systemvm | 91 | 91 | if [ "$MODE" == "ssh" ] && [ -f $SYSTEM_FILE ]; then | 92 | | - /etc/init.d/cloud stop > /dev/null 2>&1 | 93 | | - sleep 2 | 94 | | - /etc/init.d/cloud start > /dev/null 2>&1 | | 92 | + systemctl restart cloud > /dev/null 2>&1 | 95 | 93 | fi | 96 | 94 |
| 97 | 95 | # Fix file permission | |
Collapse file Copy file name to clipboardExpand all lines: scripts/util/keystore-setup +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 38 | 38 | # Generate keystore | 39 | 39 | rm -f "$KS_FILE" | 40 | 40 | CN=$(hostname --fqdn) | 41 | | -keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyalg RSA -validity "$KS_VALIDITY" -dname cn="$CN",ou="cloudstack",o="cloudstack",c="cloudstack" -keystore "$KS_FILE" | | 41 | +keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyalg RSA -validity "$KS_VALIDITY" -dname cn="$CN",ou="cloudstack",o="cloudstack",c="cloudstack" -keystore "$KS_FILE" > /dev/null 2>&1 | 42 | 42 |
| 43 | 43 | # Generate CSR | 44 | 44 | rm -f "$CSR_FILE" | 45 | | -keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file $CSR_FILE -keystore "$KS_FILE" | | 45 | +keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file $CSR_FILE -keystore "$KS_FILE" > /dev/null 2>&1 | 46 | 46 | cat "$CSR_FILE" | 47 | 47 |
| 48 | 48 | # Fix file permissions | |
Collapse file Copy file name to clipboardExpand all lines: server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java +2-6Lines changed: 2 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 |
| 30 | 30 | import org.apache.cloudstack.ca.CAManager; | 31 | 31 | import org.apache.cloudstack.ca.SetupCertificateCommand; | | 32 | +import org.apache.cloudstack.config.ApiServiceConfiguration; | 32 | 33 | import org.apache.cloudstack.framework.ca.Certificate; | 33 | 34 | import org.apache.cloudstack.utils.security.KeyStoreUtils; | 34 | 35 | import org.apache.log4j.Logger; | | 66 | 67 |
| 67 | 68 | public abstract class LibvirtServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter { | 68 | 69 | private static final Logger s_logger = Logger.getLogger(LibvirtServerDiscoverer.class); | 69 | | - private String _hostIp; | 70 | 70 | private final int _waitTime = 5; /* wait for 5 minutes */ | 71 | 71 | private String _kvmPrivateNic; | 72 | 72 | private String _kvmPublicNic; | @@ -291,7 +291,7 @@ private void setupAgentSecurity(final Connection sshConnection, final String age | 291 | 291 |
| 292 | 292 | setupAgentSecurity(sshConnection, agentIp, hostname); | 293 | 293 |
| 294 | | - String parameters = " -m " + StringUtils.shuffleCSVList(_hostIp) + " -z " + dcId + " -p " + podId + " -c " + clusterId + " -g " + guid + " -a"; | | 294 | + String parameters = " -m " + StringUtils.shuffleCSVList(ApiServiceConfiguration.ManagementHostIPAdr.value()) + " -z " + dcId + " -p " + podId + " -c " + clusterId + " -g " + guid + " -a"; | 295 | 295 |
| 296 | 296 | parameters += " --pubNic=" + kvmPublicNic; | 297 | 297 | parameters += " --prvNic=" + kvmPrivateNic; | @@ -395,10 +395,6 @@ public boolean configure(String name, Map<String, Object> params) throws Configu | 395 | 395 | _kvmGuestNic = _kvmPrivateNic; | 396 | 396 | } | 397 | 397 |
| 398 | | - _hostIp = _configDao.getValue("host"); | 399 | | - if (_hostIp == null) { | 400 | | - throw new ConfigurationException("Can't get host IP"); | 401 | | - } | 402 | 398 | _resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this); | 403 | 399 | return true; | 404 | 400 | } | |
Collapse file Copy file name to clipboardExpand all lines: server/src/com/cloud/network/IpAddressManagerImpl.java +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -824,7 +824,7 @@ public IPAddressVO doInTransaction(TransactionStatus status) throws Insufficient | 824 | 824 | if (userIp.getState() == IpAddress.State.Free) { | 825 | 825 | addr.setState(IpAddress.State.Allocating); | 826 | 826 | if (_ipAddressDao.update(addr.getId(), addr)) { | 827 | | - finalAddr = _ipAddressDao.findById(addr.getId()); | | 827 | + finalAddr = addr; | 828 | 828 | break; | 829 | 829 | } | 830 | 830 | } | |
|