cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [35/50] [abbrv] git commit: updated refs/heads/master to 97f8c52
Date Thu, 20 Jun 2013 07:20:08 GMT
CLOUDSTACK-2973: fix detach iso


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

Branch: refs/heads/master
Commit: c4267b546f2bde8c0b32f13eea984896625ed269
Parents: 34f6538
Author: Edison Su <sudison@gmail.com>
Authored: Fri Jun 14 18:15:20 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Fri Jun 14 18:15:20 2013 -0700

----------------------------------------------------------------------
 .../kvm/storage/KVMStorageProcessor.java        | 29 ++++++++++++++++----
 1 file changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c4267b54/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
index 62208a5..8dce094 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
@@ -560,6 +560,29 @@ public class KVMStorageProcessor implements StorageProcessor {
         return new Answer(cmd);
     }
 
+    @Override
+    public Answer dettachIso(DettachCommand cmd) {
+        DiskTO disk = cmd.getDisk();
+        TemplateObjectTO isoTO = (TemplateObjectTO) disk.getData();
+        DataStoreTO store = isoTO.getDataStore();
+        if (!(store instanceof NfsTO)) {
+            return new AttachAnswer("unsupported protocol");
+        }
+        NfsTO nfsStore = (NfsTO) store;
+        try {
+            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
+            attachOrDetachISO(conn, cmd.getVmName(), nfsStore.getUrl() + File.separator +
isoTO.getPath(), false);
+        } catch (LibvirtException e) {
+            return new Answer(cmd, false, e.toString());
+        } catch (URISyntaxException e) {
+            return new Answer(cmd, false, e.toString());
+        } catch (InternalErrorException e) {
+            return new Answer(cmd, false, e.toString());
+        }
+
+        return new Answer(cmd);
+    }
+
     protected synchronized String attachOrDetachDevice(Connect conn, boolean attach, String
vmName, String xml)
             throws LibvirtException, InternalErrorException {
         Domain dm = null;
@@ -659,12 +682,6 @@ public class KVMStorageProcessor implements StorageProcessor {
     }
 
     @Override
-    public Answer dettachIso(DettachCommand cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
     public Answer dettachVolume(DettachCommand cmd) {
         DiskTO disk = cmd.getDisk();
         VolumeObjectTO vol = (VolumeObjectTO) disk.getData();


Mime
View raw message