You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/04/05 23:03:33 UTC
[38/50] [abbrv] git commit: updated refs/heads/affinity_groups to
ca1a794
fix bunch of bugs related to zone wide storage
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f18a1d6f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f18a1d6f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f18a1d6f
Branch: refs/heads/affinity_groups
Commit: f18a1d6f140608ba77b54fec9976ed5318495ec4
Parents: bb841d6
Author: Edison Su <su...@gmail.com>
Authored: Wed Apr 3 21:51:17 2013 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Wed Apr 3 21:51:17 2013 -0700
----------------------------------------------------------------------
.../api/response/StoragePoolResponse.java | 17 ++
.../subsystem/api/storage/DataStoreStatus.java | 23 ---
.../ClusterScopeStoragePoolAllocator.java | 1 +
.../GarbageCollectingStoragePoolAllocator.java | 2 +-
.../allocator/LocalStoragePoolAllocator.java | 9 +-
.../allocator/ZoneWideStoragePoolAllocator.java | 1 +
plugins/hypervisors/kvm/pom.xml | 123 ++++++++++-----
.../kvm/resource/LibvirtComputingResource.java | 3 +
.../CloudStackPrimaryDataStoreLifeCycleImpl.java | 2 +
.../api/query/dao/StoragePoolJoinDaoImpl.java | 1 +
.../com/cloud/api/query/vo/StoragePoolJoinVO.java | 19 +++
.../configuration/ConfigurationManagerImpl.java | 2 +-
server/src/com/cloud/deploy/FirstFitPlanner.java | 2 +-
.../src/com/cloud/storage/StorageManagerImpl.java | 27 ++--
.../secondary/SecondaryStorageManagerImpl.java | 3 +-
.../src/com/cloud/upgrade/dao/Upgrade410to420.java | 43 +++++-
setup/db/db/schema-40to410.sql | 1 +
17 files changed, 193 insertions(+), 86 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
index 66dde36..0b16226 100644
--- a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
@@ -79,9 +79,26 @@ public class StoragePoolResponse extends BaseResponse {
@SerializedName(ApiConstants.STATE) @Param(description="the state of the storage pool")
private StoragePoolStatus state;
+
+ @SerializedName(ApiConstants.SCOPE) @Param(description="the scope of the storage pool")
+ private String scope;
+ /**
+ * @return the scope
+ */
+ public String getScope() {
+ return scope;
+ }
+
+ /**
+ * @param scope the scope to set
+ */
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
@Override
public String getObjectId() {
return this.getId();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java
deleted file mode 100644
index 2388795..0000000
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-package org.apache.cloudstack.engine.subsystem.api.storage;
-
-public enum DataStoreStatus {
- Initial, Initialized, Creating, Attaching, Up, PrepareForMaintenance, ErrorInMaintenance, CancelMaintenance, Maintenance, Removed;
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
index 747e258..0dd55d1 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
@@ -51,6 +51,7 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
@Override
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
+ s_logger.debug("ClusterScopeStoragePoolAllocator looking for storage pool");
List<StoragePool> suitablePools = new ArrayList<StoragePool>();
long dcId = plan.getDataCenterId();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
index 91bc25c..02032ee 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/GarbageCollectingStoragePoolAllocator.java
@@ -48,7 +48,7 @@ public class GarbageCollectingStoragePoolAllocator extends AbstractStoragePoolAl
@Override
public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
-
+ s_logger.debug("GarbageCollectingStoragePoolAllocator looking for storage pool");
if (!_storagePoolCleanupEnabled) {
s_logger.debug("Storage pool cleanup is not enabled, so GarbageCollectingStoragePoolAllocator is being skipped.");
return null;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
index a8d5173..7447d98 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
@@ -69,11 +69,12 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
List<StoragePool> suitablePools = new ArrayList<StoragePool>();
-
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("LocalStoragePoolAllocator trying to find storage pool to fit the vm");
- }
+ s_logger.debug("LocalStoragePoolAllocator trying to find storage pool to fit the vm");
+ if (!dskCh.useLocalStorage()) {
+ return suitablePools;
+ }
+
// data disk and host identified from deploying vm (attach volume case)
if (dskCh.getType() == Volume.Type.DATADISK && plan.getHostId() != null) {
List<StoragePoolHostVO> hostPools = _poolHostDao.listByHostId(plan.getHostId());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
index a4aa3d5..7c6c946 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/allocator/ZoneWideStoragePoolAllocator.java
@@ -55,6 +55,7 @@ public class ZoneWideStoragePoolAllocator extends AbstractStoragePoolAllocator {
protected List<StoragePool> select(DiskProfile dskCh,
VirtualMachineProfile<? extends VirtualMachine> vmProfile,
DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
+ s_logger.debug("ZoneWideStoragePoolAllocator to find storage pool");
List<StoragePool> suitablePools = new ArrayList<StoragePool>();
HypervisorType hypervisor = dskCh.getHypersorType();
if (hypervisor != null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/plugins/hypervisors/kvm/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml
index 3a1ba3a..613c817 100644
--- a/plugins/hypervisors/kvm/pom.xml
+++ b/plugins/hypervisors/kvm/pom.xml
@@ -1,22 +1,15 @@
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-plugin-hypervisor-kvm</artifactId>
<name>Apache CloudStack Plugin - Hypervisor KVM</name>
@@ -45,29 +38,29 @@
</dependency>
</dependencies>
<build>
- <defaultGoal>install</defaultGoal>
- <sourceDirectory>src</sourceDirectory>
- <testSourceDirectory>test</testSourceDirectory>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.5.1</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
- <includeScope>runtime</includeScope>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
+ <defaultGoal>install</defaultGoal>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.5.1</version>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
+ <includeScope>runtime</includeScope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
@@ -77,6 +70,52 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <finalName>kvm-agent</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>agent-descriptor.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-agent</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-resources</id>
+ <!-- here the phase you need -->
+ <phase>package</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>dist</outputDirectory>
+ <resources>
+ <resource>
+ <directory>target</directory>
+ <includes>
+ <include>kvm-agent.zip</include>
+ </includes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
</plugins>
</build>
</project>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
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 526107f..362e0a5 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
@@ -666,6 +666,9 @@ ServerResource {
if (_localStoragePath == null) {
_localStoragePath = "/var/lib/libvirt/images/";
}
+
+ File storagePath = new File(_localStoragePath);
+ _localStoragePath = storagePath.getAbsolutePath();
_localStorageUUID = (String) params.get("local.storage.uuid");
if (_localStorageUUID == null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
index b8b0859..51ea212 100644
--- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
+++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
@@ -348,6 +348,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements
new String(storageHost + hostPath).getBytes()).toString();
}
+
List<StoragePoolVO> spHandles = primaryDataStoreDao
.findIfDuplicatePoolsExistByUUID(uuid);
if ((spHandles != null) && (spHandles.size() > 0)) {
@@ -358,6 +359,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements
"Another active pool with the same uuid already exists");
}
+
String poolName = (String) dsInfos.get("name");
parameters.setUuid(uuid);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
index 66aecc2..58968df 100644
--- a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
@@ -82,6 +82,7 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Lo
poolResponse.setPodId(pool.getPodUuid());
poolResponse.setPodName(pool.getPodName());
poolResponse.setCreated(pool.getCreated());
+ poolResponse.setScope(pool.getScope().toString());
long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java b/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java
index 89e79e5..bab3990 100644
--- a/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java
@@ -31,6 +31,7 @@ import com.cloud.utils.db.GenericDao;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
/**
* Storage Pool DB view.
@@ -124,6 +125,24 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
@Column(name="job_status")
private int jobStatus;
+
+ @Column(name = "scope")
+ @Enumerated(value = EnumType.STRING)
+ private ScopeType scope;
+
+ /**
+ * @return the scope
+ */
+ public ScopeType getScope() {
+ return scope;
+ }
+
+ /**
+ * @param scope the scope to set
+ */
+ public void setScope(ScopeType scope) {
+ this.scope = scope;
+ }
@Override
public long getId() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 8dbf081..1526fb0 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -4001,7 +4001,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
DataCenterVO zone = ApiDBUtils.findZoneById(cluster.getDataCenterId());
return zone.getAllocationState();
}
- }
+ }
@Override
public AllocationState findPodAllocationState(HostPodVO pod){
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/server/src/com/cloud/deploy/FirstFitPlanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java
index 0cbf72f..012d160 100755
--- a/server/src/com/cloud/deploy/FirstFitPlanner.java
+++ b/server/src/com/cloud/deploy/FirstFitPlanner.java
@@ -102,7 +102,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
@Inject protected StorageManager _storageMgr;
@Inject DataStoreManager dataStoreMgr;
@Inject protected ClusterDetailsDao _clusterDetailsDao;
-
+
protected List<StoragePoolAllocator> _storagePoolAllocators;
public List<StoragePoolAllocator> getStoragePoolAllocators() {
return _storagePoolAllocators;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index a33d524..4e410e4 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -51,7 +51,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreStatus;
import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
@@ -381,7 +380,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
if (pools == null
|| pools.size() == 0
|| (pools.size() == 1 && pools.get(0).getStatus()
- .equals(DataStoreStatus.Maintenance))) {
+ .equals(StoragePoolStatus.Maintenance))) {
return false;
} else {
return true;
@@ -1000,8 +999,16 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
if (capacities.size() == 0) {
CapacityVO capacity = new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, totalOverProvCapacity, capacityType);
- CapacityState capacityState = _configMgr.findClusterAllocationState(ApiDBUtils.findClusterById(storagePool.getClusterId())) == AllocationState.Disabled ?
+ AllocationState allocationState = null;
+ if (storagePool.getScope() == ScopeType.ZONE) {
+ DataCenterVO dc = ApiDBUtils.findZoneById(storagePool.getDataCenterId());
+ allocationState = dc.getAllocationState();
+ } else {
+ allocationState = _configMgr.findClusterAllocationState(ApiDBUtils.findClusterById(storagePool.getClusterId()));
+ }
+ CapacityState capacityState = (allocationState == AllocationState.Disabled) ?
CapacityState.Disabled : CapacityState.Enabled;
+
capacity.setCapacityState(capacityState);
_capacityDao.persist(capacity);
} else {
@@ -1419,9 +1426,9 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
}
}
- if (!primaryStorage.getStatus().equals(DataStoreStatus.Up)
+ if (!primaryStorage.getStatus().equals(StoragePoolStatus.Up)
&& !primaryStorage.getStatus().equals(
- DataStoreStatus.ErrorInMaintenance)) {
+ StoragePoolStatus.ErrorInMaintenance)) {
throw new InvalidParameterValueException("Primary storage with id "
+ primaryStorageId
+ " is not ready for migration, as the status is:"
@@ -1458,9 +1465,9 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
throw new InvalidParameterValueException(msg);
}
- if (primaryStorage.getStatus().equals(DataStoreStatus.Up)
+ if (primaryStorage.getStatus().equals(StoragePoolStatus.Up)
|| primaryStorage.getStatus().equals(
- DataStoreStatus.PrepareForMaintenance)) {
+ StoragePoolStatus.PrepareForMaintenance)) {
throw new StorageUnavailableException("Primary storage with id "
+ primaryStorageId
+ " is not ready to complete migration, as the status is:"
@@ -1519,11 +1526,11 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
// check if pool is in an inconsistent state
if (pool != null
&& (pool.getStatus().equals(
- DataStoreStatus.ErrorInMaintenance)
+ StoragePoolStatus.ErrorInMaintenance)
|| pool.getStatus()
- .equals(DataStoreStatus.PrepareForMaintenance) || pool
+ .equals(StoragePoolStatus.PrepareForMaintenance) || pool
.getStatus()
- .equals(DataStoreStatus.CancelMaintenance))) {
+ .equals(StoragePoolStatus.CancelMaintenance))) {
_storagePoolWorkDao.removePendingJobsOnMsRestart(
vo.getMsid(), poolId);
pool.setStatus(StoragePoolStatus.ErrorInMaintenance);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
index 9a4d6b0..c94224b 100755
--- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
+++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
@@ -742,7 +742,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
return true;
} else {
if (s_logger.isDebugEnabled()) {
- s_logger.debug("Primary storage is not ready, wait until it is ready to launch secondary storage vm");
+ s_logger.debug("Primary storage is not ready, wait until it is ready to launch secondary storage vm. dcId: " + dataCenterId + " system.vm.use.local.storage: " + _useLocalStorage +
+ "If you want to use local storage to start ssvm, need to set system.vm.use.local.storage to true");
}
}
} else {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/dao/Upgrade410to420.java b/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 8ce118f..434430a 100644
--- a/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -62,7 +62,13 @@ public class Upgrade410to420 implements DbUpgrade {
upgradeVmwareLabels(conn);
createPlaceHolderNics(conn);
updateRemoteAccessVpn(conn);
- PreparedStatement sql = null;
+ updateSystemVmTemplates(conn);
+ updateCluster_details(conn);
+ updatePrimaryStore(conn);
+ }
+
+ private void updateSystemVmTemplates(Connection conn) {
+ PreparedStatement sql = null;
try {
sql = conn.prepareStatement("update vm_template set image_data_store_id = 1 where type = 'SYSTEM' or type = 'BUILTIN'");
sql.executeUpdate();
@@ -76,8 +82,39 @@ public class Upgrade410to420 implements DbUpgrade {
}
}
}
- updateCluster_details(conn);
- }
+ }
+
+ private void updatePrimaryStore(Connection conn) {
+ PreparedStatement sql = null;
+ PreparedStatement sql2 = null;
+ try {
+ sql = conn.prepareStatement("update storage_pool set storage_provider_name = ? , scope = ? where pool_type = 'Filesystem' or pool_type = 'LVM'");
+ sql.setString(1, "ancient primary data store provider");
+ sql.setString(2, "HOST");
+ sql.executeUpdate();
+
+ sql2 = conn.prepareStatement("update storage_pool set storage_provider_name = ? , scope = ? where pool_type != 'Filesystem' and pool_type != 'LVM'");
+ sql2.setString(1, "ancient primary data store provider");
+ sql2.setString(2, "CLUSTER");
+ sql2.executeUpdate();
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Failed to upgrade vm template data store uuid: " + e.toString());
+ } finally {
+ if (sql != null) {
+ try {
+ sql.close();
+ } catch (SQLException e) {
+ }
+ }
+
+ if (sql2 != null) {
+ try {
+ sql2.close();
+ } catch (SQLException e) {
+ }
+ }
+ }
+ }
//update the cluster_details table with default overcommit ratios.
private void updateCluster_details(Connection conn) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f18a1d6f/setup/db/db/schema-40to410.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql
index e333810..77225b9 100644
--- a/setup/db/db/schema-40to410.sql
+++ b/setup/db/db/schema-40to410.sql
@@ -1479,6 +1479,7 @@ CREATE VIEW `cloud`.`storage_pool_view` AS
storage_pool.created,
storage_pool.removed,
storage_pool.capacity_bytes,
+ storage_pool.scope,
cluster.id cluster_id,
cluster.uuid cluster_uuid,
cluster.name cluster_name,