You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/12/06 02:52:48 UTC
git commit: We can directly load xenserver resource in unit test now,
that means directly sending commands to hypervisor host in unit test
is possible, storage integration test is in a final stage
Updated Branches:
refs/heads/javelin 0836bb8ec -> 1b9164139
We can directly load xenserver resource in unit test now, that means directly sending commands to hypervisor host in unit test is possible, storage integration test is in a final stage
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/1b916413
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/1b916413
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/1b916413
Branch: refs/heads/javelin
Commit: 1b916413973cfdeed15ca11e119ec14741f96977
Parents: 0836bb8
Author: Edison Su <su...@gmail.com>
Authored: Wed Dec 5 17:52:24 2012 -0800
Committer: Edison Su <su...@gmail.com>
Committed: Wed Dec 5 17:52:24 2012 -0800
----------------------------------------------------------------------
.../api/storage/PrimaryDataStoreInfo.java | 1 +
engine/storage/integration-test/pom.xml | 6 +
.../storage/test/ChildTestConfiguration.java | 2 +-
.../storage/test/DirectAgentManagerImpl.java | 193 ------------
.../storage/test/DirectAgentManagerSimpleImpl.java | 235 +++++++++++++++
.../cloudstack/storage/test/DirectAgentTest.java | 125 ++++++++
.../cloudstack/storage/test/volumeServiceTest.java | 3 +-
.../datastore/PrimaryDataStoreEntityImpl.java | 1 -
.../storage/datastore/DefaultPrimaryDataStore.java | 25 ++
.../cloudstack/storage/volume/VolumeObject.java | 12 +
.../storage/volume/VolumeServiceImpl.java | 1 -
11 files changed, 406 insertions(+), 198 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreInfo.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreInfo.java
index 7c110bf..9995688 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreInfo.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreInfo.java
@@ -37,4 +37,5 @@ public interface PrimaryDataStoreInfo {
public String getUuid();
public State getManagedState();
public String getName();
+ public String getType();
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/storage/integration-test/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/pom.xml b/engine/storage/integration-test/pom.xml
index c2f4d24..947614c 100644
--- a/engine/storage/integration-test/pom.xml
+++ b/engine/storage/integration-test/pom.xml
@@ -45,6 +45,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-plugin-hypervisor-xen</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
index 9077a5a..aa9abe3 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
@@ -18,7 +18,7 @@ public class ChildTestConfiguration extends TestConfiguration {
@Bean
public AgentManager agentMgr() {
- return Mockito.mock(AgentManager.class);
+ return new DirectAgentManagerSimpleImpl();
}
/* @Override
@Bean
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerImpl.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerImpl.java
deleted file mode 100644
index 1345410..0000000
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerImpl.java
+++ /dev/null
@@ -1,193 +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.test;
-
-import java.util.Map;
-
-import javax.naming.ConfigurationException;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.Listener;
-import com.cloud.agent.StartupCommandProcessor;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.manager.AgentAttache;
-import com.cloud.agent.manager.Commands;
-import com.cloud.exception.AgentUnavailableException;
-import com.cloud.exception.ConnectionException;
-import com.cloud.exception.OperationTimedoutException;
-import com.cloud.host.HostVO;
-import com.cloud.host.Status.Event;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.resource.ServerResource;
-
-public class DirectAgentManagerImpl implements AgentManager {
-
- @Override
- public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean start() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean stop() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Answer easySend(Long hostId, Command cmd) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Answer send(Long hostId, Command cmd) throws AgentUnavailableException, OperationTimedoutException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Answer[] send(Long hostId, Commands cmds) throws AgentUnavailableException, OperationTimedoutException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Answer[] send(Long hostId, Commands cmds, int timeout) throws AgentUnavailableException, OperationTimedoutException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public long send(Long hostId, Commands cmds, Listener listener) throws AgentUnavailableException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int registerForHostEvents(Listener listener, boolean connections, boolean commands, boolean priority) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public int registerForInitialConnects(StartupCommandProcessor creator, boolean priority) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public void unregisterForHostEvents(int id) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public Answer sendTo(Long dcId, HypervisorType type, Command cmd) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) throws AgentUnavailableException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Answer sendToSecStorage(HostVO ssHost, Command cmd) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance) throws ConnectionException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean agentStatusTransitTo(HostVO host, Event e, long msId) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public AgentAttache findAttache(long hostId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void disconnectWithoutInvestigation(long hostId, Event event) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void pullAgentToMaintenance(long hostId) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void pullAgentOutMaintenance(long hostId) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean reconnect(long hostId) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public Answer sendToSSVM(Long dcId, Command cmd) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
new file mode 100644
index 0000000..080e65b
--- /dev/null
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
@@ -0,0 +1,235 @@
+/*
+ * 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.test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.Listener;
+import com.cloud.agent.StartupCommandProcessor;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.manager.AgentAttache;
+import com.cloud.agent.manager.Commands;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.exception.ConnectionException;
+import com.cloud.exception.OperationTimedoutException;
+import com.cloud.host.HostVO;
+import com.cloud.host.Status.Event;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.xen.resource.XcpOssResource;
+import com.cloud.resource.ServerResource;
+
+public class DirectAgentManagerSimpleImpl implements AgentManager {
+ private static final Logger logger = Logger.getLogger(DirectAgentManagerSimpleImpl.class);
+ private Map<Long, ServerResource> hostResourcesMap = new HashMap<Long, ServerResource>();
+ @Inject
+ HostDao hostDao;
+ @Override
+ public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean start() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean stop() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Answer easySend(Long hostId, Command cmd) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ protected void loadResource(Long hostId) {
+ HostVO host = hostDao.findById(hostId);
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put("guid", host.getGuid());
+ params.put("ipaddress", host.getPrivateIpAddress());
+ params.put("username", "root");
+ params.put("password", "password");
+ params.put("zone", String.valueOf(host.getDataCenterId()));
+ params.put("pod", String.valueOf(host.getPodId()));
+
+ ServerResource resource = null;
+ if (host.getHypervisorType() == HypervisorType.XenServer) {
+ resource = new XcpOssResource();
+ }
+
+ try {
+ resource.configure(host.getName(), params);
+ hostResourcesMap.put(hostId, resource);
+ } catch (ConfigurationException e) {
+ logger.debug("Failed to load resource:" + e.toString());
+ }
+ }
+
+ @Override
+ public synchronized Answer send(Long hostId, Command cmd) throws AgentUnavailableException, OperationTimedoutException {
+ ServerResource resource = hostResourcesMap.get(hostId);
+ if (resource == null) {
+ loadResource(hostId);
+ resource = hostResourcesMap.get(hostId);
+ }
+
+ if (resource == null) {
+ return null;
+ }
+
+ Answer answer = resource.executeRequest(cmd);
+ return answer;
+ }
+
+ @Override
+ public Answer[] send(Long hostId, Commands cmds) throws AgentUnavailableException, OperationTimedoutException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Answer[] send(Long hostId, Commands cmds, int timeout) throws AgentUnavailableException, OperationTimedoutException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public long send(Long hostId, Commands cmds, Listener listener) throws AgentUnavailableException {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int registerForHostEvents(Listener listener, boolean connections, boolean commands, boolean priority) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public int registerForInitialConnects(StartupCommandProcessor creator, boolean priority) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void unregisterForHostEvents(int id) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Answer sendTo(Long dcId, HypervisorType type, Command cmd) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) throws AgentUnavailableException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Answer sendToSecStorage(HostVO ssHost, Command cmd) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance) throws ConnectionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean agentStatusTransitTo(HostVO host, Event e, long msId) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public AgentAttache findAttache(long hostId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void disconnectWithoutInvestigation(long hostId, Event event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void pullAgentToMaintenance(long hostId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void pullAgentOutMaintenance(long hostId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean reconnect(long hostId) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Answer sendToSSVM(Long dcId, Command cmd) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/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
new file mode 100644
index 0000000..852f379
--- /dev/null
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.test;
+
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.ReadyCommand;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.HostPodVO;
+import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.exception.OperationTimedoutException;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Cluster.ClusterType;
+import com.cloud.org.Managed.ManagedState;
+import com.cloud.resource.ResourceState;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations="classpath:/resource/storageContext.xml")
+public class DirectAgentTest {
+ @Inject
+ AgentManager agentMgr;
+ @Inject
+ HostDao hostDao;
+ @Inject
+ HostPodDao podDao;
+ @Inject
+ ClusterDao clusterDao;
+ @Inject
+ DataCenterDao dcDao;
+ private long dcId;
+ private long clusterId;
+ private long hostId;
+ private String hostGuid = "759ee4c9-a15a-297b-67c6-ac267d8aa429";
+ @Before
+ public void setUp() {
+ HostVO host = hostDao.findByGuid(hostGuid);
+ if (host != null) {
+ hostId = host.getId();
+ dcId = host.getDataCenterId();
+ clusterId = host.getClusterId();
+ return;
+ }
+ //create data center
+ DataCenterVO dc = new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24",
+ null, null, NetworkType.Basic, null, null, true, true);
+ dc = dcDao.persist(dc);
+ dcId = dc.getId();
+ //create pod
+
+ HostPodVO pod = new HostPodVO(UUID.randomUUID().toString(), dc.getId(), "192.168.56.1", "192.168.56.0/24", 8, "test");
+ pod = podDao.persist(pod);
+ //create xen cluster
+ ClusterVO cluster = new ClusterVO(dc.getId(), pod.getId(), "devcloud cluster");
+ cluster.setHypervisorType(HypervisorType.XenServer.toString());
+ cluster.setClusterType(ClusterType.CloudManaged);
+ cluster.setManagedState(ManagedState.Managed);
+ cluster = clusterDao.persist(cluster);
+ clusterId = cluster.getId();
+ //create xen host
+
+ //TODO: this hardcode host uuid in devcloud
+ host = new HostVO(hostGuid);
+ host.setName("devcloud xen host");
+ host.setType(Host.Type.Routing);
+ host.setHypervisorType(HypervisorType.XenServer);
+ host.setPrivateIpAddress("192.168.56.2");
+ host.setDataCenterId(dc.getId());
+ host.setVersion("6.0.1");
+ host.setAvailable(true);
+ host.setSetup(true);
+ host.setLastPinged(0);
+ host.setResourceState(ResourceState.Enabled);
+ host.setClusterId(cluster.getId());
+
+ host = hostDao.persist(host);
+ hostId = host.getId();
+ }
+
+ @Test
+ public void testInitResource() {
+ ReadyCommand cmd = new ReadyCommand(dcId);
+ try {
+ agentMgr.send(hostId, cmd);
+ } catch (AgentUnavailableException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (OperationTimedoutException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
index f633dac..2c24739 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
@@ -293,8 +293,7 @@ public class volumeServiceTest {
DefaultPrimaryDatastoreProviderImpl provider = ComponentInject.inject(DefaultPrimaryDatastoreProviderImpl.class);
//assertNotNull(provider.dataStoreDao);
- DefaultPrimaryDataStore dpdsi = new DefaultPrimaryDataStore(null, null, null);
- ComponentInject.inject(dpdsi);
+ DefaultPrimaryDataStore dpdsi = DefaultPrimaryDataStore.createDataStore(null, null, null);
//assertNotNull(dpdsi.volumeDao);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreEntityImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreEntityImpl.java
index eca4a69..5763496 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreEntityImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreEntityImpl.java
@@ -147,7 +147,6 @@ public class PrimaryDataStoreEntityImpl implements StorageEntity {
@Override
public StoragePoolType getPoolType() {
- // TODO Auto-generated method stub
return null;
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
index 4a5922d..b6350ed 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
@@ -5,6 +5,7 @@ import java.util.List;
import javax.inject.Inject;
+import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
@@ -168,4 +169,28 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
// TODO Auto-generated method stub
return true;
}
+
+ @Override
+ public String getUuid() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public State getManagedState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getType() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/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 f5e2068..9a462d8 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
@@ -140,4 +140,16 @@ public class VolumeObject implements VolumeInfo {
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public Date getUpdatedDate() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getOwner() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1b916413/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 13ead8e..2340185 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -139,7 +139,6 @@ public class VolumeServiceImpl implements VolumeService {
try {
dataStore.installTemplate(templateOnPrimaryStoreObj);
templateOnPrimaryStoreObj.updateStatus(Status.CREATED);
-
} catch (Exception e) {
templateOnPrimaryStoreObj.updateStatus(Status.ABANDONED);
templateOnPrimaryStoreObj.stateTransit(TemplateOnPrimaryDataStoreStateMachine.Event.OperationFailed);