cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sw...@apache.org
Subject [3/8] git commit: updated refs/heads/master to 82b702d
Date Fri, 20 May 2016 12:33:32 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
index 38b45d0..6391611 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
@@ -44,6 +44,8 @@ import org.apache.cloudstack.storage.command.DettachCommand;
 import org.apache.cloudstack.storage.command.ForgetObjectCmd;
 import org.apache.cloudstack.storage.command.IntroduceObjectAnswer;
 import org.apache.cloudstack.storage.command.IntroduceObjectCmd;
+import org.apache.cloudstack.storage.command.ResignatureAnswer;
+import org.apache.cloudstack.storage.command.ResignatureCommand;
 import org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer;
 import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand;
 import org.apache.cloudstack.storage.datastore.protocol.DataStoreProtocol;
@@ -160,6 +162,50 @@ public class XenServerStorageProcessor implements StorageProcessor {
     }
 
     @Override
+    public ResignatureAnswer resignature(final ResignatureCommand cmd) {
+        SR newSr = null;
+
+        final Connection conn = hypervisorResource.getConnection();
+
+        try {
+            final Map<String, String> details = cmd.getDetails();
+
+            final String iScsiName = details.get(DiskTO.IQN);
+            final String storageHost = details.get(DiskTO.STORAGE_HOST);
+            final String chapInitiatorUsername = details.get(DiskTO.CHAP_INITIATOR_USERNAME);
+            final String chapInitiatorSecret = details.get(DiskTO.CHAP_INITIATOR_SECRET);
+
+            newSr = hypervisorResource.getIscsiSR(conn, iScsiName, storageHost, iScsiName,
chapInitiatorUsername, chapInitiatorSecret, true, false);
+
+            Set<VDI> vdis = newSr.getVDIs(conn);
+
+            if (vdis.size() != 1) {
+                throw new RuntimeException("There were " + vdis.size() + " VDIs in the SR.");
+            }
+
+            VDI vdi = vdis.iterator().next();
+
+            final ResignatureAnswer resignatureAnswer = new ResignatureAnswer();
+
+            resignatureAnswer.setSize(vdi.getVirtualSize(conn));
+            resignatureAnswer.setPath(vdi.getUuid(conn));
+            resignatureAnswer.setFormat(ImageFormat.VHD);
+
+            return resignatureAnswer;
+        }
+        catch (final Exception ex) {
+            s_logger.warn("Failed to resignature: " + ex.toString(), ex);
+
+            return new ResignatureAnswer(ex.getMessage());
+        }
+        finally {
+            if (newSr != null) {
+                hypervisorResource.removeSR(conn, newSr);
+            }
+        }
+    }
+
+    @Override
     public AttachAnswer attachIso(final AttachCommand cmd) {
         final DiskTO disk = cmd.getDisk();
         final DataTO data = disk.getData();
@@ -763,6 +809,9 @@ public class XenServerStorageProcessor implements StorageProcessor {
         final DataTO destDataTo = cmd.getDestTO();
         final int wait = cmd.getWait();
         final DataStoreTO srcDataStoreTo = srcDataTo.getDataStore();
+        final Connection conn = hypervisorResource.getConnection();
+        SR sr = null;
+        boolean removeSrAfterCopy = false;
 
         try {
             if (srcDataStoreTo instanceof NfsTO && srcDataTo.getObjectType() == DataObjectType.TEMPLATE)
{
@@ -796,14 +845,11 @@ public class XenServerStorageProcessor implements StorageProcessor {
                             managedStoragePoolRootVolumeSize = details.get(PrimaryDataStoreTO.VOLUME_SIZE);
                             chapInitiatorUsername = details.get(PrimaryDataStoreTO.CHAP_INITIATOR_USERNAME);
                             chapInitiatorSecret = details.get(PrimaryDataStoreTO.CHAP_INITIATOR_SECRET);
+                            removeSrAfterCopy = Boolean.parseBoolean(details.get(PrimaryDataStoreTO.REMOVE_AFTER_COPY));
                         }
                     }
                 }
 
-                final Connection conn = hypervisorResource.getConnection();
-
-                final SR sr;
-
                 if (managed) {
                     final Map<String, String> details = new HashMap<String, String>();
 
@@ -861,9 +907,11 @@ public class XenServerStorageProcessor implements StorageProcessor {
 
                 newVol.setUuid(uuidToReturn);
                 newVol.setPath(uuidToReturn);
+
                 if (physicalSize != null) {
                     newVol.setSize(physicalSize);
                 }
+
                 newVol.setFormat(ImageFormat.VHD);
 
                 return new CopyCmdAnswer(newVol);
@@ -875,6 +923,11 @@ public class XenServerStorageProcessor implements StorageProcessor {
 
             return new CopyCmdAnswer(msg);
         }
+        finally {
+            if (removeSrAfterCopy && sr != null) {
+                hypervisorResource.removeSR(conn, sr);
+            }
+        }
 
         return new CopyCmdAnswer("not implemented yet");
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
index e58bade..02c3197 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
@@ -171,6 +171,8 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
         final DataStoreTO srcStore = srcData.getDataStore();
         final Connection conn = hypervisorResource.getConnection();
         SR srcSr = null;
+        SR destSr = null;
+        boolean removeSrAfterCopy = false;
         Task task = null;
 
         try {
@@ -198,7 +200,8 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
                 final Set<VDI> setVdis = srcSr.getVDIs(conn);
 
                 if (setVdis.size() != 1) {
-                    return new CopyCmdAnswer("Expected 1 VDI template but found " + setVdis.size()
+ " VDI template(s) on: " + uri.getHost() + ":" + uri.getPath() + "/" + volumeDirectory);
+                    return new CopyCmdAnswer("Expected 1 VDI template, but found " + setVdis.size()
+ " VDI templates on: " +
+                            uri.getHost() + ":" + uri.getPath() + "/" + volumeDirectory);
                 }
 
                 final VDI srcVdi = setVdis.iterator().next();
@@ -225,11 +228,10 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
                         managedStoragePoolRootVolumeSize = details.get(PrimaryDataStoreTO.VOLUME_SIZE);
                         chapInitiatorUsername = details.get(PrimaryDataStoreTO.CHAP_INITIATOR_USERNAME);
                         chapInitiatorSecret = details.get(PrimaryDataStoreTO.CHAP_INITIATOR_SECRET);
+                        removeSrAfterCopy = Boolean.parseBoolean(details.get(PrimaryDataStoreTO.REMOVE_AFTER_COPY));
                     }
                 }
 
-                final SR destSr;
-
                 if (managed) {
                     details = new HashMap<String, String>();
 
@@ -291,9 +293,11 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
 
                 newVol.setUuid(uuidToReturn);
                 newVol.setPath(uuidToReturn);
+
                 if (physicalSize != null) {
                     newVol.setSize(physicalSize);
                 }
+
                 newVol.setFormat(Storage.ImageFormat.VHD);
 
                 return new CopyCmdAnswer(newVol);
@@ -316,6 +320,10 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
             if (srcSr != null) {
                 hypervisorResource.removeSR(conn, srcSr);
             }
+
+            if (removeSrAfterCopy && destSr != null) {
+                hypervisorResource.removeSR(conn, destSr);
+            }
         }
 
         return new CopyCmdAnswer("not implemented yet");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixResizeVolumeCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixResizeVolumeCommandWrapper.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixResizeVolumeCommandWrapper.java
index 0206939..b8e0f56 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixResizeVolumeCommandWrapper.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixResizeVolumeCommandWrapper.java
@@ -27,28 +27,80 @@ import com.cloud.agent.api.storage.ResizeVolumeCommand;
 import com.cloud.hypervisor.xenserver.resource.CitrixResourceBase;
 import com.cloud.resource.CommandWrapper;
 import com.cloud.resource.ResourceWrapper;
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.PBD;
+import com.xensource.xenapi.SR;
 import com.xensource.xenapi.VDI;
 
+import java.util.HashSet;
+import java.util.Set;
+
 @ResourceWrapper(handles =  ResizeVolumeCommand.class)
 public final class CitrixResizeVolumeCommandWrapper extends CommandWrapper<ResizeVolumeCommand,
Answer, CitrixResourceBase> {
-
     private static final Logger s_logger = Logger.getLogger(CitrixResizeVolumeCommandWrapper.class);
 
     @Override
     public Answer execute(final ResizeVolumeCommand command, final CitrixResourceBase citrixResourceBase)
{
-        final Connection conn = citrixResourceBase.getConnection();
-        final String volid = command.getPath();
-        final long newSize = command.getNewSize();
+        Connection conn = citrixResourceBase.getConnection();
+
+        String volId = command.getPath();
+        long newSize = command.getNewSize();
 
         try {
-            final VDI vdi = citrixResourceBase.getVDIbyUuid(conn, volid);
+            if (command.isManaged()) {
+                resizeSr(conn, command);
+            }
+
+            VDI vdi = citrixResourceBase.getVDIbyUuid(conn, volId);
+
             vdi.resize(conn, newSize);
+
             return new ResizeVolumeAnswer(command, true, "success", newSize);
-        } catch (final Exception e) {
-            s_logger.warn("Unable to resize volume", e);
-            final String error = "failed to resize volume:" + e;
+        } catch (Exception ex) {
+            s_logger.warn("Unable to resize volume", ex);
+
+            String error = "Failed to resize volume: " + ex;
+
             return new ResizeVolumeAnswer(command, false, error);
         }
     }
-}
\ No newline at end of file
+
+    private void resizeSr(Connection conn, ResizeVolumeCommand command) {
+        // If this is managed storage, re-size the SR, too.
+        // The logical unit/volume has already been re-sized, so the SR needs to fill up
the new space.
+
+        String iScsiName = command.get_iScsiName();
+
+        try {
+            Set<SR> srs = SR.getByNameLabel(conn, iScsiName);
+            Set<PBD> allPbds = new HashSet<>();
+
+            for (SR sr : srs) {
+                if (!CitrixResourceBase.SRType.LVMOISCSI.equals(sr.getType(conn))) {
+                    continue;
+                }
+
+                Set<PBD> pbds = sr.getPBDs(conn);
+
+                if (pbds.size() <= 0) {
+                    s_logger.debug("No PBDs found for the following SR: " + sr.getNameLabel(conn));
+                }
+
+                allPbds.addAll(pbds);
+            }
+
+            for (PBD pbd: allPbds) {
+                PBD.Record pbdr = pbd.getRecord(conn);
+
+                if (pbdr.currentlyAttached) {
+                    pbd.unplug(conn);
+                    pbd.plug(conn);
+                }
+            }
+        }
+        catch (Throwable ex) {
+            throw new CloudRuntimeException("Unable to resize volume: " +  ex.getMessage());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java
index 2411102..073f000 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixStartCommandWrapper.java
@@ -108,11 +108,13 @@ public final class CitrixStartCommandWrapper extends CommandWrapper<StartCommand
                 }
                 index++;
             }
+
             for (DiskTO disk : disks) {
-                final VDI newVdi = citrixResourceBase.prepareManagedDisk(conn, disk, vmName);
+                final VDI newVdi = citrixResourceBase.prepareManagedDisk(conn, disk, vmSpec.getId(),
vmSpec.getName());
 
                 if (newVdi != null) {
                     final String path = newVdi.getUuid(conn);
+
                     iqnToPath.put(disk.getDetails().get(DiskTO.IQN), path);
                 }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
index b7ae4d4..74fbde5 100644
--- a/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/cloudbyte/src/org/apache/cloudstack/storage/datastore/driver/ElastistorPrimaryDataStoreDriver.java
@@ -53,7 +53,6 @@ import com.cloud.storage.ResizeVolumePayload;
 import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePool;
-import com.cloud.storage.Volume;
 import com.cloud.storage.VolumeDetailVO;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.DiskOfferingDao;
@@ -110,7 +109,7 @@ public class ElastistorPrimaryDataStoreDriver extends CloudStackPrimaryDataStore
             String volumeName = volumeInfo.getName();
             Long Iops = volumeInfo.getMaxIops();
             // quota size of the cloudbyte volume will be increased with the given HypervisorSnapshotReserve
-            Long quotaSize = getVolumeSizeIncludingHypervisorSnapshotReserve(volumeInfo,
_storagePoolDao.findById(storagePoolId));
+            Long quotaSize = getDataObjectSizeIncludingHypervisorSnapshotReserve(volumeInfo,
_storagePoolDao.findById(storagePoolId));
 
             StoragePoolVO storagePool = _storagePoolDao.findById(dataStore.getId());
             VolumeVO volume = _volumeDao.findById(volumeInfo.getId());
@@ -337,7 +336,8 @@ public class ElastistorPrimaryDataStoreDriver extends CloudStackPrimaryDataStore
     }
 
     @Override
-    public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
+    public long getDataObjectSizeIncludingHypervisorSnapshotReserve(DataObject dataObject,
StoragePool pool) {
+        VolumeInfo volume = (VolumeInfo)dataObject;
         long volumeSize = volume.getSize();
         Integer hypervisorSnapshotReserve = volume.getHypervisorSnapshotReserve();
 
@@ -353,7 +353,7 @@ public class ElastistorPrimaryDataStoreDriver extends CloudStackPrimaryDataStore
     }
 
     @Override
-    public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
+    public ChapInfo getChapInfo(DataObject dataObject) {
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
index e92e8f6..b5aee54 100644
--- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
@@ -38,6 +38,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.StorageAction;
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
@@ -70,7 +71,6 @@ import com.cloud.storage.ResizeVolumePayload;
 import com.cloud.storage.Storage;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePool;
-import com.cloud.storage.Volume;
 import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.storage.dao.SnapshotDao;
 import com.cloud.storage.dao.VMTemplateDao;
@@ -145,7 +145,7 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
     }
 
     @Override
-    public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
+    public ChapInfo getChapInfo(DataObject dataObject) {
         return null;
     }
 
@@ -169,8 +169,13 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
     }
 
     @Override
-    public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
-        return volume.getSize();
+    public long getDataObjectSizeIncludingHypervisorSnapshotReserve(DataObject dataObject,
StoragePool pool) {
+        return dataObject.getSize();
+    }
+
+    @Override
+    public long getBytesRequiredForTemplate(TemplateInfo templateInfo, StoragePool storagePool)
{
+        return 0;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
b/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
index 7524703..c6ae3ed 100644
--- a/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/nexenta/src/org/apache/cloudstack/storage/datastore/driver/NexentaPrimaryDataStoreDriver.java
@@ -31,6 +31,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.storage.command.CommandResult;
@@ -49,7 +50,6 @@ import com.cloud.agent.api.to.DataTO;
 import com.cloud.host.Host;
 import com.cloud.storage.Storage;
 import com.cloud.storage.StoragePool;
-import com.cloud.storage.Volume;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.user.dao.AccountDao;
@@ -78,8 +78,13 @@ public class NexentaPrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
     }
 
     @Override
-    public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
-        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+    public long getDataObjectSizeIncludingHypervisorSnapshotReserve(DataObject dataObject,
StoragePool pool) {
+        return 0;
+    }
+
+    @Override
+    public long getBytesRequiredForTemplate(TemplateInfo templateInfo, StoragePool storagePool)
{
+        return 0;
     }
 
     @Inject
@@ -97,7 +102,7 @@ public class NexentaPrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
     }
 
     @Override
-    public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
+    public ChapInfo getChapInfo(DataObject dataObject) {
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
b/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
index 0a4cfd6..343b08a 100644
--- a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
@@ -31,7 +31,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcContext;
@@ -44,7 +44,6 @@ import com.cloud.agent.api.to.DataStoreTO;
 import com.cloud.agent.api.to.DataTO;
 import com.cloud.host.Host;
 import com.cloud.storage.StoragePool;
-import com.cloud.storage.Volume;
 import com.cloud.storage.dao.StoragePoolHostDao;
 import com.cloud.utils.exception.CloudRuntimeException;
 
@@ -77,7 +76,7 @@ public class SamplePrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
     }
 
     @Override
-    public ChapInfo getChapInfo(VolumeInfo volumeInfo) {
+    public ChapInfo getChapInfo(DataObject dataObject) {
         return null;
     }
 
@@ -98,16 +97,18 @@ public class SamplePrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver
     }
 
     @Override
-    public long getVolumeSizeIncludingHypervisorSnapshotReserve(Volume volume, StoragePool
pool) {
-        return volume.getSize();
+    public long getDataObjectSizeIncludingHypervisorSnapshotReserve(DataObject dataObject,
StoragePool pool) {
+        return dataObject.getSize();
     }
 
-    private class CreateVolumeContext<T> extends AsyncRpcContext<T> {
-        private final DataObject volume;
+    @Override
+    public long getBytesRequiredForTemplate(TemplateInfo templateInfo, StoragePool storagePool)
{
+        return 0;
+    }
 
+    private class CreateVolumeContext<T> extends AsyncRpcContext<T> {
         public CreateVolumeContext(AsyncCompletionCallback<T> callback, DataObject
volume) {
             super(callback);
-            this.volume = volume;
         }
     }
 


Mime
View raw message