From ba2b0c3974a81141b706d68c99193c172dc1669a Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Mon, 20 Aug 2012 10:39:06 -0700 Subject: [PATCH 1/5] CS-16050: Pass listAll=true to listTags API call, if admin --- ui/scripts/sharedFunctions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 36545cc2722..ebc0ad8df71 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -701,6 +701,10 @@ cloudStack.api = { resourceType: resourceType }; + if (isAdmin() || isDomainAdmin()) { + data.listAll = true; + } + if (args.context.projects) { data.projectid=args.context.projects[0].id; } From 481aae1ebc353db149c7d997ece2ce0ffcbde52f Mon Sep 17 00:00:00 2001 From: Edison Su Date: Mon, 20 Aug 2012 11:19:26 -0700 Subject: [PATCH 2/5] add recreate.systemvm.enabled parameter to control recreating systemvm --- .../network/lb/ElasticLoadBalancerManagerImpl.java | 8 -------- server/src/com/cloud/configuration/Config.java | 1 + .../consoleproxy/AgentBasedConsoleProxyManager.java | 8 -------- .../cloud/consoleproxy/ConsoleProxyManagerImpl.java | 9 --------- .../router/VirtualNetworkApplianceManagerImpl.java | 13 ------------- server/src/com/cloud/storage/StorageManager.java | 2 +- .../src/com/cloud/storage/StorageManagerImpl.java | 9 ++++++++- .../secondary/SecondaryStorageManagerImpl.java | 9 --------- server/src/com/cloud/vm/UserVmManagerImpl.java | 9 --------- server/src/com/cloud/vm/VirtualMachineGuru.java | 3 --- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 10 ++-------- server/test/com/cloud/vm/MockUserVmManagerImpl.java | 8 -------- 12 files changed, 12 insertions(+), 77 deletions(-) diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java index 1c40516ad16..1cd830c9f4e 100644 --- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java +++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java @@ -1025,14 +1025,6 @@ public class ElasticLoadBalancerManagerImpl implements throw new UnsupportedOperationException("Unplug nic is not supported for vm of type " + vm.getType()); } - - @Override - public boolean recreateNeeded( - VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context) { - // TODO Auto-generated method stub - return false; - } - @Override public void prepareStop(VirtualMachineProfile profile) { } diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 6537c9b3510..9fea7fbd5d0 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -230,6 +230,7 @@ public enum Config { SortKeyAlgorithm("Advanced", ManagementServer.class, Boolean.class, "sortkey.algorithm", "false", "Sort algorithm for those who use sort key(template, disk offering, service offering, network offering), true means ascending sort while false means descending sort", null), EnableEC2API("Advanced", ManagementServer.class, Boolean.class, "enable.ec2.api", "false", "enable EC2 API on CloudStack", null), EnableS3API("Advanced", ManagementServer.class, Boolean.class, "enable.s3.api", "false", "enable Amazon S3 API on CloudStack", null), + RecreateSystemVmEnabled("Advanced", ManagementServer.class, Boolean.class, "recreate.systemvm.enabled", "false", "If true, will recreate system vm root disk whenever starting system vm", "true,false"), // Ovm OvmPublicNetwork("Hidden", ManagementServer.class, String.class, "ovm.public.network.device", null, "Specify the public bridge on host for public network", null), diff --git a/server/src/com/cloud/consoleproxy/AgentBasedConsoleProxyManager.java b/server/src/com/cloud/consoleproxy/AgentBasedConsoleProxyManager.java index f833e980d6b..01b4720a54f 100755 --- a/server/src/com/cloud/consoleproxy/AgentBasedConsoleProxyManager.java +++ b/server/src/com/cloud/consoleproxy/AgentBasedConsoleProxyManager.java @@ -368,14 +368,6 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu throw new UnsupportedOperationException("Unplug nic is not supported for vm of type " + vm.getType()); } - @Override - public boolean recreateNeeded( - VirtualMachineProfile profile, long hostId, - Commands cmds, ReservationContext context) { - // TODO Auto-generated method stub - return false; - } - @Override public void prepareStop(VirtualMachineProfile profile) { } diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index 72d48b4c32d..6de14632fc9 100755 --- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -2023,15 +2023,6 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx //not supported throw new UnsupportedOperationException("Unplug nic is not supported for vm of type " + vm.getType()); } - - - @Override - public boolean recreateNeeded( - VirtualMachineProfile profile, long hostId, - Commands cmds, ReservationContext context) { - // TODO Auto-generated method stub - return false; - } @Override public void prepareStop(VirtualMachineProfile profile) { diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 7cd9704e335..082c6302127 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -3386,17 +3386,4 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian } } } - - @Override - public boolean recreateNeeded( - VirtualMachineProfile profile, long hostId, - Commands cmds, ReservationContext context) { - //asssume that if failed to ssh into router, meaning router is crashed - CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh"); - if (answer == null || !answer.getResult()) { - return true; - } - - return false; - } } diff --git a/server/src/com/cloud/storage/StorageManager.java b/server/src/com/cloud/storage/StorageManager.java index 59a02210d86..d535af4bd7e 100755 --- a/server/src/com/cloud/storage/StorageManager.java +++ b/server/src/com/cloud/storage/StorageManager.java @@ -180,7 +180,7 @@ public interface StorageManager extends StorageService, Manager { void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long allocated); - void prepare(VirtualMachineProfile vm, DeployDestination dest, boolean recreate) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException; + void prepare(VirtualMachineProfile vm, DeployDestination dest) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException; void release(VirtualMachineProfile profile); diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 3fe4605ea37..9d4ba0cbbbb 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -358,6 +358,8 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag private double _storageAllocatedThreshold = 1.0d; protected BigDecimal _storageOverprovisioningFactor = new BigDecimal(1); + private boolean _recreateSystemVmEnabled; + public boolean share(VMInstanceVO vm, List vols, HostVO host, boolean cancelPreviousShare) throws StorageUnavailableException { // if pool is in maintenance and it is the ONLY pool available; reject @@ -958,6 +960,9 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag value = configDao.getValue(Config.CopyVolumeWait.toString()); _copyvolumewait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue())); + value = configDao.getValue(Config.RecreateSystemVmEnabled.key()); + _recreateSystemVmEnabled = Boolean.parseBoolean(value); + value = configDao.getValue(Config.StorageTemplateCleanupEnabled.key()); _templateCleanupEnabled = (value == null ? true : Boolean.parseBoolean(value)); @@ -3217,7 +3222,7 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag } @Override - public void prepare(VirtualMachineProfile vm, DeployDestination dest, boolean recreate) throws StorageUnavailableException, InsufficientStorageCapacityException { + public void prepare(VirtualMachineProfile vm, DeployDestination dest) throws StorageUnavailableException, InsufficientStorageCapacityException { if (dest == null) { if (s_logger.isDebugEnabled()) { @@ -3229,6 +3234,8 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag if (s_logger.isDebugEnabled()) { s_logger.debug("Checking if we need to prepare " + vols.size() + " volumes for " + vm); } + + boolean recreate = _recreateSystemVmEnabled; List recreateVols = new ArrayList(vols.size()); diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java index 95eb7f65c5e..86620008159 100755 --- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java +++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java @@ -1469,15 +1469,6 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V throw new UnsupportedOperationException("Unplug nic is not supported for vm of type " + vm.getType()); } - - @Override - public boolean recreateNeeded( - VirtualMachineProfile profile, long hostId, - Commands cmds, ReservationContext context) { - // TODO Auto-generated method stub - return false; - } - @Override public void prepareStop(VirtualMachineProfile profile) { diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 6f6a754021c..b7c1c0efa7f 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -3620,15 +3620,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager return vm; } - - @Override - public boolean recreateNeeded(VirtualMachineProfile profile, - long hostId, Commands cmds, ReservationContext context) { - // TODO Auto-generated method stub - return false; - } - - @Override public UserVm restoreVM(RestoreVMCmd cmd) { // Input validation diff --git a/server/src/com/cloud/vm/VirtualMachineGuru.java b/server/src/com/cloud/vm/VirtualMachineGuru.java index 2b9114d9aa7..b59584d28d6 100644 --- a/server/src/com/cloud/vm/VirtualMachineGuru.java +++ b/server/src/com/cloud/vm/VirtualMachineGuru.java @@ -69,8 +69,6 @@ public interface VirtualMachineGuru { void finalizeExpunge(T vm); - boolean recreateNeeded(VirtualMachineProfile profile, long hostId, Commands cmds, ReservationContext context); - /** * Returns the id parsed from the name. If it cannot parse the name, * then return null. This method is used to determine if this is @@ -82,7 +80,6 @@ public interface VirtualMachineGuru { Long convertToId(String vmName); /** -<<<<<<< HEAD * Prepare for a nic to be plugged into the network. * @param network * @param nic diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 64210150aa2..605ce575c35 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -657,7 +657,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene DataCenterDeployment originalPlan = plan; int retry = _retry; - boolean recreate = false; while (retry-- != 0) { // It's != so that it can match -1. if(reuseVolume){ @@ -752,8 +751,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene } _networkMgr.prepare(vmProfile, dest, ctx); if (vm.getHypervisorType() != HypervisorType.BareMetal) { - _storageMgr.prepare(vmProfile, dest, recreate); - recreate = false; + _storageMgr.prepare(vmProfile, dest); } //since StorageMgr succeeded in volume creation, reuse Volume for further tries until current cluster has capacity if(!reuseVolume){ @@ -813,11 +811,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene _haMgr.scheduleStop(vm, destHostId, WorkType.ForceStop); throw new ExecutionException("Unable to stop " + vm + " so we are unable to retry the start operation"); } - if (vmGuru.recreateNeeded(vmProfile, destHostId, cmds, ctx)) { - recreate = true; - } else { - throw new ExecutionException("Unable to start " + vm + " due to error in finalizeStart, not retrying"); - } + throw new ExecutionException("Unable to start " + vm + " due to error in finalizeStart, not retrying"); } } s_logger.info("Unable to start VM on " + dest.getHost() + " due to " + (startAnswer == null ? " no start answer" : startAnswer.getDetails())); diff --git a/server/test/com/cloud/vm/MockUserVmManagerImpl.java b/server/test/com/cloud/vm/MockUserVmManagerImpl.java index e890262a769..efc6916ab40 100644 --- a/server/test/com/cloud/vm/MockUserVmManagerImpl.java +++ b/server/test/com/cloud/vm/MockUserVmManagerImpl.java @@ -292,14 +292,6 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana return null; } - - @Override - public boolean recreateNeeded(VirtualMachineProfile profile, - long hostId, Commands cmds, ReservationContext context) { - // TODO Auto-generated method stub - return false; - } - @Override public UserVm startVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { // TODO Auto-generated method stub From 5a1c2dad873a4e3e223c3f9e4cb466a07c99a3f3 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Mon, 20 Aug 2012 11:22:41 -0700 Subject: [PATCH 3/5] CS-15734 KVM Snapshots show incorrect disk usage. Changed the code to show virtual size (allocated size). RB: https://reviews.apache.org/r/6699/ Send-by: saksham.srivastava@citrix.com --- .../hypervisor/kvm/resource/LibvirtComputingResource.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 0b18eb1bf60..9e2b62bff23 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -1159,6 +1159,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements long disksize; try { primaryPool = _storagePoolMgr.getStoragePool(pool.getUuid()); + disksize = dskch.getSize(); if (cmd.getTemplateUrl() != null) { @@ -1170,9 +1171,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements return new Answer(cmd, false, " Can't create storage volume on storage pool"); } - disksize = vol.getSize(); } else { - disksize = dskch.getSize(); vol = primaryPool.createPhysicalDisk(UUID.randomUUID() .toString(), dskch.getSize()); } From 991795bcc472e3495b69938b241ecdbc2addf3b9 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Mon, 20 Aug 2012 13:50:29 -0400 Subject: [PATCH 4/5] Correcting the gcc.sh license header from Citrix to ASF --- tools/gcc/gcc.sh | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/gcc/gcc.sh b/tools/gcc/gcc.sh index c654fa65d9a..91fea1ab8b8 100644 --- a/tools/gcc/gcc.sh +++ b/tools/gcc/gcc.sh @@ -1,17 +1,21 @@ #!/usr/bin/env bash -# Copyright 2012 Citrix Systems, Inc. Licensed under the -# Apache License, Version 2.0 (the "License"); you may not use this -# file except in compliance with the License. Citrix Systems, Inc. -# reserves all rights not expressly granted by 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. +# 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 # -# Automatically generated by addcopyright.py at 04/03/2012 -# gcc.sh - compiles javascript into one file +# 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. + usage() { printf "Usage:\n %s [source directory where the java script files are] [destination directory to put the result] \n" $(basename $0) >&2 @@ -33,4 +37,4 @@ for file in `ls -l $1/cloud*.js | egrep -v 'callback|core.js' | awk '{print $NF} jsfiles=`echo $jsfiles "--js " $file` done -java -jar compiler.jar $jsfiles --js_output_file $2/cloud.core.min.js \ No newline at end of file +java -jar compiler.jar $jsfiles --js_output_file $2/cloud.core.min.js From ad2b8d7579a254705812a694e952a0f89e537f41 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Mon, 20 Aug 2012 11:07:06 -0700 Subject: [PATCH 5/5] CS-16044: Zone wizard: Add 'use local storage' checkbox Add checkbox to zone wizard indicating whether zone will use local storage. If checked, bypass add primary storage step and enable local storage for zone on creation. Conflicts: ui/index.jsp --- .../classes/resources/messages.properties | 1 + ui/index.jsp | 1 + ui/scripts/zoneWizard.js | 38 ++++++------------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index cbb8974496b..272be077a11 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -17,6 +17,7 @@ #new labels (begin) ********************************************************************************************** +label.local.storage.enabled=Local storage enabled label.tier.details=Tier details label.edit.tags=Edit tags label.action.enable.physical.network=Enable physical network diff --git a/ui/index.jsp b/ui/index.jsp index 68513b7ad97..2a41ee970cd 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1635,6 +1635,7 @@ under the License.