diff --git a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java index f9c03889668..015d009ab44 100644 --- a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java +++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java @@ -19,8 +19,8 @@ package org.apache.cloudstack.storage.image.motion; import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; -import org.apache.cloudstack.framework.async.AsyncCallbackHandler; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; import org.apache.cloudstack.storage.EndPoint; import org.apache.cloudstack.storage.command.CommandResult; import org.apache.cloudstack.storage.command.CopyTemplateToPrimaryStorageCmd; @@ -52,20 +52,34 @@ public class DefaultImageMotionStrategy implements ImageMotionStrategy { ep.sendMessage(copyCommand); return true; } + + private class CreateTemplateContext extends AsyncRpcConext { + private final TemplateOnPrimaryDataStoreInfo template; + public CreateTemplateContext(AsyncCompletionCallback callback, TemplateOnPrimaryDataStoreInfo template) { + super(callback); + this.template = template; + } + + public TemplateOnPrimaryDataStoreInfo getTemplate() { + return this.template; + } + + } @Override public void copyTemplateAsync(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep, AsyncCompletionCallback callback) { ImageOnPrimayDataStoreTO imageTo = new ImageOnPrimayDataStoreTO(templateStore); CopyTemplateToPrimaryStorageCmd copyCommand = new CopyTemplateToPrimaryStorageCmd(imageTo); - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this).setParentCallback(callback) - .setOperationName("defaultImageStrategy.copytemplate.callback") - .setContextParam("templateStore", templateStore); + CreateTemplateContext context = new CreateTemplateContext(callback, templateStore); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().copyTemplateCallBack(null, null)) + .setContext(context); + ep.sendMessageAsync(copyCommand, caller); } - @AsyncCallbackHandler(operationName="defaultImageStrategy.copytemplate.callback") - public void copyTemplateCallBack(AsyncCallbackDispatcher callback) { - AsyncCallbackDispatcher parentCall = callback.getParentCallback(); + public Object copyTemplateCallBack(AsyncCallbackDispatcher callback, CreateTemplateContext context) { + AsyncCompletionCallback parentCall = context.getParentCallback(); CopyTemplateToPrimaryStorageAnswer answer = callback.getResult(); CommandResult result = new CommandResult(); @@ -73,12 +87,13 @@ public class DefaultImageMotionStrategy implements ImageMotionStrategy { result.setSucess(answer.getResult()); result.setResult(answer.getDetails()); } else { - TemplateOnPrimaryDataStoreInfo templateStore = callback.getContextParam("templateStore"); + TemplateOnPrimaryDataStoreInfo templateStore = context.getTemplate(); templateStore.setPath(answer.getPath()); result.setSucess(true); } parentCall.complete(result); + return null; } } diff --git a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java index 9e06b92b342..7e5387dfc82 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java +++ b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java @@ -20,8 +20,6 @@ package org.apache.cloudstack.storage; import javax.inject.Inject; -import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; -import org.apache.cloudstack.framework.async.AsyncCallbackHandler; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.apache.log4j.Logger; @@ -62,15 +60,6 @@ public class HypervisorHostEndPoint implements EndPoint { @Override public void sendMessageAsync(Command cmd, AsyncCompletionCallback callback) { - AsyncCallbackDispatcher dispatcher = new AsyncCallbackDispatcher(this).setContextParam("parentCallback", callback). - setOperationName("hypervisorEndpoint.sendMessage.callback"); - - rpcServer.sendCommandAsync(this.hostAddress, cmd, dispatcher); - } - - @AsyncCallbackHandler(operationName="hypervisorEndpoint.sendMessage.callback") - public void sendMessageCallback(AsyncCallbackDispatcher callback) { - AsyncCallbackDispatcher parentDispatcher = callback.getContextParam("parentCallback"); - parentDispatcher.complete(callback.getResult()); + rpcServer.sendCommandAsync(this.hostAddress, cmd, callback); } } diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java index 632542aba3c..546c339b82b 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java @@ -31,7 +31,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType; import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; -import org.apache.cloudstack.framework.async.AsyncCallbackHandler; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.apache.cloudstack.storage.datastore.PrimaryDataStoreEntityImpl; import org.apache.cloudstack.storage.image.TemplateEntityImpl; import org.apache.cloudstack.storage.image.TemplateInfo; @@ -197,8 +197,9 @@ public class VolumeEntityImpl implements VolumeEntity { public boolean createVolumeFromTemplate(long dataStoreId, VolumeDiskType diskType, TemplateEntity template) { TemplateInfo ti = ((TemplateEntityImpl)template).getTemplateInfo(); - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this) - .setOperationName("volumeEntity.createVolumeFromTemplateAsyncCallback"); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().createVolumeFromTemplateAsyncCallback(null, null)); + vs.createVolumeFromTemplateAsync(volumeInfo, dataStoreId, diskType, ti, caller); try { synchronized (volumeInfo) { @@ -210,11 +211,12 @@ public class VolumeEntityImpl implements VolumeEntity { return true; } - @AsyncCallbackHandler(operationName="volumeEntity.createVolumeFromTemplateAsyncCallback") - public void createVolumeFromTemplateAsyncCallback(AsyncCallbackDispatcher callback) { + + public Object createVolumeFromTemplateAsyncCallback(AsyncCompletionCallback callback, Object context) { synchronized (volumeInfo) { volumeInfo.notify(); } + return null; } } 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 a9781e1f42e..a3d1038511a 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 @@ -11,8 +11,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCy import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreProvider; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType; -import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; -import org.apache.cloudstack.framework.async.AsyncCallbackHandler; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; import org.apache.cloudstack.storage.EndPoint; import org.apache.cloudstack.storage.HypervisorHostEndPoint; @@ -31,7 +29,6 @@ import org.apache.log4j.Logger; import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.storage.Volume; import com.cloud.utils.component.ComponentInject; import edu.emory.mathcs.backport.java.util.Collections; @@ -197,19 +194,10 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore { public void createVoluemFromBaseImageAsync(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo templateStore, AsyncCompletionCallback callback) { VolumeObject vo = (VolumeObject) volume; vo.setVolumeDiskType(templateStore.getTemplate().getDiskType()); - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this); - caller.setCallback(caller.getTarget().createVoluemFromBaseImageAsyncCallback(null, null)) - .setOperationName("primarydatastore.createvolumefrombaseImage"); - this.driver.createVolumeFromBaseImageAsync(vo, templateStore, caller); + + this.driver.createVolumeFromBaseImageAsync(vo, templateStore, callback); } - @AsyncCallbackHandler(operationName="primarydatastore.createvolumefrombaseImage") - public Object createVoluemFromBaseImageAsyncCallback(AsyncCallbackDispatcher callback, Object parames) { - AsyncCallbackDispatcher parent = callback.getParentCallback(); - CommandResult result = callback.getResult(); - parent.complete(result); - } - @Override public boolean installTemplate(TemplateOnPrimaryDataStoreInfo template) { // TODO Auto-generated method stub diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java index a2506cad4f5..1a09266c6e3 100644 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java @@ -5,8 +5,8 @@ import java.util.Map; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; -import org.apache.cloudstack.framework.async.AsyncCallbackHandler; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; import org.apache.cloudstack.storage.EndPoint; import org.apache.cloudstack.storage.command.CommandResult; import org.apache.cloudstack.storage.command.CreateVolumeAnswer; @@ -103,6 +103,19 @@ public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver return answer; } + private class CreateVolumeFromBaseImageContext extends AsyncRpcConext { + private final VolumeObject volume; + + public CreateVolumeFromBaseImageContext(AsyncCompletionCallback callback, VolumeObject volume) { + super(callback); + this.volume = volume; + } + + public VolumeObject getVolume() { + return this.volume; + } + + } @Override public void createVolumeFromBaseImageAsync(VolumeObject volume, TemplateOnPrimaryDataStoreInfo template, AsyncCompletionCallback callback) { VolumeTO vol = new VolumeTO(volume); @@ -111,17 +124,17 @@ public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver List endPoints = template.getPrimaryDataStore().getEndPoints(); EndPoint ep = endPoints.get(0); - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this) - .setParentCallback(callback) - .setOperationName("primarydatastoredriver.createvolumefrombaseImage") - .setContextParam("volume", volume); + CreateVolumeFromBaseImageContext context = new CreateVolumeFromBaseImageContext(callback, volume); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setContext(context) + .setCallback(caller.getTarget().createVolumeFromBaseImageAsyncCallback(null, null)); + ep.sendMessageAsync(cmd, caller); } - @AsyncCallbackHandler(operationName="primarydatastoredriver.createvolumefrombaseImage") - public void createVolumeFromBaseImageAsyncCallback(AsyncCallbackDispatcher callback) { + public Object createVolumeFromBaseImageAsyncCallback(AsyncCallbackDispatcher callback, CreateVolumeFromBaseImageContext context) { CreateVolumeAnswer answer = (CreateVolumeAnswer)callback.getResult(); CommandResult result = new CommandResult(); if (answer == null || answer.getDetails() != null) { @@ -131,11 +144,12 @@ public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver } } else { result.setSucess(true); - VolumeObject volume = callback.getContextParam("volume"); + VolumeObject volume = context.getVolume(); volume.setPath(answer.getVolumeUuid()); } - AsyncCallbackDispatcher parentCall = callback.getParentCallback(); + AsyncCompletionCallback parentCall = context.getParentCallback(); parentCall.complete(result); + return null; } @Override 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 cd3414a5aaf..5ae6ed9024d 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 @@ -25,8 +25,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskType; import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; -import org.apache.cloudstack.framework.async.AsyncCallbackHandler; import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; import org.apache.cloudstack.storage.EndPoint; import org.apache.cloudstack.storage.command.CommandResult; import org.apache.cloudstack.storage.datastore.PrimaryDataStore; @@ -131,6 +131,30 @@ public class VolumeServiceImpl implements VolumeService { return null; } + private class CreateBaseImageContext extends AsyncRpcConext { + private final VolumeInfo volume; + private final PrimaryDataStore dataStore; + private final TemplateOnPrimaryDataStoreObject template; + public CreateBaseImageContext(AsyncCompletionCallback callback, VolumeInfo volume, PrimaryDataStore datastore, TemplateOnPrimaryDataStoreObject template) { + super(callback); + this.volume = volume; + this.dataStore = datastore; + this.template = template; + } + + public VolumeInfo getVolume() { + return this.volume; + } + + public PrimaryDataStore getDataStore() { + return this.dataStore; + } + + public TemplateOnPrimaryDataStoreObject getTemplate() { + return this.template; + } + + } @DB protected void createBaseImageAsync(VolumeInfo volume, PrimaryDataStore dataStore, TemplateInfo template, AsyncCompletionCallback callback) { TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = (TemplateOnPrimaryDataStoreObject) templatePrimaryStoreMgr.createTemplateOnPrimaryDataStore(template, dataStore); @@ -147,21 +171,18 @@ public class VolumeServiceImpl implements VolumeService { templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOAD_IN_PROGRESS); - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this) - .setParentCallback(callback) - .setOperationName("volumeservice.createbaseimage.callback") - .setContextParam("volume", volume) - .setContextParam("primary", dataStore) - .setContextParam("templateOnPrimary", templateOnPrimaryStoreObj); + CreateBaseImageContext context = new CreateBaseImageContext(callback, volume, dataStore, templateOnPrimaryStoreObj); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().createBaseImageCallback(null, null)) + .setContext(context); imageMotion.copyTemplateAsync(templateOnPrimaryStoreObj, caller); } @DB - @AsyncCallbackHandler(operationName="volumeservice.createbaseimage.callback") - public void createBaseImageCallback(AsyncCallbackDispatcher callback) { + public Object createBaseImageCallback(AsyncCallbackDispatcher callback, CreateBaseImageContext context) { CommandResult result = callback.getResult(); - TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = callback.getContextParam("templateOnPrimary"); + TemplateOnPrimaryDataStoreObject templateOnPrimaryStoreObj = context.getTemplate(); if (result.isSuccess()) { templateOnPrimaryStoreObj.updateStatus(Status.DOWNLOADED); templateOnPrimaryStoreObj.stateTransit(TemplateOnPrimaryDataStoreStateMachine.Event.OperationSuccessed); @@ -170,18 +191,28 @@ public class VolumeServiceImpl implements VolumeService { templateOnPrimaryStoreObj.stateTransit(TemplateOnPrimaryDataStoreStateMachine.Event.OperationFailed); } - AsyncCallbackDispatcher parentCaller = callback.getParentCallback(); - VolumeInfo volume = callback.getContextParam("volume"); - PrimaryDataStore pd = callback.getContextParam("primary"); - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this) - .setParentCallback(parentCaller) - .setOperationName("volumeservice.createvolumefrombaseimage.callback"); + AsyncCompletionCallback parentCaller = context.getParentCallback(); + VolumeInfo volume = context.getVolume(); + PrimaryDataStore pd = context.getDataStore(); + + createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, pd, parentCaller); + return null; + } + + private class CreateVolumeFromBaseImageContext extends AsyncRpcConext { + private final VolumeObject vo; + public CreateVolumeFromBaseImageContext(AsyncCompletionCallback callback, VolumeObject vo) { + super(callback); + this.vo = vo; + } - createVolumeFromBaseImageAsync(volume, templateOnPrimaryStoreObj, pd, caller); + public VolumeObject getVolumeObject() { + return this.vo; + } } @DB - protected void createVolumeFromBaseImageAsync(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo templateOnPrimaryStore, PrimaryDataStore pd, AsyncCompletionCallback callback) { + protected void createVolumeFromBaseImageAsync(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo templateOnPrimaryStore, PrimaryDataStore pd, AsyncCompletionCallback callback) { VolumeObject vo = (VolumeObject) volume; try { vo.stateTransit(Volume.Event.CreateRequested); @@ -189,19 +220,17 @@ public class VolumeServiceImpl implements VolumeService { throw new CloudRuntimeException(e.toString()); } - - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this) - .setParentCallback(callback) - .setOperationName("volumeservice.createVolumeFromBaseImageCallback") - .setContextParam("volume", vo); + CreateVolumeFromBaseImageContext context = new CreateVolumeFromBaseImageContext(callback, vo); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().createVolumeFromBaseImageCallback(null, null)) + .setContext(context); pd.createVoluemFromBaseImageAsync(volume, templateOnPrimaryStore, caller); } @DB - @AsyncCallbackHandler(operationName="volumeservice.createVolumeFromBaseImageCallback") - public void createVolumeFromBaseImageCallback(AsyncCallbackDispatcher callback) { - VolumeObject vo = callback.getContextParam("volume"); + public Object createVolumeFromBaseImageCallback(AsyncCallbackDispatcher callback, CreateVolumeFromBaseImageContext context) { + VolumeObject vo = context.getVolumeObject(); CommandResult result = callback.getResult(); if (result.isSuccess()) { vo.stateTransit(Volume.Event.OperationSucceeded); @@ -209,16 +238,9 @@ public class VolumeServiceImpl implements VolumeService { vo.stateTransit(Volume.Event.OperationFailed); } - AsyncCallbackDispatcher parentCall = callback.getParentCallback(); - parentCall.complete(vo); - } - - @DB - @AsyncCallbackHandler(operationName="volumeservice.createvolumefrombaseimage.callback") - public void createVolumeFromBaseImageAsyncCallback(AsyncCallbackDispatcher callback) { - AsyncCallbackDispatcher parentCall = callback.getParentCallback(); - VolumeObject vo = callback.getResult(); + AsyncCompletionCallback parentCall = context.getParentCallback(); parentCall.complete(vo); + return null; } @DB @@ -230,12 +252,8 @@ public class VolumeServiceImpl implements VolumeService { createBaseImageAsync(volume, pd, template, callback); return; } - - AsyncCallbackDispatcher caller = new AsyncCallbackDispatcher(this) - .setParentCallback(callback) - .setOperationName("volumeservice.createvolumefrombaseimage.callback"); - createVolumeFromBaseImageAsync(volume, templateOnPrimaryStore, pd, caller); + createVolumeFromBaseImageAsync(volume, templateOnPrimaryStore, pd, callback); } @Override diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java new file mode 100644 index 00000000000..102364c932c --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java @@ -0,0 +1,30 @@ +/* + * 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.framework.async; + +public class AsyncRpcConext { + protected final AsyncCompletionCallback parentCallBack; + public AsyncRpcConext(AsyncCompletionCallback callback) { + this.parentCallBack = callback; + } + + public AsyncCompletionCallback getParentCallback() { + return this.parentCallBack; + } +} diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index a0066c88fc9..611913a823f 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -47,6 +47,7 @@ import javax.ejb.Local; import javax.naming.ConfigurationException; import javax.xml.parsers.DocumentBuilderFactory; +import org.apache.cloudstack.storage.command.StorageSubSystemCommand; import org.apache.log4j.Logger; import org.apache.xmlrpc.XmlRpcException; import org.w3c.dom.Document; @@ -559,8 +560,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return execute((Site2SiteVpnCfgCommand) cmd); } else if (clazz == CheckS2SVpnConnectionsCommand.class) { return execute((CheckS2SVpnConnectionsCommand) cmd); - } else if (clazz == StorageCommand.class) { - return this.storageResource.handleStorageCommands((StorageCommand)cmd); + } else if (cmd instanceof StorageSubSystemCommand) { + return this.storageResource.handleStorageCommands((StorageSubSystemCommand)cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } 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 b80b5d923c0..435734c6413 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 @@ -67,6 +67,7 @@ public class XenServerStorageResource { } private long getTemplateSize(String url) { + /* HttpGet method = new HttpGet(url); HttpClient client = new HttpClient(); try { @@ -82,6 +83,8 @@ public class XenServerStorageResource { // TODO Auto-generated catch block e.printStackTrace(); } + */ + return 0; } protected Answer directDownloadHttpTemplate(TemplateTO template, PrimaryDataStoreTO primarDataStore) { @@ -131,6 +134,7 @@ public class XenServerStorageResource { // TODO Auto-generated catch block e.printStackTrace(); } + return null; } protected Answer execute(CopyTemplateToPrimaryStorageCmd cmd) {