Updated Branches: refs/heads/object_store b81fa6d9e -> 2ff01a79c
Rename TemplateTO/VolumeTO in cloud-engine-storage to TemplateObjectTO/VolumeObjectTO to avoid name conflicting with the one in cloud-api. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2ff01a79 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2ff01a79 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2ff01a79 Branch: refs/heads/object_store Commit: 2ff01a79cad58597aac2e38a06c891b13ddd6ca9 Parents: b81fa6d Author: Min Chen <[email protected]> Authored: Fri Apr 12 17:10:19 2013 -0700 Committer: Min Chen <[email protected]> Committed: Fri Apr 12 17:10:19 2013 -0700 ---------------------------------------------------------------------- .../storage/image/store/TemplateObject.java | 4 +- .../cloudstack/storage/test/DirectAgentTest.java | 4 +- .../command/CreateVolumeFromBaseImageCommand.java | 8 +- .../cloudstack/storage/command/DeleteCommand.java | 2 +- .../storage/to/ImageOnPrimayDataStoreTO.java | 6 +- .../cloudstack/storage/to/TemplateObjectTO.java | 74 +++++++++++++ .../apache/cloudstack/storage/to/TemplateTO.java | 74 ------------- .../cloudstack/storage/to/VolumeObjectTO.java | 83 +++++++++++++++ .../org/apache/cloudstack/storage/to/VolumeTO.java | 83 --------------- .../cloudstack/storage/volume/VolumeObject.java | 4 +- .../xen/resource/XenServerStorageResource.java | 10 +- 11 files changed, 176 insertions(+), 176 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/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 2025d27..7727f12 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 @@ -31,7 +31,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; import org.apache.cloudstack.storage.image.manager.ImageDataManager; -import org.apache.cloudstack.storage.to.TemplateTO; +import org.apache.cloudstack.storage.to.TemplateObjectTO; import org.apache.log4j.Logger; import com.cloud.agent.api.Answer; @@ -187,7 +187,7 @@ public class TemplateObject implements TemplateInfo { public DataTO getTO() { DataTO to = this.dataStore.getDriver().getTO(this); if (to == null) { - to = new TemplateTO(this); + to = new TemplateObjectTO(this); } return to; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java ---------------------------------------------------------------------- diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java index 71f1beb..a5a4cb7 100644 --- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java @@ -25,7 +25,7 @@ import javax.inject.Inject; import org.apache.cloudstack.storage.to.ImageStoreTO; import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.TemplateTO; +import org.apache.cloudstack.storage.to.TemplateObjectTO; import org.mockito.Mockito; import org.springframework.test.context.ContextConfiguration; import org.testng.annotations.Test; @@ -134,7 +134,7 @@ public class DirectAgentTest extends CloudStackTestNGBase { ImageStoreTO imageStore = Mockito.mock(ImageStoreTO.class); Mockito.when(imageStore.getType()).thenReturn("http"); - TemplateTO template = Mockito.mock(TemplateTO.class); + TemplateObjectTO template = Mockito.mock(TemplateObjectTO.class); Mockito.when(template.getPath()).thenReturn(this.getTemplateUrl()); Mockito.when(template.getImageDataStore()).thenReturn(imageStore); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeFromBaseImageCommand.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeFromBaseImageCommand.java b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeFromBaseImageCommand.java index f4be067..db96571 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeFromBaseImageCommand.java +++ b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeFromBaseImageCommand.java @@ -19,20 +19,20 @@ package org.apache.cloudstack.storage.command; import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeTO; +import org.apache.cloudstack.storage.to.VolumeObjectTO; import com.cloud.agent.api.Command; public class CreateVolumeFromBaseImageCommand extends Command implements StorageSubSystemCommand { - private final VolumeTO volume; + private final VolumeObjectTO volume; private final ImageOnPrimayDataStoreTO image; - public CreateVolumeFromBaseImageCommand(VolumeTO volume, String image) { + public CreateVolumeFromBaseImageCommand(VolumeObjectTO volume, String image) { this.volume = volume; this.image = null; } - public VolumeTO getVolume() { + public VolumeObjectTO getVolume() { return this.volume; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/src/org/apache/cloudstack/storage/command/DeleteCommand.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/DeleteCommand.java b/engine/storage/src/org/apache/cloudstack/storage/command/DeleteCommand.java index 5d948d1..3f62100 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/command/DeleteCommand.java +++ b/engine/storage/src/org/apache/cloudstack/storage/command/DeleteCommand.java @@ -18,7 +18,7 @@ */ package org.apache.cloudstack.storage.command; -import org.apache.cloudstack.storage.to.VolumeTO; +import org.apache.cloudstack.storage.to.VolumeObjectTO; import com.cloud.agent.api.Command; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java index 18743d7..e390918 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java +++ b/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java @@ -23,11 +23,11 @@ import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo; public class ImageOnPrimayDataStoreTO { private final String pathOnPrimaryDataStore; private PrimaryDataStoreTO dataStore; - private final TemplateTO template; + private final TemplateObjectTO template; public ImageOnPrimayDataStoreTO(TemplateOnPrimaryDataStoreInfo template) { this.pathOnPrimaryDataStore = template.getPath(); //this.dataStore = template.getPrimaryDataStore().getDataStoreTO(); - this.template = new TemplateTO(template.getTemplate()); + this.template = new TemplateObjectTO(template.getTemplate()); } public String getPathOnPrimaryDataStore() { @@ -38,7 +38,7 @@ public class ImageOnPrimayDataStoreTO { return this.dataStore; } - public TemplateTO getTemplate() { + public TemplateObjectTO getTemplate() { return this.template; } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java new file mode 100644 index 0000000..76f0d03 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java @@ -0,0 +1,74 @@ +// 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 org.apache.cloudstack.storage.to; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreTO; +import org.apache.cloudstack.engine.subsystem.api.storage.DataTO; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.storage.image.datastore.ImageStoreInfo; + +public class TemplateObjectTO implements DataTO { + private final String path; + private final String uuid; + private DiskFormat diskType; + private final ImageStoreTO imageDataStore; + private final String name; + + public TemplateObjectTO(TemplateInfo template) { + this.path = template.getUri(); + this.uuid = template.getUuid(); + //this.diskType = template.getDiskType(); + this.imageDataStore = new ImageStoreTO((ImageStoreInfo)template.getDataStore()); + this.name = template.getUniqueName(); + } + + @Override + public String getPath() { + return this.path; + } + + public String getUuid() { + return this.uuid; + } + + public DiskFormat getDiskType() { + return this.diskType; + } + + public ImageStoreTO getImageDataStore() { + return this.imageDataStore; + } + + @Override + public DataObjectType getObjectType() { + return DataObjectType.TEMPLATE; + } + + @Override + public DataStoreTO getDataStore() { + return (DataStoreTO)this.imageDataStore; + } + + /** + * @return the name + */ + public String getName() { + return name; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java deleted file mode 100644 index f54c2c7..0000000 --- a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java +++ /dev/null @@ -1,74 +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 org.apache.cloudstack.storage.to; - -import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreTO; -import org.apache.cloudstack.engine.subsystem.api.storage.DataTO; -import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; -import org.apache.cloudstack.storage.image.datastore.ImageStoreInfo; - -public class TemplateTO implements DataTO { - private final String path; - private final String uuid; - private DiskFormat diskType; - private final ImageStoreTO imageDataStore; - private final String name; - - public TemplateTO(TemplateInfo template) { - this.path = template.getUri(); - this.uuid = template.getUuid(); - //this.diskType = template.getDiskType(); - this.imageDataStore = new ImageStoreTO((ImageStoreInfo)template.getDataStore()); - this.name = template.getUniqueName(); - } - - @Override - public String getPath() { - return this.path; - } - - public String getUuid() { - return this.uuid; - } - - public DiskFormat getDiskType() { - return this.diskType; - } - - public ImageStoreTO getImageDataStore() { - return this.imageDataStore; - } - - @Override - public DataObjectType getObjectType() { - return DataObjectType.TEMPLATE; - } - - @Override - public DataStoreTO getDataStore() { - return (DataStoreTO)this.imageDataStore; - } - - /** - * @return the name - */ - public String getName() { - return name; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java new file mode 100644 index 0000000..e556a3b --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java @@ -0,0 +1,83 @@ +// 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 org.apache.cloudstack.storage.to; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataTO; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; + +public class VolumeObjectTO implements DataTO { + private final String uuid; + private final String path; + private VolumeType volumeType; + private DiskFormat diskType; + private PrimaryDataStoreTO dataStore; + private String name; + private final long size; + public VolumeObjectTO(VolumeInfo volume) { + this.uuid = volume.getUuid(); + this.path = volume.getUri(); + //this.volumeType = volume.getType(); + //this.diskType = volume.getDiskType(); + if (volume.getDataStore() != null) { + this.dataStore = new PrimaryDataStoreTO((PrimaryDataStoreInfo)volume.getDataStore()); + } else { + this.dataStore = null; + } + //this.name = volume.getName(); + this.size = volume.getSize(); + } + + public String getUuid() { + return this.uuid; + } + + public String getPath() { + return this.path; + } + + public VolumeType getVolumeType() { + return this.volumeType; + } + + public DiskFormat getDiskType() { + return this.diskType; + } + + public PrimaryDataStoreTO getDataStore() { + return this.dataStore; + } + + public void setDataStore(PrimaryDataStoreTO dataStore) { + this.dataStore = dataStore; + } + + public String getName() { + return this.name; + } + + public long getSize() { + return this.size; + } + + public DataObjectType getObjectType() { + return DataObjectType.VOLUME; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java deleted file mode 100644 index 162ff38..0000000 --- a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java +++ /dev/null @@ -1,83 +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 org.apache.cloudstack.storage.to; - -import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; -import org.apache.cloudstack.engine.subsystem.api.storage.DataTO; -import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; -import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; -import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; - -public class VolumeTO implements DataTO { - private final String uuid; - private final String path; - private VolumeType volumeType; - private DiskFormat diskType; - private PrimaryDataStoreTO dataStore; - private String name; - private final long size; - public VolumeTO(VolumeInfo volume) { - this.uuid = volume.getUuid(); - this.path = volume.getUri(); - //this.volumeType = volume.getType(); - //this.diskType = volume.getDiskType(); - if (volume.getDataStore() != null) { - this.dataStore = new PrimaryDataStoreTO((PrimaryDataStoreInfo)volume.getDataStore()); - } else { - this.dataStore = null; - } - //this.name = volume.getName(); - this.size = volume.getSize(); - } - - public String getUuid() { - return this.uuid; - } - - public String getPath() { - return this.path; - } - - public VolumeType getVolumeType() { - return this.volumeType; - } - - public DiskFormat getDiskType() { - return this.diskType; - } - - public PrimaryDataStoreTO getDataStore() { - return this.dataStore; - } - - public void setDataStore(PrimaryDataStoreTO dataStore) { - this.dataStore = dataStore; - } - - public String getName() { - return this.name; - } - - public long getSize() { - return this.size; - } - - public DataObjectType getObjectType() { - return DataObjectType.VOLUME; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java index c2fb0cb..67f75b0 100644 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java @@ -29,7 +29,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreState import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; -import org.apache.cloudstack.storage.to.VolumeTO; +import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.log4j.Logger; import com.cloud.agent.api.Answer; @@ -339,7 +339,7 @@ public class VolumeObject implements VolumeInfo { public DataTO getTO() { DataTO to = this.getDataStore().getDriver().getTO(this); if (to == null) { - to = new VolumeTO(this); + to = new VolumeObjectTO(this); } return to; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ff01a79/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java index 70c992f..b629377 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java @@ -47,8 +47,8 @@ import org.apache.cloudstack.storage.datastore.protocol.DataStoreProtocol; import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; import org.apache.cloudstack.storage.to.ImageStoreTO; import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.TemplateTO; -import org.apache.cloudstack.storage.to.VolumeTO; +import org.apache.cloudstack.storage.to.TemplateObjectTO; +import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; @@ -194,7 +194,7 @@ public class XenServerStorageResource { } protected Answer execute(DeleteVolumeCommand cmd) { - VolumeTO volume = null; + VolumeObjectTO volume = null; Connection conn = hypervisorResource.getConnection(); String errorMsg = null; try { @@ -216,7 +216,7 @@ public class XenServerStorageResource { } protected Answer execute(CreateVolumeFromBaseImageCommand cmd) { - VolumeTO volume = cmd.getVolume(); + VolumeObjectTO volume = cmd.getVolume(); ImageOnPrimayDataStoreTO baseImage = cmd.getImage(); Connection conn = hypervisorResource.getConnection(); @@ -683,7 +683,7 @@ public class XenServerStorageResource { try { if (srcStore.getRole() == DataStoreRole.ImageCache && srcData.getObjectType() == DataObjectType.TEMPLATE) { ImageStoreTO srcImageStore = (ImageStoreTO)srcStore; - TemplateTO srcTemplate = (TemplateTO)srcData; + TemplateObjectTO srcTemplate = (TemplateObjectTO)srcData; String storeUrl = srcImageStore.getUri(); if (!storeUrl.startsWith("nfs")) { return new PrimaryStorageDownloadAnswer("only nfs image cache store supported");
