cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/object_store to 383be56
Date Wed, 22 May 2013 02:14:09 GMT
Updated Branches:
  refs/heads/object_store 536feab85 -> 383be568b


CLOUDSTACK-2527: enable attach/detach xs tool iso


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

Branch: refs/heads/object_store
Commit: 383be568b3a6d9b3fb8d38e3f74e19c6c9e08eb2
Parents: 536feab
Author: Edison Su <sudison@gmail.com>
Authored: Tue May 21 19:13:29 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Tue May 21 19:13:29 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/storage/to/TemplateObjectTO.java    |    4 +-
 .../schema/src/com/cloud/storage/VMTemplateVO.java |   10 +++++
 .../storage/image/store/TemplateObject.java        |   26 ++++++++----
 engine/storage/pom.xml                             |    5 --
 .../hypervisor/vmware/VmwareServerDiscoverer.java  |    2 +-
 .../xen/discoverer/XcpServerDiscoverer.java        |    2 +-
 .../xen/resource/XenServerStorageProcessor.java    |   32 ++++++++++-----
 server/pom.xml                                     |    5 --
 .../src/com/cloud/api/query/QueryManagerImpl.java  |    4 +-
 .../src/com/cloud/api/query/vo/TemplateJoinVO.java |   17 +++++++-
 setup/db/db/schema-410to420.sql                    |    1 +
 11 files changed, 73 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java b/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
