incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [25/45] squash changes into one giant patch
Date Thu, 21 Feb 2013 19:15:16 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/00df9727/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 79ccdb3..98044fb 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -44,6 +44,7 @@ import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
 import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
 import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
 import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -116,7 +117,6 @@ import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePool;
 import com.cloud.storage.StoragePoolHostVO;
 import com.cloud.storage.StoragePoolStatus;
-import com.cloud.storage.StoragePoolVO;
 import com.cloud.storage.StorageService;
 import com.cloud.storage.Swift;
 import com.cloud.storage.SwiftVO;
@@ -2223,20 +2223,22 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
 
 		User caller = _accountMgr.getActiveUser(UserContext.current()
 				.getCallerUserId());
-        if (forceDestroyStorage) {
-            // put local storage into mainenance mode, will set all the VMs on
-            // this local storage into stopped state
-			StoragePool storagePool = _storageMgr.findLocalStorageOnHost(host
+
+		if (forceDestroyStorage) {
+			// put local storage into mainenance mode, will set all the VMs on
+			// this local storage into stopped state
+		    StoragePoolVO storagePool = _storageMgr.findLocalStorageOnHost(host
 					.getId());
             if (storagePool != null) {
 				if (storagePool.getStatus() == StoragePoolStatus.Up
 						|| storagePool.getStatus() == StoragePoolStatus.ErrorInMaintenance) {
-                    try {
-						storagePool = _storageSvr
+					try {
+						StoragePool pool = _storageSvr
 								.preparePrimaryStorageForMaintenance(storagePool
 										.getId());
-                        if (storagePool == null) {
-                            s_logger.debug("Failed to set primary storage into maintenance
mode");
+						if (pool == null) {
+							s_logger.debug("Failed to set primary storage into maintenance mode");
+
 							throw new UnableDeleteHostException(
 									"Failed to set primary storage into maintenance mode");
                         }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/00df9727/server/src/com/cloud/server/ManagementServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServer.java b/server/src/com/cloud/server/ManagementServer.java
index 5c34dee..6773725 100755
--- a/server/src/com/cloud/server/ManagementServer.java
+++ b/server/src/com/cloud/server/ManagementServer.java
@@ -19,11 +19,12 @@ package com.cloud.server;
 import java.util.Date;
 import java.util.List;
 
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+
 import com.cloud.event.EventVO;
 import com.cloud.host.HostVO;
 import com.cloud.info.ConsoleProxyInfo;
 import com.cloud.storage.GuestOSVO;
-import com.cloud.storage.StoragePoolVO;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.PluggableService;
 import com.cloud.vm.VirtualMachine;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/00df9727/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index d381206..e80d48c 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -47,12 +47,12 @@ import javax.management.MalformedObjectNameException;
 import javax.management.NotCompliantMBeanException;
 import javax.naming.ConfigurationException;
 
-import com.cloud.storage.dao.*;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.api.ApiConstants;
 
 import com.cloud.event.ActionEventUtils;
 import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
+
 import org.apache.cloudstack.api.command.admin.account.*;
 import org.apache.cloudstack.api.command.admin.autoscale.*;
 import org.apache.cloudstack.api.command.admin.cluster.*;
@@ -108,6 +108,8 @@ import org.apache.cloudstack.api.command.user.vpc.*;
 import org.apache.cloudstack.api.command.user.vpn.*;
 import org.apache.cloudstack.api.command.user.zone.*;
 import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 
@@ -206,15 +208,22 @@ import com.cloud.storage.GuestOSCategoryVO;
 import com.cloud.storage.GuestOSVO;
 import com.cloud.storage.GuestOsCategory;
 import com.cloud.storage.Storage;
+import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.StorageManager;
-import com.cloud.storage.StoragePoolVO;
+import com.cloud.storage.StoragePool;
 import com.cloud.storage.Upload;
 import com.cloud.storage.Upload.Mode;
 import com.cloud.storage.UploadVO;
-import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.Volume;
 import com.cloud.storage.VolumeVO;
+import com.cloud.storage.dao.DiskOfferingDao;
+import com.cloud.storage.dao.GuestOSCategoryDao;
+import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.storage.dao.StoragePoolDao;
+import com.cloud.storage.dao.UploadDao;
+import com.cloud.storage.dao.VMTemplateDao;
+import com.cloud.storage.dao.VolumeDao;
 import com.cloud.storage.s3.S3Manager;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
 import com.cloud.storage.snapshot.SnapshotManager;
@@ -222,6 +231,7 @@ import com.cloud.storage.swift.SwiftManager;
 import com.cloud.storage.upload.UploadMonitor;
 import com.cloud.tags.ResourceTagVO;
 import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.template.TemplateManager;
 import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
@@ -390,6 +400,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
     @Inject
     HighAvailabilityManager _haMgr;
     @Inject
+    TemplateManager templateMgr;
+    @Inject
+    DataStoreManager dataStoreMgr;
+    @Inject
     HostTagsDao _hostTagsDao;
 
     @Inject
@@ -2635,8 +2649,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         }
 
         long accountId = volume.getAccountId();
-        StoragePoolVO srcPool = _poolDao.findById(volume.getPoolId());
-        HostVO sserver = _storageMgr.getSecondaryStorageHost(zoneId);
+        StoragePool srcPool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
+        HostVO sserver = this.templateMgr.getSecondaryStorageHost(zoneId);
         String secondaryStorageURL = sserver.getStorageUrl();
 
         List<UploadVO> extractURLList = _uploadDao.listByTypeUploadStatus(volumeId,
Upload.Type.VOLUME, UploadVO.Status.DOWNLOAD_URL_CREATED);
@@ -2713,7 +2727,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         }
     }
 
-    private String getFormatForPool(StoragePoolVO pool) {
+    private String getFormatForPool(StoragePool pool) {
         ClusterVO cluster = ApiDBUtils.findClusterById(pool.getClusterId());
 
         if (cluster.getHypervisorType() == HypervisorType.XenServer) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/00df9727/server/src/com/cloud/server/StatsCollector.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java
index be83c18..76bae5b 100755
--- a/server/src/com/cloud/server/StatsCollector.java
+++ b/server/src/com/cloud/server/StatsCollector.java
@@ -29,8 +29,8 @@ import java.util.concurrent.TimeUnit;
 
 import javax.inject.Inject;
 
-import com.cloud.resource.ResourceManager;
-
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -49,14 +49,13 @@ import com.cloud.host.HostStats;
 import com.cloud.host.HostVO;
 import com.cloud.host.Status;
 import com.cloud.host.dao.HostDao;
+import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceState;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePoolHostVO;
-import com.cloud.storage.StoragePoolVO;
 import com.cloud.storage.StorageStats;
 import com.cloud.storage.VolumeStats;
 import com.cloud.storage.VolumeVO;
-import com.cloud.storage.dao.StoragePoolDao;
 import com.cloud.storage.dao.StoragePoolHostDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.storage.secondary.SecondaryStorageVmManager;
@@ -84,7 +83,7 @@ public class StatsCollector {
 	@Inject private HostDao _hostDao;
 	@Inject private UserVmDao _userVmDao;
 	@Inject private VolumeDao _volsDao;
-	@Inject private StoragePoolDao _storagePoolDao;
+	@Inject private PrimaryDataStoreDao _storagePoolDao;
 	@Inject private StorageManager _storageManager;
 	@Inject private StoragePoolHostDao _storagePoolHostDao;
 	@Inject private SecondaryStorageVmManager _ssvmMgr;
@@ -301,7 +300,7 @@ public class StatsCollector {
 					GetStorageStatsCommand command = new GetStorageStatsCommand(pool.getUuid(), pool.getPoolType(),
pool.getPath());
 					long poolId = pool.getId();
 					try {
-    					Answer answer = _storageManager.sendToPool(pool, command);
+    					Answer answer = _storageManager.sendToPool(pool.getId(), command);
     					if (answer != null && answer.getResult()) {
     						storagePoolStats.put(pool.getId(), (StorageStats)answer);
     

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/00df9727/server/src/com/cloud/storage/LocalStoragePoolListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/LocalStoragePoolListener.java b/server/src/com/cloud/storage/LocalStoragePoolListener.java
index 8d5875e..a04c79c 100755
--- a/server/src/com/cloud/storage/LocalStoragePoolListener.java
+++ b/server/src/com/cloud/storage/LocalStoragePoolListener.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.storage;
 
-import java.util.List;
-
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
@@ -30,20 +28,14 @@ import com.cloud.agent.api.Command;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupStorageCommand;
 import com.cloud.agent.api.StoragePoolInfo;
-import com.cloud.capacity.Capacity;
-import com.cloud.capacity.CapacityVO;
 import com.cloud.capacity.dao.CapacityDao;
-import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.exception.ConnectionException;
 import com.cloud.host.HostVO;
 import com.cloud.host.Status;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.dao.StoragePoolDao;
 import com.cloud.storage.dao.StoragePoolHostDao;
 import com.cloud.utils.db.DB;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
 
 public class LocalStoragePoolListener implements Listener {
     private final static Logger s_logger = Logger.getLogger(LocalStoragePoolListener.class);
@@ -91,63 +83,7 @@ public class LocalStoragePoolListener implements Listener {
             return;
         }
 
-        DataCenterVO dc = _dcDao.findById(host.getDataCenterId());
-        if (dc == null || !dc.isLocalStorageEnabled()) {
-            return;
-        }
-
-        try {
-            StoragePoolVO pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(),
host.getPodId(), pInfo.getHost(), pInfo.getHostPath(), pInfo.getUuid());
-        	if(pool == null && host.getHypervisorType() == HypervisorType.VMware) {
-        		// perform run-time upgrade. In versions prior to 2.2.12, there is a bug that we
don't save local datastore info (host path is empty), this will cause us
-        		// not able to distinguish multiple local datastores that may be available on the
host, to support smooth migration, we 
-        		// need to perform runtime upgrade here
-        		if(pInfo.getHostPath().length() > 0) {
-        			pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(),
pInfo.getHost(), "", pInfo.getUuid());
-        		}
-        	}
-            
-            if (pool == null) {
-            	
-                long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
-                String name = cmd.getName() == null ? (host.getName() + " Local Storage")
: cmd.getName();
-                Transaction txn = Transaction.currentTxn();
-                txn.start();
-                pool = new StoragePoolVO(poolId, name, pInfo.getUuid(), pInfo.getPoolType(),
host.getDataCenterId(),
-                                         host.getPodId(), pInfo.getAvailableBytes(), pInfo.getCapacityBytes(),
pInfo.getHost(), 0,
-                                         pInfo.getHostPath());
-                pool.setClusterId(host.getClusterId());
-                pool.setStatus(StoragePoolStatus.Up);
-                _storagePoolDao.persist(pool, pInfo.getDetails());
-                StoragePoolHostVO poolHost = new StoragePoolHostVO(pool.getId(), host.getId(),
pInfo.getLocalPath());
-                _storagePoolHostDao.persist(poolHost);
-                _storageMgr.createCapacityEntry(pool, Capacity.CAPACITY_TYPE_LOCAL_STORAGE,
pool.getCapacityBytes() - pool.getAvailableBytes());
-                
-                txn.commit();
-            } else {
-                Transaction txn = Transaction.currentTxn();
-                txn.start();
-                pool.setPath(pInfo.getHostPath());
-                pool.setAvailableBytes(pInfo.getAvailableBytes());
-                pool.setCapacityBytes(pInfo.getCapacityBytes());
-                _storagePoolDao.update(pool.getId(), pool);
-                if (pInfo.getDetails() != null) {
-                    _storagePoolDao.updateDetails(pool.getId(), pInfo.getDetails());
-                }
-                StoragePoolHostVO poolHost = _storagePoolHostDao.findByPoolHost(pool.getId(),
host.getId());
-                if (poolHost == null) {
-                    poolHost = new StoragePoolHostVO(pool.getId(), host.getId(), pInfo.getLocalPath());
-                    _storagePoolHostDao.persist(poolHost);
-                }
-                
-                _storageMgr.createCapacityEntry(pool, Capacity.CAPACITY_TYPE_LOCAL_STORAGE,
pool.getCapacityBytes() - pool.getAvailableBytes());
-                
-                txn.commit();
-            }
-        } catch (Exception e) {
-            s_logger.warn("Unable to setup the local storage pool for " + host, e);
-            throw new ConnectionException(true, "Unable to setup the local storage pool for
" + host, e);
-        }
+        this._storageMgr.createLocalStorage(host, pInfo);
     }
    
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/00df9727/server/src/com/cloud/storage/OCFS2ManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/OCFS2ManagerImpl.java b/server/src/com/cloud/storage/OCFS2ManagerImpl.java
index 6bbeec4..5c526a6 100755
--- a/server/src/com/cloud/storage/OCFS2ManagerImpl.java
+++ b/server/src/com/cloud/storage/OCFS2ManagerImpl.java
@@ -25,6 +25,7 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/00df9727/server/src/com/cloud/storage/RegisterVolumePayload.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/RegisterVolumePayload.java b/server/src/com/cloud/storage/RegisterVolumePayload.java
new file mode 100644
index 0000000..142de18
--- /dev/null
+++ b/server/src/com/cloud/storage/RegisterVolumePayload.java
@@ -0,0 +1,43 @@
+/*
+ * 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 com.cloud.storage;
+
+public class RegisterVolumePayload {
+    private final String url;
+    private final String checksum;
+    private final String format;
+    
+    public RegisterVolumePayload(String url, String checksum, String format) {
+        this.url = url;
+        this.checksum = checksum;
+        this.format = format;
+    }
+    
+    public String getUrl() {
+        return this.url;
+    }
+    
+    public String getChecksum() {
+        return this.checksum;
+    }
+    
+    public String getFormat() {
+        return this.format;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/00df9727/server/src/com/cloud/storage/StorageManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManager.java b/server/src/com/cloud/storage/StorageManager.java
index 97853ac..9213b4b 100755
--- a/server/src/com/cloud/storage/StorageManager.java
+++ b/server/src/com/cloud/storage/StorageManager.java
@@ -17,50 +17,29 @@
 package com.cloud.storage;
 
 import java.util.List;
+import java.util.Set;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
+import com.cloud.agent.api.StoragePoolInfo;
 import com.cloud.agent.manager.Commands;
 import com.cloud.capacity.CapacityVO;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.HostPodVO;
-import com.cloud.deploy.DeployDestination;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientStorageCapacityException;
+import com.cloud.exception.ConnectionException;
 import com.cloud.exception.StorageUnavailableException;
 import com.cloud.host.Host;
-import com.cloud.host.HostVO;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.service.ServiceOfferingVO;
 import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.Volume.Event;
-import com.cloud.storage.Volume.Type;
-import com.cloud.user.Account;
 import com.cloud.utils.Pair;
-import com.cloud.utils.component.Manager;
-import com.cloud.utils.fsm.NoTransitionException;
 import com.cloud.vm.DiskProfile;
 import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachineProfile;
-
-public interface StorageManager extends StorageService, Manager {
-    boolean canVmRestartOnAnotherServer(long vmId);
-
-    /** Returns the absolute path of the specified ISO
-     * @param templateId - the ID of the template that represents the ISO
-     * @param datacenterId
-     * @return absolute ISO path
-     */
-	public Pair<String, String> getAbsoluteIsoPath(long templateId, long dataCenterId);
-
-	/**
-	 * Returns the URL of the secondary storage host
-	 * @param zoneId
-	 * @return URL
-	 */
-	public String getSecondaryStorageURL(long zoneId);
 
+public interface StorageManager extends StorageService {
 	/**
 	 * Returns a comma separated list of tags for the specified storage pool
 	 * @param poolId
@@ -68,67 +47,9 @@ public interface StorageManager extends StorageService, Manager {
 	 */
 	public String getStoragePoolTags(long poolId);
 
-	/**
-	 * Returns the secondary storage host
-	 * @param zoneId
-	 * @return secondary storage host
-	 */
-	public HostVO getSecondaryStorageHost(long zoneId);
-
-	/**
-	 * Returns the secondary storage host
-	 * @param zoneId
-	 * @return secondary storage host
-	 */
-    public VMTemplateHostVO findVmTemplateHost(long templateId, StoragePool pool);
-
-	/**
-	 * Moves a volume from its current storage pool to a storage pool with enough capacity in
the specified zone, pod, or cluster
-	 * @param volume
-	 * @param destPoolDcId
-	 * @param destPoolPodId
-	 * @param destPoolClusterId
-	 * @return VolumeVO
-	 * @throws ConcurrentOperationException
-	 */
-	VolumeVO moveVolume(VolumeVO volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId,
HypervisorType dataDiskHyperType) throws ConcurrentOperationException;
-
-	/**
-	 * Create a volume based on the given criteria
-	 * @param volume
-	 * @param vm
-	 * @param template
-	 * @param dc
-	 * @param pod
-	 * @param clusterId
-	 * @param offering
-	 * @param diskOffering
-	 * @param avoids
-	 * @param size
-	 * @param hyperType
-	 * @return volume VO if success, null otherwise
-	 */
-	VolumeVO createVolume(VolumeVO volume, VMInstanceVO vm, VMTemplateVO template, DataCenterVO
dc, HostPodVO pod, Long clusterId,
-            ServiceOfferingVO offering, DiskOfferingVO diskOffering, List<StoragePoolVO>
avoids, long size, HypervisorType hyperType);
-
-	/**
-	 * Marks the specified volume as destroyed in the management server database. The expunge
thread will delete the volume from its storage pool.
-	 * @param volume
-	 * @return
-	 */
-	boolean destroyVolume(VolumeVO volume) throws ConcurrentOperationException;
+	
 
-	/** Create capacity entries in the op capacity table
-	 * @param storagePool
-	 */
-	public void createCapacityEntry(StoragePoolVO storagePool);
 
-	/**
-	 * Checks that the volume is stored on a shared storage pool
-	 * @param volume
-	 * @return true if the volume is on a shared storage pool, false otherwise
-	 */
-	boolean volumeOnSharedStoragePool(VolumeVO volume);
 
 	Answer sendToPool(long poolId, Command cmd) throws StorageUnavailableException;
 	Answer sendToPool(StoragePool pool, Command cmd) throws StorageUnavailableException;
@@ -138,17 +59,6 @@ public interface StorageManager extends StorageService, Manager {
 	Pair<Long, Answer> sendToPool(StoragePool pool, long[] hostIdsToTryFirst, List<Long>
hostIdsToAvoid, Command cmd) throws StorageUnavailableException;
 
 	/**
-	 * Checks that one of the following is true:
-	 * 1. The volume is not attached to any VM
-	 * 2. The volume is attached to a VM that is running on a host with the KVM hypervisor,
and the VM is stopped
-	 * 3. The volume is attached to a VM that is running on a host with the XenServer hypervisor
(the VM can be stopped or running)
-	 * @return true if one of the above conditions is true
-	 */
-	boolean volumeInactive(VolumeVO volume);
-
-	String getVmNameOnVolume(VolumeVO volume);
-
-	/**
 	 * Checks if a host has running VMs that are using its local storage pool.
 	 * @return true if local storage is active on the host
 	 */
@@ -162,31 +72,10 @@ public interface StorageManager extends StorageService, Manager {
 
     String getPrimaryStorageNameLabel(VolumeVO volume);
 
-    /**
-     * Allocates one volume.
-     * @param <T>
-     * @param type
-     * @param offering
-     * @param name
-     * @param size
-     * @param template
-     * @param vm
-     * @param account
-     * @return VolumeVO a persisted volume.
-     */
-    <T extends VMInstanceVO> DiskProfile allocateRawVolume(Type type, String name,
DiskOfferingVO offering, Long size, T vm, Account owner);
-    <T extends VMInstanceVO> DiskProfile allocateTemplatedVolume(Type type, String
name, DiskOfferingVO offering, VMTemplateVO template, T vm, Account owner);
 
 	void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long allocated);
 
 
-    void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination
dest) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException;
-
-	void release(VirtualMachineProfile<? extends VMInstanceVO> profile);
-
-	void cleanupVolumes(long vmId) throws ConcurrentOperationException;
-
-	void prepareForMigration(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination
dest);
 
 	Answer sendToPool(StoragePool pool, long[] hostIdsToTryFirst, Command cmd) throws StorageUnavailableException;
 
@@ -194,49 +83,41 @@ public interface StorageManager extends StorageService, Manager {
 
 	CapacityVO getStoragePoolUsedStats(Long poolId, Long clusterId, Long podId, Long zoneId);
 
-    boolean createStoragePool(long hostId, StoragePoolVO pool);
+    List<StoragePoolVO> ListByDataCenterHypervisor(long datacenterId, HypervisorType
type);
 
-    boolean delPoolFromHost(long hostId);
 
-    HostVO getSecondaryStorageHost(long zoneId, long tmpltId);
+    List<VMInstanceVO> listByStoragePool(long storagePoolId);
 
-    List<HostVO> getSecondaryStorageHosts(long zoneId);
+    StoragePoolVO findLocalStorageOnHost(long hostId);
 
-    List<StoragePoolVO> ListByDataCenterHypervisor(long datacenterId, HypervisorType
type);
+	Host updateSecondaryStorage(long secStorageId, String newUrl);
 
+	List<Long> getUpHostsInPool(long poolId);
 
-    List<VMInstanceVO> listByStoragePool(long storagePoolId);
+    void cleanupSecondaryStorage(boolean recurring);
 
-    StoragePoolVO findLocalStorageOnHost(long hostId);
 
-    VMTemplateHostVO getTemplateHostRef(long zoneId, long tmpltId, boolean readyOnly);
+	HypervisorType getHypervisorTypeFromFormat(ImageFormat format);
+
+    boolean storagePoolHasEnoughSpace(List<Volume> volume, StoragePool pool);
 
-	boolean StorageMigration(
-			VirtualMachineProfile<? extends VirtualMachine> vm,
-			StoragePool destPool) throws ConcurrentOperationException;
+    
+    boolean registerHostListener(String providerUuid, HypervisorHostListener listener);
 
-	boolean stateTransitTo(Volume vol, Event event)
-			throws NoTransitionException;
+    StoragePool findStoragePool(DiskProfile dskCh, DataCenterVO dc,
+            HostPodVO pod, Long clusterId, Long hostId, VMInstanceVO vm,
+            Set<StoragePool> avoid);
 
-	VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId);
 
-	Host updateSecondaryStorage(long secStorageId, String newUrl);
+    void connectHostToSharedPool(long hostId, long poolId)
+            throws StorageUnavailableException;
 
-	List<Long> getUpHostsInPool(long poolId);
+    void createCapacityEntry(long poolId);
 
-    void cleanupSecondaryStorage(boolean recurring);
 
-	VolumeVO copyVolumeFromSecToPrimary(VolumeVO volume, VMInstanceVO vm,
-			VMTemplateVO template, DataCenterVO dc, HostPodVO pod,
-			Long clusterId, ServiceOfferingVO offering,
-			DiskOfferingVO diskOffering, List<StoragePoolVO> avoids, long size,
-			HypervisorType hyperType) throws NoTransitionException;
 
-	String getSupportedImageFormatForCluster(Long clusterId);
 
-	HypervisorType getHypervisorTypeFromFormat(ImageFormat format);
 
-    boolean storagePoolHasEnoughSpace(List<Volume> volume, StoragePool pool);
+    DataStore createLocalStorage(Host host, StoragePoolInfo poolInfo) throws ConnectionException;
 
-    boolean deleteVolume(long volumeId, Account caller) throws ConcurrentOperationException;
 }


Mime
View raw message