Search in sources :

Example 1 with SecondaryStorageResourceHandler

use of org.apache.cloudstack.storage.resource.SecondaryStorageResourceHandler in project cloudstack by apache.

the class PremiumSecondaryStorageResource method executeRequest.

@Override
public Answer executeRequest(Command cmd) {
    String hypervisor = cmd.getContextParam("hypervisor");
    if (hypervisor != null) {
        Hypervisor.HypervisorType hypervisorType = Hypervisor.HypervisorType.getType(hypervisor);
        if (hypervisorType == null) {
            s_logger.error("Unsupported hypervisor type in command context, hypervisor: " + hypervisor);
            return defaultAction(cmd);
        }
        SecondaryStorageResourceHandler handler = getHandler(hypervisorType);
        if (handler == null) {
            s_logger.error("No handler can be found for hypervisor type in command context, hypervisor: " + hypervisor);
            return defaultAction(cmd);
        }
        return handler.executeRequest(cmd);
    }
    return defaultAction(cmd);
}
Also used : Hypervisor(com.cloud.hypervisor.Hypervisor) SecondaryStorageResourceHandler(org.apache.cloudstack.storage.resource.SecondaryStorageResourceHandler)

Aggregations

Hypervisor (com.cloud.hypervisor.Hypervisor)1 SecondaryStorageResourceHandler (org.apache.cloudstack.storage.resource.SecondaryStorageResourceHandler)1