index 9e7e9ef..3d7a901 100644
--- a/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
+++ b/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
@@ -68,7 +68,9 @@ public class TemplateObjectTO implements DataTO {
         this.accountId = template.getAccountId();
         this.name = template.getUniqueName();
         this.format = template.getFormat();
-        this.imageDataStore = template.getDataStore().getTO();
+        if (template.getDataStore() != null) {
+        	this.imageDataStore = template.getDataStore().getTO();
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/engine/schema/src/com/cloud/storage/VMTemplateVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/VMTemplateVO.java b/engine/schema/src/com/cloud/storage/VMTemplateVO.java
index 06cb1b8..e64c83a 100755
--- a/engine/schema/src/com/cloud/storage/VMTemplateVO.java
+++ b/engine/schema/src/com/cloud/storage/VMTemplateVO.java
@@ -175,6 +175,16 @@ public class VMTemplateVO implements VirtualMachineTemplate, StateObject<Templat
     	this.state = TemplateState.Allocated;
     	this.enableSshKey = sshKeyEnabled;
     }
+    
+    public static VMTemplateVO createPreHostIso(Long id, String uniqueName, String name,
ImageFormat format, boolean isPublic, 
+    		boolean featured, TemplateType type, String url, Date created, boolean requiresHvm,
int bits, long accountId, 
+    		String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable,
HypervisorType hyperType) {
+    	VMTemplateVO template =  new VMTemplateVO( id,  uniqueName,  name,  format,  isPublic,

+        		 featured,  type,  url,  created,  requiresHvm,  bits,  accountId, 
+        		 cksum,  displayText,  enablePassword,  guestOSId,  bootable,  hyperType);
+    	template.state = TemplateState.Ready;
+    	return template;
+    }
 
     public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean
isPublic, boolean featured, TemplateType type, String url, Date created, boolean requiresHvm,
int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId,
boolean bootable, HypervisorType hyperType) {
         this.id = id;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
index 4b995b0..feff54e 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java
@@ -266,19 +266,27 @@ public class TemplateObject implements TemplateInfo {
 
     @Override
     public DataTO getTO() {
-        DataTO to = this.dataStore.getDriver().getTO(this);
-        if (to == null) {
-            to = new TemplateObjectTO(this);
-        }
+    	DataTO to = null;
+    	if (this.dataStore == null) {
+    		to = new TemplateObjectTO(this);
+    	} else {
+    		to = this.dataStore.getDriver().getTO(this);
+    		if (to == null) {
+    			to = new TemplateObjectTO(this);
+    		}
+    	}
 
         return to;
     }
 
-	@Override
-	public String getInstallPath() {
-		 DataObjectInStore obj = objectInStoreMgr.findObject(this, this.dataStore);
-         return obj.getInstallPath();
-	}
+    @Override
+    public String getInstallPath() {
+    	if (this.dataStore == null) {
+    		return null;
+    	}
+    	DataObjectInStore obj = objectInStoreMgr.findObject(this, this.dataStore);
+    	return obj.getInstallPath();
+    }
 
     @Override
     public long getAccountId() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/engine/storage/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/pom.xml b/engine/storage/pom.xml
index a82b3ea..cc56116 100644
--- a/engine/storage/pom.xml
+++ b/engine/storage/pom.xml
@@ -55,11 +55,6 @@
       <artifactId>cloud-engine-api</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-secondary-storage</artifactId>
-      <version>${project.version}</version>
-    </dependency>    
     <dependency>    
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
index 00647d9..1d7300b 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -466,7 +466,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
 		Long id;
 		if (tmplt == null) {
 			id = _tmpltDao.getNextInSequence(Long.class, "id");
-			VMTemplateVO template = new VMTemplateVO(id, isoName, isoName,
+			VMTemplateVO template = VMTemplateVO.createPreHostIso(id, isoName, isoName,
 					ImageFormat.ISO, true, true, TemplateType.PERHOST, null,
 					null, true, 64, Account.ACCOUNT_ID_SYSTEM, null,
 					"VMware Tools Installer ISO", false, 1, false,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
index 536a1f8..5698218 100755
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
@@ -543,7 +543,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer,
L
         Long id;
         if (tmplt == null) {
             id = _tmpltDao.getNextInSequence(Long.class, "id");
-            VMTemplateVO template = new VMTemplateVO(id, isoName, isoName, ImageFormat.ISO,
true, true,
+            VMTemplateVO template =  VMTemplateVO.createPreHostIso(id, isoName, isoName,
ImageFormat.ISO, true, true,
                     TemplateType.PERHOST, null, null, true, 64,
                     Account.ACCOUNT_ID_SYSTEM, null, "xen-pv-drv-iso", false, 1, false, HypervisorType.XenServer);
             _tmpltDao.persist(template);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
index b4bcf20..4a623fc 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
@@ -103,12 +103,18 @@ public class XenServerStorageProcessor implements StorageProcessor {
         DataTO data = disk.getData();
         DataStoreTO store = data.getDataStore();
 
-        if (!(store instanceof NfsTO)) {
-            s_logger.debug("Can't attach a iso which is not created on nfs: ");
-            return new AttachAnswer("Can't attach a iso which is not created on nfs: ");
+        String isoURL = null;
+        if (store == null) {
+        	TemplateObjectTO iso = (TemplateObjectTO)disk.getData();
+        	isoURL = iso.getName();
+        } else {
+        	if (!(store instanceof NfsTO)) {
+        		s_logger.debug("Can't attach a iso which is not created on nfs: ");
+        		return new AttachAnswer("Can't attach a iso which is not created on nfs: ");
+        	}
+        	NfsTO nfsStore = (NfsTO)store;
+        	isoURL = nfsStore.getUrl() + File.separator + data.getPath();
         }
-        NfsTO nfsStore = (NfsTO)store;
-        String isoURL = nfsStore.getUrl() + File.separator + data.getPath();
 
         String vmName = cmd.getVmName();
         try {
@@ -237,12 +243,18 @@ public class XenServerStorageProcessor implements StorageProcessor {
         DataTO data = disk.getData();
         DataStoreTO store = data.getDataStore();
 
-        if (!(store instanceof NfsTO)) {
-            s_logger.debug("Can't attach a iso which is not created on nfs: ");
-            return new DettachAnswer("Can't attach a iso which is not created on nfs: ");
+        String isoURL = null;
+        if (store == null) {
+        	TemplateObjectTO iso = (TemplateObjectTO)disk.getData();
+        	isoURL = iso.getName();
+        } else {
+        	if (!(store instanceof NfsTO)) {
+        		s_logger.debug("Can't attach a iso which is not created on nfs: ");
+        		return new AttachAnswer("Can't attach a iso which is not created on nfs: ");
+        	}
+        	NfsTO nfsStore = (NfsTO)store;
+        	isoURL = nfsStore.getUrl() + File.separator + data.getPath();
         }
-        NfsTO nfsStore = (NfsTO)store;
-        String isoURL = nfsStore.getUrl() + File.separator + data.getPath();
 
         try {
             Connection conn = this.hypervisorResource.getConnection();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index a29f9f1..6385bf2 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -100,11 +100,6 @@
       <artifactId>cloud-framework-events</artifactId>
       <version>${project.version}</version>
     </dependency>
-     <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-framework-ipc</artifactId>
-      <version>${project.version}</version>
-    </dependency>
   </dependencies>
   <build>
     <defaultGoal>install</defaultGoal>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index df61391..adcce40 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -69,6 +69,7 @@ import org.apache.cloudstack.api.command.user.volume.ListResourceDetailsCmd;
 import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
 import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
 import org.apache.cloudstack.api.response.*;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
 import org.apache.cloudstack.query.QueryService;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -2712,8 +2713,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             }
 
             if (onlyReady) {
-                sc.addAnd("downloadState", SearchCriteria.Op.EQ, Status.DOWNLOADED);
-                sc.addAnd("destroyed", SearchCriteria.Op.EQ, false);
+                sc.addAnd("state", SearchCriteria.Op.EQ, TemplateState.Ready);
             }
 
             if (zoneId != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/TemplateJoinVO.java b/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
index d47141d..ef6d1eb 100644
--- a/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/TemplateJoinVO.java
@@ -28,6 +28,7 @@ import javax.persistence.TemporalType;
 
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
 
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.server.ResourceTag.TaggedResourceType;
@@ -239,7 +240,9 @@ public class TemplateJoinVO extends BaseViewVO implements ControlledViewEntity
{
     @Column(name="tag_customer")
     private String tagCustomer;
 
-
+    @Column(name="state")
+    @Enumerated(value=EnumType.STRING)
+    private TemplateState state;
 
     public TemplateJoinVO() {
     }
@@ -1018,4 +1021,16 @@ public class TemplateJoinVO extends BaseViewVO implements ControlledViewEntity
{
 
 
 
+	public TemplateState getState() {
+		return state;
+	}
+
+
+
+	public void setState(TemplateState state) {
+		this.state = state;
+	}
+
+
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/383be568/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 134e44d..aecb938 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1724,6 +1724,7 @@ CREATE VIEW `cloud`.`template_view` AS
         vm_template.display_text,
         vm_template.enable_password,
         vm_template.guest_os_id,
+        vm_template.state,
         guest_os.uuid guest_os_uuid,
         guest_os.display_name guest_os_name,
         vm_template.bootable,


Mime
View raw message