Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 92C0B10CA0 for ; Tue, 13 Aug 2013 04:09:43 +0000 (UTC) Received: (qmail 68147 invoked by uid 500); 13 Aug 2013 04:09:42 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 68094 invoked by uid 500); 13 Aug 2013 04:09:42 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 67811 invoked by uid 99); 13 Aug 2013 04:09:35 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Aug 2013 04:09:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 11B388BD3EA; Tue, 13 Aug 2013 04:09:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ahuang@apache.org To: commits@cloudstack.apache.org Date: Tue, 13 Aug 2013 04:09:33 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [01/11] git commit: updated refs/heads/master to 5b616ea Updated Branches: refs/heads/master 355747947 -> 5b616eaba Split up the volume manager into two. One part is for self-service. One part belongs in the engine. Removed old 2.1 upgrade code. In order to upgrade from 2.1, you must upgrade to 2.2. first. So therefore these files are no necessary in the newer versions of CloudStack Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0e19e82f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0e19e82f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0e19e82f Branch: refs/heads/master Commit: 0e19e82facb522f332fc1420ab43db515a52edf5 Parents: 3557479 Author: Alex Huang Authored: Mon Aug 12 17:37:13 2013 -0700 Committer: Alex Huang Committed: Mon Aug 12 19:05:22 2013 -0700 ---------------------------------------------------------------------- api/src/com/cloud/hypervisor/Hypervisor.java | 22 ++ api/src/com/cloud/offering/DiskOffering.java | 2 + api/src/com/cloud/offering/ServiceOffering.java | 9 +- .../com/cloud/migration/DiskOffering20Dao.java | 22 -- .../cloud/migration/DiskOffering20DaoImpl.java | 27 -- .../com/cloud/migration/DiskOffering20VO.java | 113 -------- .../com/cloud/migration/DiskOffering21Dao.java | 23 -- .../cloud/migration/DiskOffering21DaoImpl.java | 27 -- .../com/cloud/migration/DiskOffering21VO.java | 257 ------------------- .../cloud/migration/ServiceOffering20Dao.java | 22 -- .../migration/ServiceOffering20DaoImpl.java | 27 -- .../cloud/migration/ServiceOffering20VO.java | 199 -------------- .../cloud/migration/ServiceOffering21Dao.java | 22 -- .../migration/ServiceOffering21DaoImpl.java | 27 -- .../cloud/migration/ServiceOffering21VO.java | 183 ------------- server/src/com/cloud/storage/VolumeManager.java | 53 +--- .../src/com/cloud/user/AccountManagerImpl.java | 7 +- 17 files changed, 44 insertions(+), 998 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/api/src/com/cloud/hypervisor/Hypervisor.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/hypervisor/Hypervisor.java b/api/src/com/cloud/hypervisor/Hypervisor.java index a4ee5b9..710ddfc 100644 --- a/api/src/com/cloud/hypervisor/Hypervisor.java +++ b/api/src/com/cloud/hypervisor/Hypervisor.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.hypervisor; +import com.cloud.storage.Storage.ImageFormat; + public class Hypervisor { public static enum HypervisorType { @@ -63,6 +65,26 @@ public class Hypervisor { return HypervisorType.None; } } + + /** + * This method really needs to be part of the properties of the hypervisor type itself. + * + * @param hyperType + * @return + */ + public static ImageFormat getSupportedImageFormat(HypervisorType hyperType) { + if (hyperType == HypervisorType.XenServer) { + return ImageFormat.VHD; + } else if (hyperType == HypervisorType.KVM) { + return ImageFormat.QCOW2; + } else if (hyperType == HypervisorType.VMware) { + return ImageFormat.OVA; + } else if (hyperType == HypervisorType.Ovm) { + return ImageFormat.RAW; + } else { + return null; + } + } } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/api/src/com/cloud/offering/DiskOffering.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/com/cloud/offering/DiskOffering.java index 9c196e0..587d4a0 100644 --- a/api/src/com/cloud/offering/DiskOffering.java +++ b/api/src/com/cloud/offering/DiskOffering.java @@ -65,6 +65,8 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId Long getMaxIops(); + boolean isRecreatable(); + void setBytesReadRate(Long bytesReadRate); Long getBytesReadRate(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/api/src/com/cloud/offering/ServiceOffering.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/offering/ServiceOffering.java b/api/src/com/cloud/offering/ServiceOffering.java index 45d5f38..9f7bf8e 100755 --- a/api/src/com/cloud/offering/ServiceOffering.java +++ b/api/src/com/cloud/offering/ServiceOffering.java @@ -25,7 +25,7 @@ import org.apache.cloudstack.api.InternalIdentity; /** * offered. */ -public interface ServiceOffering extends InfrastructureEntity, InternalIdentity, Identity { +public interface ServiceOffering extends DiskOffering, InfrastructureEntity, InternalIdentity, Identity { public static final String consoleProxyDefaultOffUniqueName = "Cloud.com-ConsoleProxy"; public static final String ssvmDefaultOffUniqueName = "Cloud.com-SecondaryStorage"; public static final String routerDefaultOffUniqueName = "Cloud.Com-SoftwareRouter"; @@ -37,20 +37,25 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity, shared } + @Override String getDisplayText(); + @Override Date getCreated(); + @Override String getTags(); /** * @return user readable description */ + @Override String getName(); /** * @return is this a system service offering */ + @Override boolean getSystemUse(); /** @@ -96,8 +101,10 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity, /** * @return whether or not the service offering requires local storage */ + @Override boolean getUseLocalStorage(); + @Override Long getDomainId(); /** http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/DiskOffering20Dao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/DiskOffering20Dao.java b/engine/schema/src/com/cloud/migration/DiskOffering20Dao.java deleted file mode 100644 index ce22f48..0000000 --- a/engine/schema/src/com/cloud/migration/DiskOffering20Dao.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import com.cloud.utils.db.GenericDao; - -public interface DiskOffering20Dao extends GenericDao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/DiskOffering20DaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/DiskOffering20DaoImpl.java b/engine/schema/src/com/cloud/migration/DiskOffering20DaoImpl.java deleted file mode 100644 index e0eb40e..0000000 --- a/engine/schema/src/com/cloud/migration/DiskOffering20DaoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Local(value={DiskOffering20Dao.class}) -public class DiskOffering20DaoImpl extends GenericDaoBase implements DiskOffering20Dao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/DiskOffering20VO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/DiskOffering20VO.java b/engine/schema/src/com/cloud/migration/DiskOffering20VO.java deleted file mode 100644 index e50328d..0000000 --- a/engine/schema/src/com/cloud/migration/DiskOffering20VO.java +++ /dev/null @@ -1,113 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name="disk_offering") -public class DiskOffering20VO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - Long id; - - @Column(name="domain_id") - long domainId; - - @Column(name="name") - private String name = null; - - @Column(name="display_text") - private String displayText = null; - - @Column(name="disk_size") - long diskSize; - - @Column(name="mirrored") - boolean mirrored; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - public DiskOffering20VO() { - } - - public DiskOffering20VO(long domainId, String name, String displayText, long diskSize, boolean mirrored) { - this.domainId = domainId; - this.name = name; - this.displayText = displayText; - this.diskSize = diskSize; - this.mirrored = mirrored; - } - - public long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - public long getDomainId() { - return domainId; - } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getDisplayText() { - return displayText; - } - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - - public long getDiskSize() { - return diskSize; - } - public void setDiskSize(long diskSize) { - this.diskSize = diskSize; - } - - public boolean getMirrored() { - return mirrored; - } - public void setMirrored(boolean mirrored) { - this.mirrored = mirrored; - } - - public Date getRemoved() { - return removed; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/DiskOffering21Dao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/DiskOffering21Dao.java b/engine/schema/src/com/cloud/migration/DiskOffering21Dao.java deleted file mode 100644 index 21781ea..0000000 --- a/engine/schema/src/com/cloud/migration/DiskOffering21Dao.java +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import com.cloud.utils.db.GenericDao; - -public interface DiskOffering21Dao extends GenericDao { -} - http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/DiskOffering21DaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/DiskOffering21DaoImpl.java b/engine/schema/src/com/cloud/migration/DiskOffering21DaoImpl.java deleted file mode 100644 index b67d8fb..0000000 --- a/engine/schema/src/com/cloud/migration/DiskOffering21DaoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Local(value={DiskOffering21Dao.class}) -public class DiskOffering21DaoImpl extends GenericDaoBase implements DiskOffering21Dao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/DiskOffering21VO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/DiskOffering21VO.java b/engine/schema/src/com/cloud/migration/DiskOffering21VO.java deleted file mode 100644 index 593f7ba..0000000 --- a/engine/schema/src/com/cloud/migration/DiskOffering21VO.java +++ /dev/null @@ -1,257 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import java.util.Date; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorColumn; -import javax.persistence.DiscriminatorType; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.Transient; - -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name="disk_offering_21") -@Inheritance(strategy=InheritanceType.JOINED) -@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32) -public class DiskOffering21VO implements InternalIdentity { - public enum Type { - Disk, - Service - }; - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - long id; - - @Column(name="domain_id") - Long domainId; - - @Column(name="unique_name") - private String uniqueName; - - @Column(name="name") - private String name = null; - - @Column(name="display_text") - private String displayText = null; - - @Column(name="disk_size") - long diskSize; - - @Column(name="mirrored") - boolean mirrored; - - @Column(name="tags") - String tags; - - @Column(name="type") - Type type; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - @Column(name=GenericDao.CREATED_COLUMN) - private Date created; - - @Column(name="recreatable") - private boolean recreatable; - - @Column(name="use_local_storage") - private boolean useLocalStorage; - - @Column(name="system_use") - protected boolean systemUse; - - - public DiskOffering21VO() { - } - - public DiskOffering21VO(long domainId, String name, String displayText, long diskSize, boolean mirrored, String tags) { - this.domainId = domainId; - this.name = name; - this.displayText = displayText; - this.diskSize = diskSize; - this.mirrored = mirrored; - this.tags = tags; - this.recreatable = false; - this.type = Type.Disk; - this.useLocalStorage = false; - } - - public DiskOffering21VO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage) { - this.domainId = null; - this.type = Type.Service; - this.name = name; - this.displayText = displayText; - this.mirrored = mirrored; - this.tags = tags; - this.recreatable = recreatable; - this.useLocalStorage = useLocalStorage; - } - - public long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getUniqueName() { - return uniqueName; - } - - public boolean getSystemUse() { - return systemUse; - } - - public void setSystemUse(boolean systemUse) { - this.systemUse = systemUse; - } - - public boolean getUseLocalStorage() { - return useLocalStorage; - } - - public void setUserLocalStorage(boolean useLocalStorage) { - this.useLocalStorage = useLocalStorage; - } - - public Long getDomainId() { - return domainId; - } - - public Type getType() { - return type; - } - - public void setType(Type type) { - this.type = type; - } - - public boolean isRecreatable() { - return recreatable; - } - - public void setDomainId(Long domainId) { - this.domainId = domainId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDisplayText() { - return displayText; - } - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - - public long getDiskSizeInBytes() { - return diskSize * 1024 * 1024; - } - - public void setDiskSize(long diskSize) { - this.diskSize = diskSize; - } - - public boolean isMirrored() { - return mirrored; - } - public void setMirrored(boolean mirrored) { - this.mirrored = mirrored; - } - - public Date getRemoved() { - return removed; - } - - public Date getCreated() { - return created; - } - - protected void setTags(String tags) { - this.tags = tags; - } - - public String getTags() { - return tags; - } - - public void setUniqueName(String name) { - this.uniqueName = name; - } - - @Transient - public String[] getTagsArray() { - String tags = getTags(); - if (tags == null || tags.isEmpty()) { - return new String[0]; - } - - return tags.split(","); - } - - @Transient - public boolean containsTag(String... tags) { - if (this.tags == null) { - return false; - } - - for (String tag : tags) { - if (!this.tags.matches(tag)) { - return false; - } - } - - return true; - } - - @Transient - public void setTagsArray(List newTags) { - if (newTags.isEmpty()) { - setTags(null); - return; - } - - StringBuilder buf = new StringBuilder(); - for (String tag : newTags) { - buf.append(tag).append(","); - } - - buf.delete(buf.length() - 1, buf.length()); - - setTags(buf.toString()); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/ServiceOffering20Dao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering20Dao.java b/engine/schema/src/com/cloud/migration/ServiceOffering20Dao.java deleted file mode 100644 index e87b684..0000000 --- a/engine/schema/src/com/cloud/migration/ServiceOffering20Dao.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import com.cloud.utils.db.GenericDao; - -public interface ServiceOffering20Dao extends GenericDao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/ServiceOffering20DaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering20DaoImpl.java b/engine/schema/src/com/cloud/migration/ServiceOffering20DaoImpl.java deleted file mode 100644 index f67949e..0000000 --- a/engine/schema/src/com/cloud/migration/ServiceOffering20DaoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Local(value={ServiceOffering20Dao.class}) -public class ServiceOffering20DaoImpl extends GenericDaoBase implements ServiceOffering20Dao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/ServiceOffering20VO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering20VO.java b/engine/schema/src/com/cloud/migration/ServiceOffering20VO.java deleted file mode 100644 index bed29ec..0000000 --- a/engine/schema/src/com/cloud/migration/ServiceOffering20VO.java +++ /dev/null @@ -1,199 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -import com.cloud.dc.Vlan; -import com.cloud.dc.Vlan.VlanType; -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name="service_offering") -public class ServiceOffering20VO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private Long id = null; - - @Column(name="name") - private String name = null; - - @Column(name="cpu") - private int cpu; - - @Column(name="speed") - private int speed; - - @Column(name="ram_size") - private int ramSize; - - @Column(name="nw_rate") - private int rateMbps; - - @Column(name="mc_rate") - private int multicastRateMbps; - - @Column(name="mirrored") - private boolean mirroredVolumes; - - @Column(name="ha_enabled") - private boolean offerHA; - - @Column(name="display_text") - private String displayText = null; - - @Column(name="guest_ip_type") - @Enumerated(EnumType.STRING) - private Vlan.VlanType guestIpType = Vlan.VlanType.VirtualNetwork; - - @Column(name="use_local_storage") - private boolean useLocalStorage; - - @Column(name=GenericDao.CREATED_COLUMN) - private Date created; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - protected ServiceOffering20VO() { - } - - public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, boolean localStorageRequired) { - this(id, name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, Vlan.VlanType.VirtualNetwork, localStorageRequired); - } - - public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, VlanType guestIpType, boolean useLocalStorage) { - this.id = id; - this.name = name; - this.cpu = cpu; - this.ramSize = ramSize; - this.speed = speed; - this.rateMbps = rateMbps; - this.multicastRateMbps = multicastRateMbps; - this.offerHA = offerHA; - this.displayText = displayText; - this.guestIpType = guestIpType; - this.useLocalStorage = useLocalStorage; - } - - public boolean getOfferHA() { - return offerHA; - } - - public void setOfferHA(boolean offerHA) { - this.offerHA = offerHA; - } - - public long getId() { - return id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getCpu() { - return cpu; - } - - public void setCpu(int cpu) { - this.cpu = cpu; - } - - public void setSpeed(int speed) { - this.speed = speed; - } - - public void setRamSize(int ramSize) { - this.ramSize = ramSize; - } - - public int getSpeed() { - return speed; - } - - public int getRamSize() { - return ramSize; - } - - public Date getCreated() { - return created; - } - - public Date getRemoved() { - return removed; - } - - public void setMirroredVolumes(boolean mirroredVolumes) { - this.mirroredVolumes = mirroredVolumes; - } - - public boolean isMirroredVolumes() { - return mirroredVolumes; - } - - public String getDisplayText() { - return displayText; - } - - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - - public void setRateMbps(int rateMbps) { - this.rateMbps = rateMbps; - } - - public int getRateMbps() { - return rateMbps; - } - - public void setMulticastRateMbps(int multicastRateMbps) { - this.multicastRateMbps = multicastRateMbps; - } - - public int getMulticastRateMbps() { - return multicastRateMbps; - } - - public void setGuestIpType(Vlan.VlanType guestIpType) { - this.guestIpType = guestIpType; - } - - public Vlan.VlanType getGuestIpType() { - return guestIpType; - } - - public boolean getUseLocalStorage() { - return useLocalStorage; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/ServiceOffering21Dao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering21Dao.java b/engine/schema/src/com/cloud/migration/ServiceOffering21Dao.java deleted file mode 100644 index eece426..0000000 --- a/engine/schema/src/com/cloud/migration/ServiceOffering21Dao.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import com.cloud.utils.db.GenericDao; - -public interface ServiceOffering21Dao extends GenericDao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/ServiceOffering21DaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering21DaoImpl.java b/engine/schema/src/com/cloud/migration/ServiceOffering21DaoImpl.java deleted file mode 100644 index ce24191..0000000 --- a/engine/schema/src/com/cloud/migration/ServiceOffering21DaoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Local(value={ServiceOffering21Dao.class}) -public class ServiceOffering21DaoImpl extends GenericDaoBase implements ServiceOffering21Dao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java b/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java deleted file mode 100644 index 7a49e63..0000000 --- a/engine/schema/src/com/cloud/migration/ServiceOffering21VO.java +++ /dev/null @@ -1,183 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.Table; -import javax.persistence.Transient; - -import com.cloud.offering.ServiceOffering; - -@Entity -@Table(name="service_offering_21") -@DiscriminatorValue(value="Service") -@PrimaryKeyJoinColumn(name="id") -public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffering { - @Column(name="cpu") - private int cpu; - - @Column(name="speed") - private int speed; - - @Column(name="ram_size") - private int ramSize; - - @Column(name="nw_rate") - private Integer rateMbps; - - @Column(name="mc_rate") - private Integer multicastRateMbps; - - @Column(name="ha_enabled") - private boolean offerHA; - - @Column(name="host_tag") - private String hostTag; - - protected ServiceOffering21VO() { - super(); - } - - public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags) { - super(name, displayText, false, tags, recreatable, useLocalStorage); - this.cpu = cpu; - this.ramSize = ramSize; - this.speed = speed; - this.rateMbps = rateMbps; - this.multicastRateMbps = multicastRateMbps; - this.offerHA = offerHA; - } - - public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, String hostTag) { - this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, useLocalStorage, recreatable, tags); - this.hostTag = hostTag; - } - - - @Override - public boolean getOfferHA() { - return offerHA; - } - - @Override - public boolean getLimitCpuUse() { - return false; - } - - public void setOfferHA(boolean offerHA) { - this.offerHA = offerHA; - } - - @Override - @Transient - public String[] getTagsArray() { - String tags = getTags(); - if (tags == null || tags.length() == 0) { - return new String[0]; - } - - return tags.split(","); - } - - @Override - public int getCpu() { - return cpu; - } - - public void setCpu(int cpu) { - this.cpu = cpu; - } - - public void setSpeed(int speed) { - this.speed = speed; - } - - public void setRamSize(int ramSize) { - this.ramSize = ramSize; - } - - @Override - public int getSpeed() { - return speed; - } - - @Override - public int getRamSize() { - return ramSize; - } - - public void setRateMbps(Integer rateMbps) { - this.rateMbps = rateMbps; - } - - @Override - public Integer getRateMbps() { - return rateMbps; - } - - public void setMulticastRateMbps(Integer multicastRateMbps) { - this.multicastRateMbps = multicastRateMbps; - } - - @Override - public Integer getMulticastRateMbps() { - return multicastRateMbps; - } - - public String gethypervisorType() { - return null; - } - - public void setHostTag(String hostTag) { - this.hostTag = hostTag; - } - - public String getHostTag() { - return hostTag; - } - - @Override - public boolean getDefaultUse() { - return false; - } - - @Override - public String getSystemVmType() { - return null; - } - - @Override - public String getUuid() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean getVolatileVm() { - return false; - } - - @Override - public String getDeploymentPlanner() { - // TODO Auto-generated method stub - return null; - } - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/server/src/com/cloud/storage/VolumeManager.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/VolumeManager.java b/server/src/com/cloud/storage/VolumeManager.java index d95a814..944abc0 100644 --- a/server/src/com/cloud/storage/VolumeManager.java +++ b/server/src/com/cloud/storage/VolumeManager.java @@ -20,37 +20,25 @@ package com.cloud.storage; import java.util.Map; -import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd; -import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd; -import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd; -import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd; -import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd; -import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.deploy.DeployDestination; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientStorageCapacityException; -import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.StorageUnavailableException; import com.cloud.host.Host; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Volume.Type; import com.cloud.user.Account; +import com.cloud.utils.fsm.NoTransitionException; import com.cloud.vm.DiskProfile; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; -public interface VolumeManager extends VolumeApiService { - VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, - Long destPoolClusterId, HypervisorType dataDiskHyperType) - throws ConcurrentOperationException; - - @Override - VolumeVO uploadVolume(UploadVolumeCmd cmd) - throws ResourceAllocationException; +public interface VolumeManager { + VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId, HypervisorType dataDiskHyperType) throws ConcurrentOperationException; VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId); @@ -60,54 +48,29 @@ public interface VolumeManager extends VolumeApiService { String getVmNameOnVolume(Volume volume); - @Override - VolumeVO allocVolume(CreateVolumeCmd cmd) - throws ResourceAllocationException; - - @Override - VolumeVO createVolume(CreateVolumeCmd cmd); - - @Override - VolumeVO resizeVolume(ResizeVolumeCmd cmd) - throws ResourceAllocationException; - - @Override - boolean deleteVolume(long volumeId, Account caller) - throws ConcurrentOperationException; + Volume migrateVolume(Volume volume, StoragePool destPool); void destroyVolume(VolumeVO volume); DiskProfile allocateRawVolume(Type type, String name, DiskOfferingVO offering, Long size, VMInstanceVO vm, VMTemplateVO template, Account owner); - @Override - Volume attachVolumeToVM(AttachVolumeCmd command); - @Override - Volume detachVolumeFromVM(DetachVolumeCmd cmmd); + VolumeInfo createVolumeOnPrimaryStorage(VMInstanceVO vm, VolumeVO rootVolumeOfVm, VolumeInfo volume, HypervisorType rootDiskHyperType) throws NoTransitionException; void release(VirtualMachineProfile profile); void cleanupVolumes(long vmId) throws ConcurrentOperationException; - @Override - Volume migrateVolume(MigrateVolumeCmd cmd); - - void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost, - Map volumeToPool); + void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost, Map volumeToPool); boolean storageMigration(VirtualMachineProfile vm, StoragePool destPool); void prepareForMigration(VirtualMachineProfile vm, DeployDestination dest); - void prepare(VirtualMachineProfile vm, - DeployDestination dest) throws StorageUnavailableException, - InsufficientStorageCapacityException, ConcurrentOperationException; + void prepare(VirtualMachineProfile vm, DeployDestination dest) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException; boolean canVmRestartOnAnotherServer(long vmId); - DiskProfile allocateTemplatedVolume(Type type, String name, - DiskOfferingVO offering, VMTemplateVO template, VMInstanceVO vm, - Account owner); - + DiskProfile allocateTemplatedVolume(Type type, String name, DiskOfferingVO offering, VMTemplateVO template, VMInstanceVO vm, Account owner); String getVmNameFromVolumeId(long volumeId); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e19e82f/server/src/com/cloud/user/AccountManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index c090160..2f11fae 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -110,7 +110,7 @@ import com.cloud.projects.dao.ProjectDao; import com.cloud.server.auth.UserAuthenticator; import com.cloud.storage.VMTemplateVO; import com.cloud.storage.Volume; -import com.cloud.storage.VolumeManager; +import com.cloud.storage.VolumeApiService; import com.cloud.storage.VolumeVO; import com.cloud.storage.dao.SnapshotDao; import com.cloud.storage.dao.VMTemplateDao; @@ -225,7 +225,8 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M Site2SiteVpnManager _vpnMgr; @Inject private AutoScaleManager _autoscaleMgr; - @Inject VolumeManager volumeMgr; + @Inject + VolumeApiService volumeService; @Inject private AffinityGroupDao _affinityGroupDao; @Inject @@ -623,7 +624,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M for (VolumeVO volume : volumes) { if (!volume.getState().equals(Volume.State.Destroy)) { try { - volumeMgr.deleteVolume(volume.getId(), caller); + volumeService.deleteVolume(volume.getId(), caller); } catch (Exception ex) { s_logger.warn("Failed to cleanup volumes as a part of account id=" + accountId + " cleanup due to Exception: ", ex); accountCleanupNeeded = true;