mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix AddSecondaryStorageCmd to use CloudStack default secondary storage
store plugin.
This commit is contained in:
parent
ae14d4bab4
commit
86a3840412
@ -38,6 +38,7 @@ import com.cloud.exception.ResourceInUseException;
|
|||||||
import com.cloud.host.Host;
|
import com.cloud.host.Host;
|
||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.org.Cluster;
|
import com.cloud.org.Cluster;
|
||||||
|
import com.cloud.storage.ObjectStore;
|
||||||
import com.cloud.storage.S3;
|
import com.cloud.storage.S3;
|
||||||
import com.cloud.storage.Swift;
|
import com.cloud.storage.Swift;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
@ -101,6 +102,9 @@ public interface ResourceService {
|
|||||||
|
|
||||||
S3 discoverS3(AddS3Cmd cmd) throws DiscoveryException;
|
S3 discoverS3(AddS3Cmd cmd) throws DiscoveryException;
|
||||||
|
|
||||||
|
ObjectStore discoverObjectStore(AddSecondaryStorageCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
|
||||||
|
|
||||||
|
|
||||||
List<HypervisorType> getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
|
List<HypervisorType> getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
|
||||||
|
|
||||||
Pair<List<? extends Swift>, Integer> listSwifts(ListSwiftsCmd cmd);
|
Pair<List<? extends Swift>, Integer> listSwifts(ListSwiftsCmd cmd);
|
||||||
|
|||||||
51
api/src/com/cloud/storage/ObjectStore.java
Normal file
51
api/src/com/cloud/storage/ObjectStore.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// 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.storage;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.Identity;
|
||||||
|
import org.apache.cloudstack.api.InternalIdentity;
|
||||||
|
|
||||||
|
public interface ObjectStore extends Identity, InternalIdentity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the object store.
|
||||||
|
*/
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return availability zone.
|
||||||
|
*/
|
||||||
|
Long getDataCenterId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return region id.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long getRegionId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return object store provider name
|
||||||
|
*/
|
||||||
|
String getProviderName();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return data store protocol
|
||||||
|
*/
|
||||||
|
String getProtocol();
|
||||||
|
}
|
||||||
@ -16,7 +16,7 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
package com.cloud.storage;
|
||||||
|
|
||||||
public enum ScopeType {
|
public enum ScopeType {
|
||||||
HOST,
|
HOST,
|
||||||
@ -326,6 +326,8 @@ public interface ResponseGenerator {
|
|||||||
|
|
||||||
RegionResponse createRegionResponse(Region region);
|
RegionResponse createRegionResponse(Region region);
|
||||||
|
|
||||||
|
ObjectStoreResponse createObjectStoreResponse(ObjectStore os);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param resourceTag
|
* @param resourceTag
|
||||||
* @param keyValueOnly TODO
|
* @param keyValueOnly TODO
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
package org.apache.cloudstack.api.command.admin.host;
|
package org.apache.cloudstack.api.command.admin.host;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.cloudstack.api.APICommand;
|
import org.apache.cloudstack.api.APICommand;
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
@ -24,12 +25,16 @@ import org.apache.cloudstack.api.ApiErrorCode;
|
|||||||
import org.apache.cloudstack.api.BaseCmd;
|
import org.apache.cloudstack.api.BaseCmd;
|
||||||
import org.apache.cloudstack.api.Parameter;
|
import org.apache.cloudstack.api.Parameter;
|
||||||
import org.apache.cloudstack.api.ServerApiException;
|
import org.apache.cloudstack.api.ServerApiException;
|
||||||
|
import org.apache.cloudstack.api.BaseCmd.CommandType;
|
||||||
import org.apache.cloudstack.api.response.HostResponse;
|
import org.apache.cloudstack.api.response.HostResponse;
|
||||||
|
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||||
|
import org.apache.cloudstack.api.response.RegionResponse;
|
||||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.exception.DiscoveryException;
|
import com.cloud.exception.DiscoveryException;
|
||||||
import com.cloud.host.Host;
|
import com.cloud.host.Host;
|
||||||
|
import com.cloud.storage.ObjectStore;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
|
|
||||||
@APICommand(name = "addSecondaryStorage", description="Adds secondary storage.", responseObject=HostResponse.class)
|
@APICommand(name = "addSecondaryStorage", description="Adds secondary storage.", responseObject=HostResponse.class)
|
||||||
@ -48,6 +53,21 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||||||
description="the Zone ID for the secondary storage")
|
description="the Zone ID for the secondary storage")
|
||||||
private Long zoneId;
|
private Long zoneId;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.REGION_ID, type=CommandType.UUID, entityType=RegionResponse.class,
|
||||||
|
description="the Region ID for the secondary storage")
|
||||||
|
private Long regionId;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the secondary storage data store")
|
||||||
|
private Map details;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING,
|
||||||
|
required=false, description="the scope of the secondary storage data store: zone or region or global")
|
||||||
|
private String scope;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING,
|
||||||
|
required=false, description="the secondary storage store provider name")
|
||||||
|
private String imageProviderName;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -60,6 +80,23 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||||||
return zoneId;
|
return zoneId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getRegionId() {
|
||||||
|
return regionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map getDetails() {
|
||||||
|
return details;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScope() {
|
||||||
|
return this.scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImageProviderName() {
|
||||||
|
return this.imageProviderName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////// API Implementation///////////////////
|
/////////////// API Implementation///////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
@ -76,17 +113,14 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(){
|
public void execute(){
|
||||||
try {
|
try{
|
||||||
List<? extends Host> result = _resourceService.discoverHosts(this);
|
ObjectStore result = _resourceService.discoverObjectStore(this);
|
||||||
HostResponse hostResponse = null;
|
ObjectStoreResponse storeResponse = null;
|
||||||
if (result != null && result.size() > 0) {
|
if (result != null ) {
|
||||||
for (Host host : result) {
|
storeResponse = _responseGenerator.createObjectStoreResponse(result);
|
||||||
// There should only be one secondary storage host per add
|
storeResponse.setResponseName(getCommandName());
|
||||||
hostResponse = _responseGenerator.createHostResponse(host);
|
storeResponse.setObjectName("secondarystorage");
|
||||||
hostResponse.setResponseName(getCommandName());
|
this.setResponseObject(storeResponse);
|
||||||
hostResponse.setObjectName("secondarystorage");
|
|
||||||
this.setResponseObject(hostResponse);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,48 @@
|
|||||||
|
// 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.api.response;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.BaseResponse;
|
||||||
|
|
||||||
|
import com.cloud.serializer.Param;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
public class ObjectStoreDetailResponse extends BaseResponse {
|
||||||
|
@SerializedName("name") @Param(description="detail property name of the object store")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@SerializedName("value") @Param(description="detail property value of the object store")
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,156 @@
|
|||||||
|
// 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.api.response;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
|
import org.apache.cloudstack.api.BaseResponse;
|
||||||
|
import org.apache.cloudstack.api.EntityReference;
|
||||||
|
|
||||||
|
import com.cloud.serializer.Param;
|
||||||
|
import com.cloud.storage.ObjectStore;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
|
import com.cloud.storage.StoragePool;
|
||||||
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
@EntityReference(value=ObjectStore.class)
|
||||||
|
public class ObjectStoreResponse extends BaseResponse {
|
||||||
|
@SerializedName("id") @Param(description="the ID of the object store")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@SerializedName("zoneid") @Param(description="the Zone ID of the object store")
|
||||||
|
private String zoneId;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the object store")
|
||||||
|
private String zoneName;
|
||||||
|
|
||||||
|
@SerializedName("regionid") @Param(description="the Region ID of the object store")
|
||||||
|
private String regionId;
|
||||||
|
|
||||||
|
@SerializedName("regionname") @Param(description="the Region name of the object store")
|
||||||
|
private String regionName;
|
||||||
|
|
||||||
|
@SerializedName("name") @Param(description="the name of the object store")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@SerializedName("url") @Param(description="the url of the object store")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@SerializedName("providername") @Param(description="the provider name of the object store")
|
||||||
|
private String providerName;
|
||||||
|
|
||||||
|
@SerializedName("scope") @Param(description="the scope of the object store")
|
||||||
|
private ScopeType type;
|
||||||
|
|
||||||
|
@SerializedName("details") @Param(description="the details of the object store")
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getObjectId() {
|
||||||
|
return this.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoneId(String zoneId) {
|
||||||
|
this.zoneId = zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZoneName() {
|
||||||
|
return zoneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoneName(String zoneName) {
|
||||||
|
this.zoneName = zoneName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getRegionId() {
|
||||||
|
return regionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionId(String regionId) {
|
||||||
|
this.regionId = regionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegionName() {
|
||||||
|
return regionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionName(String regionName) {
|
||||||
|
this.regionName = regionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProviderName() {
|
||||||
|
return providerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProviderName(String providerName) {
|
||||||
|
this.providerName = providerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScopeType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(ScopeType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDetails() {
|
||||||
|
return details;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDetails(String details) {
|
||||||
|
this.details = details;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||||
|
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
|
|
||||||
|
|
||||||
public class ClusterScope extends AbstractScope {
|
public class ClusterScope extends AbstractScope {
|
||||||
private ScopeType type = ScopeType.CLUSTER;
|
private ScopeType type = ScopeType.CLUSTER;
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import com.cloud.utils.component.Manager;
|
|||||||
public interface DataStoreProviderManager extends Manager, DataStoreProviderApiService {
|
public interface DataStoreProviderManager extends Manager, DataStoreProviderApiService {
|
||||||
public DataStoreProvider getDataStoreProvider(String name);
|
public DataStoreProvider getDataStoreProvider(String name);
|
||||||
public DataStoreProvider getDefaultPrimaryDataStoreProvider();
|
public DataStoreProvider getDefaultPrimaryDataStoreProvider();
|
||||||
|
public DataStoreProvider getDefaultImageDataStoreProvider();
|
||||||
public List<DataStoreProvider> getDataStoreProviders();
|
public List<DataStoreProvider> getDataStoreProviders();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||||
|
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
|
|
||||||
|
|
||||||
public class HostScope extends AbstractScope {
|
public class HostScope extends AbstractScope {
|
||||||
private ScopeType type = ScopeType.HOST;
|
private ScopeType type = ScopeType.HOST;
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||||
|
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
|
|
||||||
public interface Scope {
|
public interface Scope {
|
||||||
public ScopeType getScopeType();
|
public ScopeType getScopeType();
|
||||||
public boolean isSameScope(Scope scope);
|
public boolean isSameScope(Scope scope);
|
||||||
|
|||||||
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cloudstack.engine.subsystem.api.storage;
|
package org.apache.cloudstack.engine.subsystem.api.storage;
|
||||||
|
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
|
|
||||||
|
|
||||||
public class ZoneScope extends AbstractScope {
|
public class ZoneScope extends AbstractScope {
|
||||||
private ScopeType type = ScopeType.ZONE;
|
private ScopeType type = ScopeType.ZONE;
|
||||||
|
|||||||
@ -20,8 +20,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
|
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -28,11 +28,11 @@ import javax.ejb.Local;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.cloud.host.Status;
|
import com.cloud.host.Status;
|
||||||
|
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
|
|
||||||
import com.cloud.utils.db.DB;
|
import com.cloud.utils.db.DB;
|
||||||
|
|||||||
@ -29,9 +29,9 @@ import javax.persistence.TableGenerator;
|
|||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
|
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|||||||
@ -99,7 +99,7 @@ public class ImageDataStoreImpl implements ImageDataStore {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Scope getScope() {
|
public Scope getScope() {
|
||||||
return new ZoneScope(imageDataStoreVO.getDcId());
|
return new ZoneScope(imageDataStoreVO.getDataCenterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -142,4 +142,33 @@ public class ImageDataStoreImpl implements ImageDataStore {
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return imageDataStoreVO.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getDataCenterId() {
|
||||||
|
return imageDataStoreVO.getDataCenterId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getRegionId() {
|
||||||
|
return imageDataStoreVO.getRegionId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProviderName() {
|
||||||
|
return imageDataStoreVO.getProviderName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProtocol() {
|
||||||
|
return imageDataStoreVO.getProtocol();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import junit.framework.Assert;
|
|||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
|
||||||
@ -55,6 +54,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
|||||||
import com.cloud.org.Cluster.ClusterType;
|
import com.cloud.org.Cluster.ClusterType;
|
||||||
import com.cloud.org.Managed.ManagedState;
|
import com.cloud.org.Managed.ManagedState;
|
||||||
import com.cloud.storage.DiskOfferingVO;
|
import com.cloud.storage.DiskOfferingVO;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StorageManager;
|
import com.cloud.storage.StorageManager;
|
||||||
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
|
|||||||
@ -40,7 +40,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ImageService;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ImageService;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
|
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
||||||
@ -74,6 +73,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
|||||||
import com.cloud.org.Cluster.ClusterType;
|
import com.cloud.org.Cluster.ClusterType;
|
||||||
import com.cloud.org.Managed.ManagedState;
|
import com.cloud.org.Managed.ManagedState;
|
||||||
import com.cloud.resource.ResourceState;
|
import com.cloud.resource.ResourceState;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.Storage.TemplateType;
|
import com.cloud.storage.Storage.TemplateType;
|
||||||
|
|||||||
@ -139,6 +139,12 @@ public class DataStoreProviderManagerImpl extends ManagerBase implements DataSto
|
|||||||
return this.getDataStoreProvider("cloudstack primary data store provider");
|
return this.getDataStoreProvider("cloudstack primary data store provider");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataStoreProvider getDefaultImageDataStoreProvider() {
|
||||||
|
return this.getDataStoreProvider("cloudstack image data store provider");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StorageProviderResponse> getDataStoreProviders(String type) {
|
public List<StorageProviderResponse> getDataStoreProviders(String type) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
|||||||
@ -31,7 +31,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
|
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
|
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
|
||||||
import org.apache.cloudstack.storage.HypervisorHostEndPoint;
|
import org.apache.cloudstack.storage.HypervisorHostEndPoint;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@ -40,6 +39,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.host.Status;
|
import com.cloud.host.Status;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.utils.db.DB;
|
import com.cloud.utils.db.DB;
|
||||||
import com.cloud.utils.db.SearchCriteria2;
|
import com.cloud.utils.db.SearchCriteria2;
|
||||||
import com.cloud.utils.db.SearchCriteriaService;
|
import com.cloud.utils.db.SearchCriteriaService;
|
||||||
|
|||||||
@ -26,7 +26,9 @@ import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
||||||
|
|
||||||
public interface ImageDataStore extends DataStore {
|
import com.cloud.storage.ObjectStore;
|
||||||
|
|
||||||
|
public interface ImageDataStore extends DataStore, ObjectStore {
|
||||||
TemplateInfo getTemplate(long templateId);
|
TemplateInfo getTemplate(long templateId);
|
||||||
VolumeInfo getVolume(long volumeId);
|
VolumeInfo getVolume(long volumeId);
|
||||||
SnapshotInfo getSnapshot(long snapshotId);
|
SnapshotInfo getSnapshot(long snapshotId);
|
||||||
|
|||||||
@ -22,11 +22,11 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.storage.image.db.ImageDataStoreDao;
|
import org.apache.cloudstack.storage.image.db.ImageDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
|
import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -44,6 +44,7 @@ public class ImageDataStoreHelper {
|
|||||||
store.setProviderName((String)params.get("providerName"));
|
store.setProviderName((String)params.get("providerName"));
|
||||||
store.setScope((ScopeType)params.get("scope"));
|
store.setScope((ScopeType)params.get("scope"));
|
||||||
store.setUuid((String)params.get("uuid"));
|
store.setUuid((String)params.get("uuid"));
|
||||||
|
store.setUrl((String)params.get("url"));
|
||||||
store = imageStoreDao.persist(store);
|
store = imageStoreDao.persist(store);
|
||||||
return store;
|
return store;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,11 +26,13 @@ import javax.persistence.Id;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.TableGenerator;
|
import javax.persistence.TableGenerator;
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
|
import com.cloud.storage.ObjectStore;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "image_data_store")
|
@Table(name = "image_data_store")
|
||||||
public class ImageDataStoreVO {
|
public class ImageDataStoreVO implements ObjectStore {
|
||||||
@Id
|
@Id
|
||||||
@TableGenerator(name = "image_data_store_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "image_data_store_seq", allocationSize = 1)
|
@TableGenerator(name = "image_data_store_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "image_data_store_seq", allocationSize = 1)
|
||||||
@Column(name = "id", nullable = false)
|
@Column(name = "id", nullable = false)
|
||||||
@ -45,12 +47,18 @@ public class ImageDataStoreVO {
|
|||||||
@Column(name = "protocol", nullable = false)
|
@Column(name = "protocol", nullable = false)
|
||||||
private String protocol;
|
private String protocol;
|
||||||
|
|
||||||
|
@Column(name = "url", nullable = false)
|
||||||
|
private String url;
|
||||||
|
|
||||||
@Column(name = "image_provider_name", nullable = false)
|
@Column(name = "image_provider_name", nullable = false)
|
||||||
private String providerName;
|
private String providerName;
|
||||||
|
|
||||||
@Column(name = "data_center_id")
|
@Column(name = "data_center_id")
|
||||||
private long dcId;
|
private long dcId;
|
||||||
|
|
||||||
|
@Column(name = "region_id")
|
||||||
|
private long regionId;
|
||||||
|
|
||||||
@Column(name = "scope")
|
@Column(name = "scope")
|
||||||
@Enumerated(value = EnumType.STRING)
|
@Enumerated(value = EnumType.STRING)
|
||||||
private ScopeType scope;
|
private ScopeType scope;
|
||||||
@ -84,14 +92,23 @@ public class ImageDataStoreVO {
|
|||||||
return this.protocol;
|
return this.protocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDcId(long dcId) {
|
public void setDataCenterId(long dcId) {
|
||||||
this.dcId = dcId;
|
this.dcId = dcId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getDcId() {
|
public Long getDataCenterId() {
|
||||||
return this.dcId;
|
return this.dcId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Long getRegionId() {
|
||||||
|
return regionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegionId(long regionId) {
|
||||||
|
this.regionId = regionId;
|
||||||
|
}
|
||||||
|
|
||||||
public ScopeType getScope() {
|
public ScopeType getScope() {
|
||||||
return this.scope;
|
return this.scope;
|
||||||
}
|
}
|
||||||
@ -107,4 +124,14 @@ public class ImageDataStoreVO {
|
|||||||
public String getUuid() {
|
public String getUuid() {
|
||||||
return this.uuid;
|
return this.uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
|
import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreParameters;
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreParameters;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd;
|
import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd;
|
||||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
@ -42,6 +41,7 @@ import com.cloud.alert.AlertManager;
|
|||||||
import com.cloud.capacity.Capacity;
|
import com.cloud.capacity.Capacity;
|
||||||
import com.cloud.capacity.CapacityVO;
|
import com.cloud.capacity.CapacityVO;
|
||||||
import com.cloud.capacity.dao.CapacityDao;
|
import com.cloud.capacity.dao.CapacityDao;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StorageManager;
|
import com.cloud.storage.StorageManager;
|
||||||
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.storage.StoragePoolHostVO;
|
import com.cloud.storage.StoragePoolHostVO;
|
||||||
|
|||||||
@ -35,7 +35,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreState
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
|
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
|
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
||||||
@ -49,6 +48,7 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StoragePoolHostVO;
|
import com.cloud.storage.StoragePoolHostVO;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
import com.cloud.storage.VMTemplateStoragePoolVO;
|
import com.cloud.storage.VMTemplateStoragePoolVO;
|
||||||
|
|||||||
@ -21,13 +21,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.deploy.DeploymentPlan;
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.vm.DiskProfile;
|
import com.cloud.vm.DiskProfile;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
|||||||
@ -16,6 +16,11 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package org.apache.cloudstack.storage.datastore.lifecycle;
|
package org.apache.cloudstack.storage.datastore.lifecycle;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -29,23 +34,88 @@ import org.apache.cloudstack.storage.image.datastore.ImageDataStoreProviderManag
|
|||||||
import org.apache.cloudstack.storage.image.db.ImageDataStoreDao;
|
import org.apache.cloudstack.storage.image.db.ImageDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
|
import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
|
||||||
import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle;
|
import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.agent.api.StoragePoolInfo;
|
import com.cloud.agent.api.StoragePoolInfo;
|
||||||
|
import com.cloud.exception.DiscoveryException;
|
||||||
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
|
import com.cloud.host.Host;
|
||||||
|
import com.cloud.host.HostVO;
|
||||||
|
import com.cloud.hypervisor.kvm.discoverer.KvmDummyResourceBase;
|
||||||
|
import com.cloud.resource.Discoverer;
|
||||||
|
import com.cloud.resource.ResourceListener;
|
||||||
|
import com.cloud.resource.ResourceManager;
|
||||||
|
import com.cloud.resource.ServerResource;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
|
import com.cloud.utils.UriUtils;
|
||||||
|
|
||||||
public class CloudStackImageDataStoreLifeCycle implements ImageDataStoreLifeCycle {
|
public class CloudStackImageDataStoreLifeCycle implements ImageDataStoreLifeCycle {
|
||||||
|
|
||||||
|
private static final Logger s_logger = Logger
|
||||||
|
.getLogger(CloudStackImageDataStoreLifeCycle.class);
|
||||||
|
@Inject
|
||||||
|
protected ResourceManager _resourceMgr;
|
||||||
@Inject
|
@Inject
|
||||||
protected ImageDataStoreDao imageStoreDao;
|
protected ImageDataStoreDao imageStoreDao;
|
||||||
@Inject
|
@Inject
|
||||||
ImageDataStoreHelper imageStoreHelper;
|
ImageDataStoreHelper imageStoreHelper;
|
||||||
@Inject
|
@Inject
|
||||||
ImageDataStoreProviderManager imageStoreMgr;
|
ImageDataStoreProviderManager imageStoreMgr;
|
||||||
|
|
||||||
|
protected List<? extends Discoverer> _discoverers;
|
||||||
|
public List<? extends Discoverer> getDiscoverers() {
|
||||||
|
return _discoverers;
|
||||||
|
}
|
||||||
|
public void setDiscoverers(List<? extends Discoverer> _discoverers) {
|
||||||
|
this._discoverers = _discoverers;
|
||||||
|
}
|
||||||
|
|
||||||
public CloudStackImageDataStoreLifeCycle() {
|
public CloudStackImageDataStoreLifeCycle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataStore initialize(Map<String, Object> dsInfos) {
|
public DataStore initialize(Map<String, Object> dsInfos) {
|
||||||
ImageDataStoreVO ids = imageStoreHelper.createImageDataStore(dsInfos);
|
|
||||||
|
Long dcId = (Long) dsInfos.get("zoneId");
|
||||||
|
String url = (String) dsInfos.get("url");
|
||||||
|
String providerName = (String)dsInfos.get("providerName");
|
||||||
|
|
||||||
|
s_logger.info("Trying to add a new host at " + url + " in data center " + dcId);
|
||||||
|
|
||||||
|
URI uri = null;
|
||||||
|
try {
|
||||||
|
uri = new URI(UriUtils.encodeURIComponent(url));
|
||||||
|
if (uri.getScheme() == null) {
|
||||||
|
throw new InvalidParameterValueException("uri.scheme is null "
|
||||||
|
+ url + ", add nfs:// as a prefix");
|
||||||
|
} else if (uri.getScheme().equalsIgnoreCase("nfs")) {
|
||||||
|
if (uri.getHost() == null || uri.getHost().equalsIgnoreCase("")
|
||||||
|
|| uri.getPath() == null
|
||||||
|
|| uri.getPath().equalsIgnoreCase("")) {
|
||||||
|
throw new InvalidParameterValueException(
|
||||||
|
"Your host and/or path is wrong. Make sure it's of the format nfs://hostname/path");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new InvalidParameterValueException(url
|
||||||
|
+ " is not a valid uri");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( dcId == null ){
|
||||||
|
throw new InvalidParameterValueException("DataCenter id is null, and cloudstack default image storehas to be associated with a data center");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> imageStoreParameters = new HashMap<String, Object>();
|
||||||
|
imageStoreParameters.put("name", url);
|
||||||
|
imageStoreParameters.put("zoneId", dcId);
|
||||||
|
imageStoreParameters.put("url", url);
|
||||||
|
imageStoreParameters.put("protocol", uri.getScheme().toLowerCase());
|
||||||
|
imageStoreParameters.put("scope", ScopeType.ZONE);
|
||||||
|
imageStoreParameters.put("providerName", providerName);
|
||||||
|
|
||||||
|
ImageDataStoreVO ids = imageStoreHelper.createImageDataStore(imageStoreParameters);
|
||||||
return imageStoreMgr.getImageDataStore(ids.getId());
|
return imageStoreMgr.getImageDataStore(ids.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
|
import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataStoreProvider;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataStoreProvider;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.storage.datastore.driver.CloudStackImageDataStoreDriverImpl;
|
import org.apache.cloudstack.storage.datastore.driver.CloudStackImageDataStoreDriverImpl;
|
||||||
import org.apache.cloudstack.storage.datastore.lifecycle.CloudStackImageDataStoreLifeCycle;
|
import org.apache.cloudstack.storage.datastore.lifecycle.CloudStackImageDataStoreLifeCycle;
|
||||||
import org.apache.cloudstack.storage.image.ImageDataStoreDriver;
|
import org.apache.cloudstack.storage.image.ImageDataStoreDriver;
|
||||||
@ -39,6 +38,7 @@ import org.apache.cloudstack.storage.image.datastore.ImageDataStoreProviderManag
|
|||||||
import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle;
|
import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.utils.component.ComponentContext;
|
import com.cloud.utils.component.ComponentContext;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|||||||
@ -35,7 +35,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreParameters;
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreParameters;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
|
||||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
@ -62,6 +61,7 @@ import com.cloud.resource.ResourceManager;
|
|||||||
import com.cloud.server.ManagementServer;
|
import com.cloud.server.ManagementServer;
|
||||||
import com.cloud.storage.OCFS2Manager;
|
import com.cloud.storage.OCFS2Manager;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StorageManager;
|
import com.cloud.storage.StorageManager;
|
||||||
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.storage.StoragePoolAutomation;
|
import com.cloud.storage.StoragePoolAutomation;
|
||||||
|
|||||||
@ -80,6 +80,7 @@ import org.apache.cloudstack.api.response.NetworkOfferingResponse;
|
|||||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||||
import org.apache.cloudstack.api.response.NicResponse;
|
import org.apache.cloudstack.api.response.NicResponse;
|
||||||
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
|
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
|
||||||
|
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||||
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
||||||
import org.apache.cloudstack.api.response.PodResponse;
|
import org.apache.cloudstack.api.response.PodResponse;
|
||||||
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
|
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
|
||||||
@ -235,6 +236,7 @@ import com.cloud.service.ServiceOfferingVO;
|
|||||||
import com.cloud.storage.DiskOfferingVO;
|
import com.cloud.storage.DiskOfferingVO;
|
||||||
import com.cloud.storage.GuestOS;
|
import com.cloud.storage.GuestOS;
|
||||||
import com.cloud.storage.GuestOSCategoryVO;
|
import com.cloud.storage.GuestOSCategoryVO;
|
||||||
|
import com.cloud.storage.ObjectStore;
|
||||||
import com.cloud.storage.S3;
|
import com.cloud.storage.S3;
|
||||||
import com.cloud.storage.Snapshot;
|
import com.cloud.storage.Snapshot;
|
||||||
import com.cloud.storage.SnapshotVO;
|
import com.cloud.storage.SnapshotVO;
|
||||||
@ -887,6 +889,15 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectStoreResponse createObjectStoreResponse(ObjectStore os) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities) {
|
public ClusterResponse createClusterResponse(Cluster cluster, Boolean showCapacities) {
|
||||||
ClusterResponse clusterResponse = new ClusterResponse();
|
ClusterResponse clusterResponse = new ClusterResponse();
|
||||||
|
|||||||
@ -45,6 +45,17 @@ import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
|
|||||||
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
|
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
|
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
|
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
|
||||||
|
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
|
||||||
|
import org.apache.cloudstack.region.RegionVO;
|
||||||
|
import org.apache.cloudstack.region.dao.RegionDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@ -107,8 +118,10 @@ import com.cloud.org.Grouping.AllocationState;
|
|||||||
import com.cloud.org.Managed;
|
import com.cloud.org.Managed;
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
import com.cloud.storage.GuestOSCategoryVO;
|
import com.cloud.storage.GuestOSCategoryVO;
|
||||||
|
import com.cloud.storage.ObjectStore;
|
||||||
import com.cloud.storage.S3;
|
import com.cloud.storage.S3;
|
||||||
import com.cloud.storage.S3VO;
|
import com.cloud.storage.S3VO;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StorageManager;
|
import com.cloud.storage.StorageManager;
|
||||||
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.storage.StoragePoolHostVO;
|
import com.cloud.storage.StoragePoolHostVO;
|
||||||
@ -167,7 +180,10 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||||||
StorageManager _storageMgr;
|
StorageManager _storageMgr;
|
||||||
@Inject
|
@Inject
|
||||||
protected SecondaryStorageVmManager _secondaryStorageMgr;
|
protected SecondaryStorageVmManager _secondaryStorageMgr;
|
||||||
|
@Inject
|
||||||
|
DataStoreProviderManager _dataStoreProviderMgr;
|
||||||
|
@Inject
|
||||||
|
protected RegionDao _regionDao;
|
||||||
@Inject
|
@Inject
|
||||||
protected DataCenterDao _dcDao;
|
protected DataCenterDao _dcDao;
|
||||||
@Inject
|
@Inject
|
||||||
@ -206,6 +222,9 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||||||
protected HighAvailabilityManager _haMgr;
|
protected HighAvailabilityManager _haMgr;
|
||||||
@Inject
|
@Inject
|
||||||
protected StorageService _storageSvr;
|
protected StorageService _storageSvr;
|
||||||
|
@Inject
|
||||||
|
DataStoreManager _dataStoreMgr;
|
||||||
|
|
||||||
|
|
||||||
protected List<? extends Discoverer> _discoverers;
|
protected List<? extends Discoverer> _discoverers;
|
||||||
public List<? extends Discoverer> getDiscoverers() {
|
public List<? extends Discoverer> getDiscoverers() {
|
||||||
@ -639,6 +658,10 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||||||
return discoverHostsFull(dcId, podId, clusterId, clusterName, url, username, password, cmd.getHypervisor(), hostTags, cmd.getFullUrlParams(), true);
|
return discoverHostsFull(dcId, podId, clusterId, clusterName, url, username, password, cmd.getHypervisor(), hostTags, cmd.getFullUrlParams(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Host> discoverHosts(AddSecondaryStorageCmd cmd)
|
public List<? extends Host> discoverHosts(AddSecondaryStorageCmd cmd)
|
||||||
throws IllegalArgumentException, DiscoveryException,
|
throws IllegalArgumentException, DiscoveryException,
|
||||||
@ -669,6 +692,96 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
|
|||||||
return this._s3Mgr.listS3s(cmd);
|
return this._s3Mgr.listS3s(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectStore discoverObjectStore(AddSecondaryStorageCmd cmd) throws IllegalArgumentException, DiscoveryException,
|
||||||
|
InvalidParameterValueException {
|
||||||
|
String providerName = cmd.getImageProviderName();
|
||||||
|
DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(providerName);
|
||||||
|
|
||||||
|
if (storeProvider == null) {
|
||||||
|
storeProvider = _dataStoreProviderMgr.getDefaultImageDataStoreProvider();
|
||||||
|
if (storeProvider == null) {
|
||||||
|
throw new InvalidParameterValueException(
|
||||||
|
"can't find image store provider: " + providerName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Long dcId = cmd.getZoneId();
|
||||||
|
Long regionId = cmd.getRegionId();
|
||||||
|
String url = cmd.getUrl();
|
||||||
|
Map details = cmd.getDetails();
|
||||||
|
|
||||||
|
ScopeType scopeType = ScopeType.ZONE;
|
||||||
|
String scope = cmd.getScope();
|
||||||
|
if (scope != null) {
|
||||||
|
try {
|
||||||
|
scopeType = Enum.valueOf(ScopeType.class, scope.toUpperCase());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new InvalidParameterValueException("invalid scope"
|
||||||
|
+ scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scopeType == ScopeType.ZONE && dcId == null) {
|
||||||
|
throw new InvalidParameterValueException(
|
||||||
|
"zone id can't be null, if scope is zone");
|
||||||
|
} else if (scopeType == ScopeType.REGION && regionId == null) {
|
||||||
|
throw new InvalidParameterValueException(
|
||||||
|
"region id can't be null, if scope is region");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( dcId != null ){
|
||||||
|
// Check if the zone exists in the system
|
||||||
|
DataCenterVO zone = _dcDao.findById(dcId);
|
||||||
|
if (zone == null) {
|
||||||
|
throw new InvalidParameterValueException("Can't find zone by id "
|
||||||
|
+ dcId);
|
||||||
|
}
|
||||||
|
|
||||||
|
Account account = UserContext.current().getCaller();
|
||||||
|
if (Grouping.AllocationState.Disabled == zone.getAllocationState()
|
||||||
|
&& !_accountMgr.isRootAdmin(account.getType())) {
|
||||||
|
PermissionDeniedException ex = new PermissionDeniedException(
|
||||||
|
"Cannot perform this operation, Zone with specified id is currently disabled");
|
||||||
|
ex.addProxyObject(zone, dcId, "dcId");
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( regionId != null ){
|
||||||
|
// Check if the region exists in the system
|
||||||
|
RegionVO region = _regionDao.findById(regionId.intValue());
|
||||||
|
if (region == null) {
|
||||||
|
throw new InvalidParameterValueException("Can't find region by id "
|
||||||
|
+ regionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put("zoneId", dcId);
|
||||||
|
params.put("regionId", regionId);
|
||||||
|
params.put("url", cmd.getUrl());
|
||||||
|
params.put("name", cmd.getUrl());
|
||||||
|
params.put("details", details);
|
||||||
|
params.put("providerName", storeProvider.getName());
|
||||||
|
|
||||||
|
DataStoreLifeCycle lifeCycle = storeProvider.getDataStoreLifeCycle();
|
||||||
|
DataStore store = null;
|
||||||
|
try {
|
||||||
|
store = lifeCycle.initialize(params);
|
||||||
|
|
||||||
|
if (scopeType == ScopeType.ZONE) {
|
||||||
|
ZoneScope zoneScope = new ZoneScope(dcId);
|
||||||
|
lifeCycle.attachZone(store, zoneScope);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
s_logger.debug("Failed to add data store", e);
|
||||||
|
throw new CloudRuntimeException("Failed to add data store", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (ObjectStore)_dataStoreMgr.getDataStore(store.getId(),
|
||||||
|
DataStoreRole.Image);
|
||||||
|
}
|
||||||
|
|
||||||
private List<HostVO> discoverHostsFull(Long dcId, Long podId, Long clusterId, String clusterName, String url, String username, String password, String hypervisorType, List<String> hostTags,
|
private List<HostVO> discoverHostsFull(Long dcId, Long podId, Long clusterId, String clusterName, String url, String username, String password, String hypervisorType, List<String> hostTags,
|
||||||
Map<String, String> params, boolean deferAgentCreation) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException {
|
Map<String, String> params, boolean deferAgentCreation) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException {
|
||||||
URI uri = null;
|
URI uri = null;
|
||||||
|
|||||||
@ -55,7 +55,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
|
import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
|
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
|
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
|
||||||
|
|||||||
@ -49,7 +49,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
|
|||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
|
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
|
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
|
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|
||||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
@ -38,6 +37,7 @@ import com.cloud.host.Status;
|
|||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.OCFS2Manager;
|
import com.cloud.storage.OCFS2Manager;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
|
import com.cloud.storage.ScopeType;
|
||||||
import com.cloud.storage.StorageManagerImpl;
|
import com.cloud.storage.StorageManagerImpl;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
|||||||
import com.cloud.org.Cluster;
|
import com.cloud.org.Cluster;
|
||||||
import com.cloud.resource.ResourceState.Event;
|
import com.cloud.resource.ResourceState.Event;
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
|
import com.cloud.storage.ObjectStore;
|
||||||
import com.cloud.storage.S3;
|
import com.cloud.storage.S3;
|
||||||
import com.cloud.storage.Swift;
|
import com.cloud.storage.Swift;
|
||||||
import com.cloud.template.VirtualMachineTemplate;
|
import com.cloud.template.VirtualMachineTemplate;
|
||||||
@ -608,4 +609,12 @@ public class MockResourceManagerImpl extends ManagerBase implements ResourceMana
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObjectStore discoverObjectStore(AddSecondaryStorageCmd cmd) throws IllegalArgumentException, DiscoveryException,
|
||||||
|
InvalidParameterValueException {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,7 +73,9 @@ CREATE TABLE `cloud`.`image_data_store` (
|
|||||||
`name` varchar(255) NOT NULL COMMENT 'name of data store',
|
`name` varchar(255) NOT NULL COMMENT 'name of data store',
|
||||||
`image_provider_name` varchar(255) NOT NULL COMMENT 'id of image_data_store_provider',
|
`image_provider_name` varchar(255) NOT NULL COMMENT 'id of image_data_store_provider',
|
||||||
`protocol` varchar(255) NOT NULL COMMENT 'protocol of data store',
|
`protocol` varchar(255) NOT NULL COMMENT 'protocol of data store',
|
||||||
|
`url` varchar(255) COMMENT 'url for image data store',
|
||||||
`data_center_id` bigint unsigned COMMENT 'datacenter id of data store',
|
`data_center_id` bigint unsigned COMMENT 'datacenter id of data store',
|
||||||
|
`region_id` bigint unsigned COMMENT 'region id of data store',
|
||||||
`scope` varchar(255) COMMENT 'scope of data store',
|
`scope` varchar(255) COMMENT 'scope of data store',
|
||||||
`uuid` varchar(255) COMMENT 'uuid of data store',
|
`uuid` varchar(255) COMMENT 'uuid of data store',
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user