cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [34/50] [abbrv] git commit: updated refs/heads/master to 97f8c52
Date Thu, 20 Jun 2013 07:20:07 GMT
CLOUDSTACK-2970: wait is in seconds in command


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

Branch: refs/heads/master
Commit: 34f65384548b9960020660614df0b15d7379b682
Parents: 619ec12
Author: Edison Su <sudison@gmail.com>
Authored: Fri Jun 14 17:57:34 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Fri Jun 14 17:57:34 2013 -0700

----------------------------------------------------------------------
 .../kvm/resource/LibvirtConnection.java         | 23 +++++++++-----------
 .../kvm/storage/KVMStorageProcessor.java        |  5 ++---
 scripts/storage/qcow2/createtmplt.sh            |  4 ++--
 3 files changed, 14 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/34f65384/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
index 2fc5425..ea8429e 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java
@@ -16,19 +16,18 @@
 // under the License.
 package com.cloud.hypervisor.kvm.resource;
 
-import com.cloud.hypervisor.Hypervisor;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.log4j.Logger;
 import org.libvirt.Connect;
 import org.libvirt.LibvirtException;
 
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
+import com.cloud.hypervisor.Hypervisor;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
 
 public class LibvirtConnection {
-    private static final Logger s_logger = Logger
-            .getLogger(LibvirtConnection.class);
+    private static final Logger s_logger = Logger.getLogger(LibvirtConnection.class);
     static private Map<String, Connect> _connections = new HashMap<String, Connect>();
 
     static private Connect _connection;
@@ -48,8 +47,7 @@ public class LibvirtConnection {
             try {
                 conn.getVersion();
             } catch (LibvirtException e) {
-                s_logger.debug("Connection with libvirtd is broken, due to "
-                        + e.getMessage());
+                s_logger.debug("Connection with libvirtd is broken, due to " + e.getMessage());
                 conn = new Connect(hypervisorURI, false);
                 _connections.put(hypervisorURI, conn);
             }
@@ -59,17 +57,16 @@ public class LibvirtConnection {
     }
 
     static public Connect getConnectionByVmName(String vmName) throws LibvirtException {
-        HypervisorType[] hypervisors = new HypervisorType[] {HypervisorType.KVM, Hypervisor.HypervisorType.LXC};
+        HypervisorType[] hypervisors = new HypervisorType[] { HypervisorType.KVM, Hypervisor.HypervisorType.LXC
};
 
-        
         for (HypervisorType hypervisor : hypervisors) {
             try {
                 Connect conn = LibvirtConnection.getConnectionByType(hypervisor.toString());
-                if (conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName.getBytes())) !=
null) {
+                if (conn.domainLookupByName(vmName) != null) {
                     return conn;
                 }
             } catch (Exception e) {
-               s_logger.debug("can't find connection: " + hypervisor.toString() + ", for
vm: " + vmName + ", continue");
+                s_logger.debug("can't find connection: " + hypervisor.toString() + ", for
vm: " + vmName + ", continue");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/34f65384/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 6e71492..62208a5 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
@@ -329,7 +329,7 @@ public class KVMStorageProcessor implements StorageProcessor {
             String templateName = UUID.randomUUID().toString();
 
             if (primary.getType() != StoragePoolType.RBD) {
-                Script command = new Script(_createTmplPath, wait, s_logger);
+                Script command = new Script(_createTmplPath, wait * 1000, s_logger);
                 command.add("-f", disk.getPath());
                 command.add("-t", tmpltPath);
                 command.add("-n", templateName + ".qcow2");
@@ -407,7 +407,6 @@ public class KVMStorageProcessor implements StorageProcessor {
     public Answer backupSnasphot(CopyCommand cmd) {
         DataTO srcData = cmd.getSrcTO();
         DataTO destData = cmd.getDestTO();
-        int wait = cmd.getWait();
         SnapshotObjectTO snapshot = (SnapshotObjectTO) srcData;
         PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO) snapshot.getDataStore();
         SnapshotObjectTO destSnapshot = (SnapshotObjectTO) destData;
@@ -440,7 +439,7 @@ public class KVMStorageProcessor implements StorageProcessor {
             KVMStoragePool primaryPool = storagePoolMgr.getStoragePool(primaryStore.getPoolType(),
                     primaryStore.getUuid());
             KVMPhysicalDisk snapshotDisk = primaryPool.getPhysicalDisk(volumePath);
-            Script command = new Script(_manageSnapshotPath, _cmdsTimeout, s_logger);
+            Script command = new Script(_manageSnapshotPath, cmd.getWait() * 1000, s_logger);
             command.add("-b", snapshotDisk.getPath());
             command.add("-n", snapshotName);
             command.add("-p", snapshotDestPath);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/34f65384/scripts/storage/qcow2/createtmplt.sh
----------------------------------------------------------------------
diff --git a/scripts/storage/qcow2/createtmplt.sh b/scripts/storage/qcow2/createtmplt.sh
index 152268f..8d6dd0d 100755
--- a/scripts/storage/qcow2/createtmplt.sh
+++ b/scripts/storage/qcow2/createtmplt.sh
@@ -27,10 +27,10 @@ usage() {
 
 #set -x
 qemu_img="cloud-qemu-img"
-which $qemu_img
+which $qemu_img >& /dev/null
 if [ $? -gt 0 ]
 then
-   which qemu-img
+   which qemu-img >& /dev/null
    if [ $? -eq 0 ]
    then
        qemu_img="qemu-img"


Mime
View raw message