cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject git commit: updated refs/heads/4.1 to ba90fa9
Date Wed, 14 Aug 2013 13:07:14 GMT
Updated Branches:
  refs/heads/4.1 a761d5ae9 -> ba90fa91d


CLOUDSTACK-2729: minor change on deleteVol in LibvirtStorageAdaptor.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ba90fa91
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ba90fa91
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ba90fa91

Branch: refs/heads/4.1
Commit: ba90fa91d3da56d4b63a0850d58add34cc5a7a2c
Parents: a761d5a
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Wed Aug 14 15:06:58 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Wed Aug 14 15:06:58 2013 +0200

----------------------------------------------------------------------
 .../kvm/storage/LibvirtStorageAdaptor.java          | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ba90fa91/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index 2fc7a1f..7d6e820 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -670,7 +670,8 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
         LibvirtStoragePool libvirtPool = (LibvirtStoragePool) pool;
         try {
             StorageVol vol = this.getVolume(libvirtPool.getPool(), uuid);
-            deleteVol(libvirtPool, vol);
+            StoragePool virtPool = libvirtPool.getPool();
+            deleteVol(virtPool, vol);
             vol.free();
             return true;
         } catch (LibvirtException e) {
@@ -861,9 +862,10 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
         try {
             conn = LibvirtConnection.getConnection();
             StorageVol vol = conn.storageVolLookupByPath(diskPath);
+            StoragePool pool = vol.storagePoolLookupByVolume();
             if(vol != null) {
                 s_logger.debug("requested delete disk " + diskPath);
-                vol.delete(0);
+                deleteVol(pool, vol);
             }
         } catch (LibvirtException e) {
             s_logger.debug("Libvirt error in attempting to find and delete patch disk:" +
e.toString());
@@ -898,13 +900,15 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
         }
     }
 
-    private void deleteVol(LibvirtStoragePool pool, StorageVol vol) throws LibvirtException
{
-        if ((! pool.getType().equals(StoragePoolType.NetworkFilesystem))
-                && (! pool.getType().equals(StoragePoolType.Filesystem))) {
+    private void deleteVol(StoragePool pool, StorageVol vol) throws LibvirtException {
+        Connect conn = LibvirtConnection.getConnection();
+        LibvirtStoragePoolDef spd = getStoragePoolDef(conn, pool);
+        if ((! spd.getPoolType().equals(LibvirtStoragePoolDef.poolType.NETFS))
+                && (! spd.getPoolType().equals(LibvirtStoragePoolDef.poolType.DIR)))
{
             vol.delete(0);
             return;
         }
-        String lockFile = pool.getLocalPath() + File.separator + _lockfile;
+        String lockFile = spd.getTargetPath() + File.separator + _lockfile;
         s_logger.debug("Attempting to lock pool " + pool.getName() + " with file " + lockFile);
         if (lock(lockFile, ACQUIRE_GLOBAL_FILELOCK_TIMEOUT_FOR_KVM)) {
             try {


Mime
View raw message