Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 26F0B200B2C for ; Tue, 24 May 2016 11:49:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 256C7160A2F; Tue, 24 May 2016 09:49:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E913A160A11 for ; Tue, 24 May 2016 11:49:10 +0200 (CEST) Received: (qmail 721 invoked by uid 500); 24 May 2016 09:49:07 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 99816 invoked by uid 99); 24 May 2016 09:49:07 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 May 2016 09:49:07 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 63DA9E108B; Tue, 24 May 2016 09:49:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dahn@apache.org To: commits@cloudstack.apache.org Date: Tue, 24 May 2016 09:49:20 -0000 Message-Id: <53140e4b62994ac59847f718fb3f8caa@git.apache.org> In-Reply-To: <9f6d5bfbd239492394945380f6b96af9@git.apache.org> References: <9f6d5bfbd239492394945380f6b96af9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/48] git commit: updated refs/heads/4.9-bountycastle-daan to 98bf0ca archived-at: Tue, 24 May 2016 09:49:13 -0000 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/admin/solidfire/GetVolumeiScsiNameCmd.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/admin/solidfire/GetVolumeiScsiNameCmd.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/admin/solidfire/GetVolumeiScsiNameCmd.java new file mode 100644 index 0000000..dd6992c --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/admin/solidfire/GetVolumeiScsiNameCmd.java @@ -0,0 +1,68 @@ +// 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.command.admin.solidfire; + +import javax.inject.Inject; + +import org.apache.log4j.Logger; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.solidfire.ApiVolumeiScsiNameResponse; +import org.apache.cloudstack.util.solidfire.SolidFireIntegrationTestUtil; + +@APICommand(name = "getVolumeiScsiName", responseObject = ApiVolumeiScsiNameResponse.class, description = "Get Volume's iSCSI Name", + requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) + +public class GetVolumeiScsiNameCmd extends BaseCmd { + private static final Logger LOGGER = Logger.getLogger(GetVolumeiScsiNameCmd.class.getName()); + private static final String NAME = "getvolumeiscsinameresponse"; + + @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.STRING, description = "CloudStack Volume UUID", required = true) + private String volumeUuid; + + @Inject private SolidFireIntegrationTestUtil _util; + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return NAME; + } + + @Override + public long getEntityOwnerId() { + return _util.getAccountIdForVolumeUuid(volumeUuid); + } + + @Override + public void execute() { + LOGGER.info("'GetVolumeiScsiNameCmd.execute' method invoked"); + + String volume_iScsiName = _util.getVolume_iScsiName(volumeUuid); + + ApiVolumeiScsiNameResponse response = new ApiVolumeiScsiNameResponse(volume_iScsiName); + + response.setResponseName(getCommandName()); + response.setObjectName("apivolumeiscsiname"); + + this.setResponseObject(response); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireAccountIdCmd.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireAccountIdCmd.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireAccountIdCmd.java deleted file mode 100644 index f4c0076..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireAccountIdCmd.java +++ /dev/null @@ -1,83 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.api.command.user.solidfire; - -import com.cloud.user.Account; -import com.cloud.user.dao.AccountDao; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.ApiSolidFireAccountIdResponse; -import org.apache.cloudstack.context.CallContext; -import org.apache.cloudstack.solidfire.ApiSolidFireService; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; -import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; - -@APICommand(name = "getSolidFireAccountId", responseObject = ApiSolidFireAccountIdResponse.class, description = "Get SolidFire Account ID", - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class GetSolidFireAccountIdCmd extends BaseCmd { - private static final Logger s_logger = Logger.getLogger(GetSolidFireAccountIdCmd.class.getName()); - private static final String s_name = "getsolidfireaccountidresponse"; - - @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.STRING, description = "CloudStack Account UUID", required = true) - private String accountUuid; - @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.STRING, description = "Storage Pool UUID", required = true) - private String storagePoolUuid; - - @Inject private ApiSolidFireService _apiSolidFireService; - @Inject private AccountDao _accountDao; - @Inject private PrimaryDataStoreDao _storagePoolDao; - - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - - @Override - public String getCommandName() { - return s_name; - } - - @Override - public long getEntityOwnerId() { - Account account = CallContext.current().getCallingAccount(); - - if (account != null) { - return account.getId(); - } - - return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked - } - - @Override - public void execute() { - Account account = _accountDao.findByUuid(accountUuid); - StoragePoolVO storagePool = _storagePoolDao.findByUuid(storagePoolUuid); - - ApiSolidFireAccountIdResponse response = _apiSolidFireService.getSolidFireAccountId(account.getId(), storagePool.getId()); - - response.setResponseName(getCommandName()); - response.setObjectName("apisolidfireaccountid"); - - this.setResponseObject(response); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeAccessGroupIdCmd.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeAccessGroupIdCmd.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeAccessGroupIdCmd.java deleted file mode 100644 index c432fb1..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeAccessGroupIdCmd.java +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.api.command.user.solidfire; - -import com.cloud.user.Account; -import com.cloud.org.Cluster; -import com.cloud.storage.StoragePool; -import com.cloud.dc.dao.ClusterDao; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeAccessGroupIdResponse; -import org.apache.cloudstack.context.CallContext; -import org.apache.cloudstack.solidfire.ApiSolidFireService; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; - -@APICommand(name = "getSolidFireVolumeAccessGroupId", responseObject = ApiSolidFireVolumeAccessGroupIdResponse.class, description = "Get the SF Volume Access Group ID", - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class GetSolidFireVolumeAccessGroupIdCmd extends BaseCmd { - private static final Logger s_logger = Logger.getLogger(GetSolidFireVolumeAccessGroupIdCmd.class.getName()); - private static final String s_name = "getsolidfirevolumeaccessgroupidresponse"; - - @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.STRING, description = "Cluster UUID", required = true) - private String clusterUuid; - @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.STRING, description = "Storage Pool UUID", required = true) - private String storagePoolUuid; - - @Inject private ApiSolidFireService _apiSolidFireService; - @Inject private ClusterDao _clusterDao; - @Inject private PrimaryDataStoreDao _storagePoolDao; - - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - - @Override - public String getCommandName() { - return s_name; - } - - @Override - public long getEntityOwnerId() { - Account account = CallContext.current().getCallingAccount(); - - if (account != null) { - return account.getId(); - } - - return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked - } - - @Override - public void execute() { - Cluster cluster = _clusterDao.findByUuid(clusterUuid); - StoragePool storagePool = _storagePoolDao.findByUuid(storagePoolUuid); - - ApiSolidFireVolumeAccessGroupIdResponse response = _apiSolidFireService.getSolidFireVolumeAccessGroupId(cluster.getId(), storagePool.getId()); - - response.setResponseName(getCommandName()); - response.setObjectName("apisolidfirevolumeaccessgroupid"); - - this.setResponseObject(response); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeIscsiNameCmd.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeIscsiNameCmd.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeIscsiNameCmd.java deleted file mode 100644 index 7afa301..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeIscsiNameCmd.java +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.api.command.user.solidfire; - -import com.cloud.storage.dao.VolumeDao; -import com.cloud.storage.Volume; -import com.cloud.user.Account; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeIscsiNameResponse; -import org.apache.cloudstack.context.CallContext; -import org.apache.cloudstack.solidfire.ApiSolidFireService; - -@APICommand(name = "getSolidFireVolumeIscsiName", responseObject = ApiSolidFireVolumeIscsiNameResponse.class, description = "Get SolidFire Volume's Iscsi Name", - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) - -public class GetSolidFireVolumeIscsiNameCmd extends BaseCmd { - private static final Logger s_logger = Logger.getLogger(GetSolidFireVolumeIscsiNameCmd.class.getName()); - private static final String s_name = "getsolidfirevolumeiscsinameresponse"; - - @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.STRING, description = "CloudStack Volume UUID", required = true) - private String volumeUuid; - - @Inject private ApiSolidFireService _apiSolidFireService; - @Inject private VolumeDao _volumeDao; - - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - - @Override - public String getCommandName() { - return s_name; - } - - @Override - public long getEntityOwnerId() { - Account account = CallContext.current().getCallingAccount(); - - if (account != null) { - return account.getId(); - } - - return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked - } - - @Override - public void execute() { - Volume volume = _volumeDao.findByUuid(volumeUuid); - - ApiSolidFireVolumeIscsiNameResponse response = _apiSolidFireService.getSolidFireVolumeIscsiName(volume); - - response.setResponseName(getCommandName()); - response.setObjectName("apisolidfirevolumeiscsiname"); - - this.setResponseObject(response); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeSizeCmd.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeSizeCmd.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeSizeCmd.java deleted file mode 100644 index 3a27a66..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/command/user/solidfire/GetSolidFireVolumeSizeCmd.java +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.api.command.user.solidfire; - -import com.cloud.storage.Volume; -import com.cloud.user.Account; -import com.cloud.storage.dao.VolumeDao; -import com.cloud.storage.StoragePool; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeSizeResponse; -import org.apache.cloudstack.context.CallContext; -import org.apache.cloudstack.solidfire.ApiSolidFireService; -import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; - -@APICommand(name = "getSolidFireVolumeSize", responseObject = ApiSolidFireVolumeSizeResponse.class, description = "Get the SF volume size including Hypervisor Snapshot Reserve", - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class GetSolidFireVolumeSizeCmd extends BaseCmd { - private static final Logger s_logger = Logger.getLogger(GetSolidFireVolumeSizeCmd.class.getName()); - private static final String s_name = "getsolidfirevolumesizeresponse"; - - @Parameter(name = ApiConstants.VOLUME_ID, type = CommandType.STRING, description = "Volume UUID", required = true) - private String volumeUuid; - @Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.STRING, description = "Storage Pool UUID", required = true) - private String storagePoolUuid; - - @Inject private ApiSolidFireService _apiSolidFireService; - @Inject private VolumeDao _volumeDao; - @Inject private PrimaryDataStoreDao _storagePoolDao; - - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - - @Override - public String getCommandName() { - return s_name; - } - - @Override - public long getEntityOwnerId() { - Account account = CallContext.current().getCallingAccount(); - - if (account != null) { - return account.getId(); - } - - return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked - } - - @Override - public void execute() { - Volume volume = _volumeDao.findByUuid(volumeUuid); - StoragePool storagePool = _storagePoolDao.findByUuid(storagePoolUuid); - - ApiSolidFireVolumeSizeResponse response = _apiSolidFireService.getSolidFireVolumeSize(volume, storagePool); - - response.setResponseName(getCommandName()); - response.setObjectName("apisolidfirevolumesize"); - - this.setResponseObject(response); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireAccountIdResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireAccountIdResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireAccountIdResponse.java deleted file mode 100644 index ad77c74..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireAccountIdResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.api.response; - -import com.cloud.serializer.Param; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.BaseResponse; - -public class ApiSolidFireAccountIdResponse extends BaseResponse { - @SerializedName("solidFireAccountId") - @Param(description = "SolidFire Account ID") - private long solidFireAccountId; - - public ApiSolidFireAccountIdResponse(long sfAccountId) { - solidFireAccountId = sfAccountId; - } - - public long getSolidFireAccountId() { - return solidFireAccountId; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeAccessGroupIdResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeAccessGroupIdResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeAccessGroupIdResponse.java deleted file mode 100644 index 8b63192..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeAccessGroupIdResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.api.response; - -import com.cloud.serializer.Param; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.BaseResponse; - -public class ApiSolidFireVolumeAccessGroupIdResponse extends BaseResponse { - @SerializedName("solidFireVolumeAccessGroupId") - @Param(description = "SolidFire Volume Access Group Id") - private long solidFireVolumeAccessGroupId; - - public ApiSolidFireVolumeAccessGroupIdResponse(long sfVolumeAccessGroupId) { - solidFireVolumeAccessGroupId = sfVolumeAccessGroupId; - } - - public long getSolidFireAccessGroupId() { - return solidFireVolumeAccessGroupId; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeIscsiNameResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeIscsiNameResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeIscsiNameResponse.java deleted file mode 100644 index 517cba9..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeIscsiNameResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.api.response; - -import com.cloud.serializer.Param; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.BaseResponse; - -public class ApiSolidFireVolumeIscsiNameResponse extends BaseResponse { - @SerializedName("solidFireVolumeIscsiName") - @Param(description = "SolidFire Volume Iscsi Name") - private String solidFireVolumeIscsiName; - - public ApiSolidFireVolumeIscsiNameResponse(String sfVolumeIscsiName) { - solidFireVolumeIscsiName = sfVolumeIscsiName; - } - - public String getSolidFireVolumeIscsiName() { - return solidFireVolumeIscsiName; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeSizeResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeSizeResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeSizeResponse.java deleted file mode 100644 index b320ada..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/ApiSolidFireVolumeSizeResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.api.response; - -import com.cloud.serializer.Param; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.BaseResponse; - -public class ApiSolidFireVolumeSizeResponse extends BaseResponse { - @SerializedName("solidFireVolumeSize") - @Param(description = "SolidFire Volume Size Including Hypervisor Snapshot Reserve") - private long solidFireVolumeSize; - - public ApiSolidFireVolumeSizeResponse(long sfVolumeSize) { - solidFireVolumeSize = sfVolumeSize; - } - - public long getSolidFireVolumeSize() { - return solidFireVolumeSize; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiPathForVolumeResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiPathForVolumeResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiPathForVolumeResponse.java new file mode 100644 index 0000000..3e0f820 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiPathForVolumeResponse.java @@ -0,0 +1,33 @@ +// 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.solidfire; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class ApiPathForVolumeResponse extends BaseResponse { + @SerializedName(ApiConstants.PATH) + @Param(description = "The path field for the volume") + private String path; + + public ApiPathForVolumeResponse(String path) { + this.path = path; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireAccountIdResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireAccountIdResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireAccountIdResponse.java new file mode 100644 index 0000000..a1c2a4c --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireAccountIdResponse.java @@ -0,0 +1,33 @@ +// 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.solidfire; + +import com.cloud.serializer.Param; + +import com.google.gson.annotations.SerializedName; + +import org.apache.cloudstack.api.BaseResponse; + +public class ApiSolidFireAccountIdResponse extends BaseResponse { + @SerializedName("solidFireAccountId") + @Param(description = "SolidFire Account ID") + private long solidFireAccountId; + + public ApiSolidFireAccountIdResponse(long sfAccountId) { + solidFireAccountId = sfAccountId; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireVolumeAccessGroupIdResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireVolumeAccessGroupIdResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireVolumeAccessGroupIdResponse.java new file mode 100644 index 0000000..202a7e9 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireVolumeAccessGroupIdResponse.java @@ -0,0 +1,33 @@ +// 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.solidfire; + +import com.cloud.serializer.Param; + +import com.google.gson.annotations.SerializedName; + +import org.apache.cloudstack.api.BaseResponse; + +public class ApiSolidFireVolumeAccessGroupIdResponse extends BaseResponse { + @SerializedName("solidFireVolumeAccessGroupId") + @Param(description = "SolidFire Volume Access Group Id") + private long solidFireVolumeAccessGroupId; + + public ApiSolidFireVolumeAccessGroupIdResponse(long sfVolumeAccessGroupId) { + solidFireVolumeAccessGroupId = sfVolumeAccessGroupId; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireVolumeSizeResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireVolumeSizeResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireVolumeSizeResponse.java new file mode 100644 index 0000000..d8a7d04 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiSolidFireVolumeSizeResponse.java @@ -0,0 +1,33 @@ +// 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.solidfire; + +import com.cloud.serializer.Param; + +import com.google.gson.annotations.SerializedName; + +import org.apache.cloudstack.api.BaseResponse; + +public class ApiSolidFireVolumeSizeResponse extends BaseResponse { + @SerializedName("solidFireVolumeSize") + @Param(description = "SolidFire Volume Size Including Hypervisor Snapshot Reserve") + private long solidFireVolumeSize; + + public ApiSolidFireVolumeSizeResponse(long sfVolumeSize) { + solidFireVolumeSize = sfVolumeSize; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiVolumeSnapshotDetailsResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiVolumeSnapshotDetailsResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiVolumeSnapshotDetailsResponse.java new file mode 100644 index 0000000..364ded8 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiVolumeSnapshotDetailsResponse.java @@ -0,0 +1,43 @@ +// 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.solidfire; + +import com.cloud.serializer.Param; + +import com.google.gson.annotations.SerializedName; + +import org.apache.cloudstack.api.BaseResponse; + +public class ApiVolumeSnapshotDetailsResponse extends BaseResponse { + @SerializedName("volumeSnapshotId") + @Param(description = "CloudStack Volume Snapshot ID") + private long volumeSnapshotId; + + @SerializedName("snapshotDetailsName") + @Param(description = "Snapshot Details Name") + private String volumeSnapshotDetailsName; + + @SerializedName("snapshotDetailsValue") + @Param(description = "Snapshot Details Value") + private String volumeSnapshotDetailsValue; + + public ApiVolumeSnapshotDetailsResponse(long volumeSnapshotId, String volumeSnapshotDetailsName, String volumeSnapshotDetailsValue) { + this.volumeSnapshotId = volumeSnapshotId; + this.volumeSnapshotDetailsName = volumeSnapshotDetailsName; + this.volumeSnapshotDetailsValue = volumeSnapshotDetailsValue; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiVolumeiScsiNameResponse.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiVolumeiScsiNameResponse.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiVolumeiScsiNameResponse.java new file mode 100644 index 0000000..f43e533 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/response/solidfire/ApiVolumeiScsiNameResponse.java @@ -0,0 +1,33 @@ +// 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.solidfire; + +import com.cloud.serializer.Param; + +import com.google.gson.annotations.SerializedName; + +import org.apache.cloudstack.api.BaseResponse; + +public class ApiVolumeiScsiNameResponse extends BaseResponse { + @SerializedName("volumeiScsiName") + @Param(description = "Volume iSCSI Name") + private String volumeiScsiName; + + public ApiVolumeiScsiNameResponse(String volumeiScsiName) { + this.volumeiScsiName = volumeiScsiName; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/solidfire/ApiSolidFireIntegrationTestService.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/solidfire/ApiSolidFireIntegrationTestService.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/solidfire/ApiSolidFireIntegrationTestService.java new file mode 100644 index 0000000..ff206d3 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/solidfire/ApiSolidFireIntegrationTestService.java @@ -0,0 +1,22 @@ +// 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.solidfire; + +import com.cloud.utils.component.PluggableService; + +public interface ApiSolidFireIntegrationTestService extends PluggableService { +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/solidfire/ApiSolidFireIntegrationTestServiceImpl.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/solidfire/ApiSolidFireIntegrationTestServiceImpl.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/solidfire/ApiSolidFireIntegrationTestServiceImpl.java new file mode 100644 index 0000000..0458903 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/api/solidfire/ApiSolidFireIntegrationTestServiceImpl.java @@ -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.solidfire; + +import java.util.List; +import java.util.ArrayList; + +import org.apache.cloudstack.api.command.admin.solidfire.GetPathForVolumeCmd; +// import org.apache.log4j.Logger; +import org.apache.cloudstack.api.command.admin.solidfire.GetSolidFireAccountIdCmd; +import org.apache.cloudstack.api.command.admin.solidfire.GetSolidFireVolumeAccessGroupIdCmd; +import org.apache.cloudstack.api.command.admin.solidfire.GetVolumeSnapshotDetailsCmd; +import org.apache.cloudstack.api.command.admin.solidfire.GetVolumeiScsiNameCmd; +import org.apache.cloudstack.api.command.admin.solidfire.GetSolidFireVolumeSizeCmd; +import org.springframework.stereotype.Component; + +import com.cloud.utils.component.AdapterBase; + +@Component +public class ApiSolidFireIntegrationTestServiceImpl extends AdapterBase implements ApiSolidFireIntegrationTestService { + @Override + public List> getCommands() { + List> cmdList = new ArrayList>(); + + cmdList.add(GetPathForVolumeCmd.class); + cmdList.add(GetSolidFireAccountIdCmd.class); + cmdList.add(GetSolidFireVolumeAccessGroupIdCmd.class); + cmdList.add(GetVolumeiScsiNameCmd.class); + cmdList.add(GetSolidFireVolumeSizeCmd.class); + cmdList.add(GetVolumeSnapshotDetailsCmd.class); + + return cmdList; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/ApiSolidFireService.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/ApiSolidFireService.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/ApiSolidFireService.java deleted file mode 100644 index 92828d4..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/ApiSolidFireService.java +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.solidfire; - -import com.cloud.utils.component.PluggableService; -import com.cloud.storage.Volume; -import com.cloud.storage.StoragePool; - -import org.apache.cloudstack.api.response.ApiSolidFireAccountIdResponse; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeSizeResponse; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeAccessGroupIdResponse; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeIscsiNameResponse; - -/** - * Provide API for SolidFire integration tests - * - */ -public interface ApiSolidFireService extends PluggableService { - public ApiSolidFireAccountIdResponse getSolidFireAccountId(Long csAccountId, Long storagePoolId); - public ApiSolidFireVolumeSizeResponse getSolidFireVolumeSize(Volume volume, StoragePool storagePool); - public ApiSolidFireVolumeAccessGroupIdResponse getSolidFireVolumeAccessGroupId(Long csClusterId, Long storagePoolId); - public ApiSolidFireVolumeIscsiNameResponse getSolidFireVolumeIscsiName(Volume volume); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl.java deleted file mode 100644 index fbda654..0000000 --- a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/ApiSolidFireServiceImpl.java +++ /dev/null @@ -1,126 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.solidfire; - -import java.util.Map; -import java.util.List; -import java.util.ArrayList; - -import javax.inject.Inject; -import javax.naming.ConfigurationException; - -// import org.apache.log4j.Logger; -import org.apache.cloudstack.acl.APIChecker; -import org.apache.cloudstack.storage.datastore.util.SolidFireUtil; -import org.apache.cloudstack.api.command.user.solidfire.GetSolidFireAccountIdCmd; -import org.apache.cloudstack.api.command.user.solidfire.GetSolidFireVolumeAccessGroupIdCmd; -import org.apache.cloudstack.api.command.user.solidfire.GetSolidFireVolumeIscsiNameCmd; -import org.apache.cloudstack.api.command.user.solidfire.GetSolidFireVolumeSizeCmd; -import org.apache.cloudstack.api.response.ApiSolidFireAccountIdResponse; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeAccessGroupIdResponse; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeIscsiNameResponse; -import org.apache.cloudstack.api.response.ApiSolidFireVolumeSizeResponse; -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver; -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.PrimaryDataStoreDriver; -import org.springframework.stereotype.Component; - -import com.cloud.dc.ClusterDetailsDao; -import com.cloud.dc.ClusterDetailsVO; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.PermissionDeniedException; -import com.cloud.storage.StoragePool; -import com.cloud.storage.Volume; -import com.cloud.user.AccountDetailsDao; -import com.cloud.user.AccountDetailVO; -import com.cloud.user.User; -import com.cloud.utils.component.AdapterBase; - -@Component -public class ApiSolidFireServiceImpl extends AdapterBase implements APIChecker, ApiSolidFireService { - // private static final Logger s_logger = Logger.getLogger(ApiSolidFireServiceImpl.class); - - @Inject private AccountDetailsDao _accountDetailsDao; - @Inject private DataStoreProviderManager _dataStoreProviderMgr; - @Inject private ClusterDetailsDao _clusterDetailsDao; - - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - super.configure(name, params); - - return true; - } - - @Override - public ApiSolidFireAccountIdResponse getSolidFireAccountId(Long csAccountId, Long storagePoolId) { - AccountDetailVO accountDetail = _accountDetailsDao.findDetail(csAccountId, SolidFireUtil.getAccountKey(storagePoolId)); - String sfAccountId = accountDetail.getValue(); - - return new ApiSolidFireAccountIdResponse(Long.parseLong(sfAccountId)); - } - - @Override - public ApiSolidFireVolumeSizeResponse getSolidFireVolumeSize(Volume volume, StoragePool storagePool) { - PrimaryDataStoreDriver primaryStoreDriver = null; - - try { - DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(storagePool.getStorageProviderName()); - DataStoreDriver storeDriver = storeProvider.getDataStoreDriver(); - - if (storeDriver instanceof PrimaryDataStoreDriver) { - primaryStoreDriver = (PrimaryDataStoreDriver)storeDriver; - } - } - catch (InvalidParameterValueException e) { - throw new InvalidParameterValueException("Invalid Storage Driver Type"); - } - - return new ApiSolidFireVolumeSizeResponse(primaryStoreDriver.getVolumeSizeIncludingHypervisorSnapshotReserve(volume, storagePool)); - } - - @Override - public ApiSolidFireVolumeAccessGroupIdResponse getSolidFireVolumeAccessGroupId(Long csClusterId, Long storagePoolId) { - ClusterDetailsVO clusterDetails = _clusterDetailsDao.findDetail(csClusterId, SolidFireUtil.getVagKey(storagePoolId)); - String sfVagId = clusterDetails.getValue(); - - return new ApiSolidFireVolumeAccessGroupIdResponse(Long.parseLong(sfVagId)); - } - - @Override - public ApiSolidFireVolumeIscsiNameResponse getSolidFireVolumeIscsiName(Volume volume) { - return new ApiSolidFireVolumeIscsiNameResponse(volume.get_iScsiName()); - } - - - @Override - public boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException { - return true; - } - - @Override - public List> getCommands() { - List> cmdList = new ArrayList>(); - - cmdList.add(GetSolidFireAccountIdCmd.class); - cmdList.add(GetSolidFireVolumeSizeCmd.class); - cmdList.add(GetSolidFireVolumeAccessGroupIdCmd.class); - cmdList.add(GetSolidFireVolumeIscsiNameCmd.class); - - return cmdList; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/SolidFireIntegrationTestManager.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/SolidFireIntegrationTestManager.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/SolidFireIntegrationTestManager.java new file mode 100644 index 0000000..bdc1180 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/SolidFireIntegrationTestManager.java @@ -0,0 +1,23 @@ +// 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.solidfire; + +public interface SolidFireIntegrationTestManager { + long getSolidFireAccountId(String csAccountUuid, String storagePoolUuid); + long getSolidFireVolumeAccessGroupId(String csClusterUuid, String storagePoolUuid); + long getSolidFireVolumeSize(String volumeUuid); +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/SolidFireIntegrationTestManagerImpl.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/SolidFireIntegrationTestManagerImpl.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/SolidFireIntegrationTestManagerImpl.java new file mode 100644 index 0000000..ff6e72c --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/solidfire/SolidFireIntegrationTestManagerImpl.java @@ -0,0 +1,78 @@ +// 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.solidfire; + +import javax.inject.Inject; + +import org.apache.cloudstack.storage.datastore.util.SolidFireUtil; +import org.apache.cloudstack.util.solidfire.SolidFireIntegrationTestUtil; +import org.springframework.stereotype.Component; + +import com.cloud.dc.ClusterDetailsDao; +import com.cloud.dc.ClusterDetailsVO; +import com.cloud.storage.VolumeDetailVO; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.dao.VolumeDetailsDao; +import com.cloud.user.AccountDetailsDao; +import com.cloud.user.AccountDetailVO; +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class SolidFireIntegrationTestManagerImpl implements SolidFireIntegrationTestManager { + + @Inject private AccountDetailsDao accountDetailsDao; + @Inject private ClusterDetailsDao clusterDetailsDao; + @Inject private SolidFireIntegrationTestUtil util; + @Inject private VolumeDao volumeDao; + @Inject private VolumeDetailsDao volumeDetailsDao; + + @Override + public long getSolidFireAccountId(String csAccountUuid, String storagePoolUuid) { + long csAccountId = util.getAccountIdForAccountUuid(csAccountUuid); + long storagePoolId = util.getStoragePoolIdForStoragePoolUuid(storagePoolUuid); + + AccountDetailVO accountDetail = accountDetailsDao.findDetail(csAccountId, SolidFireUtil.getAccountKey(storagePoolId)); + String sfAccountId = accountDetail.getValue(); + + return Long.parseLong(sfAccountId); + } + + @Override + public long getSolidFireVolumeAccessGroupId(String csClusterUuid, String storagePoolUuid) { + long csClusterId = util.getClusterIdForClusterUuid(csClusterUuid); + long storagePoolId = util.getStoragePoolIdForStoragePoolUuid(storagePoolUuid); + + ClusterDetailsVO clusterDetails = clusterDetailsDao.findDetail(csClusterId, SolidFireUtil.getVagKey(storagePoolId)); + String sfVagId = clusterDetails.getValue(); + + return Long.parseLong(sfVagId); + } + + @Override + public long getSolidFireVolumeSize(String volumeUuid) { + VolumeVO volume = volumeDao.findByUuid(volumeUuid); + + VolumeDetailVO volumeDetail = volumeDetailsDao.findDetail(volume.getId(), SolidFireUtil.VOLUME_SIZE); + + if (volumeDetail != null && volumeDetail.getValue() != null) { + return Long.parseLong(volumeDetail.getValue()); + } + + throw new CloudRuntimeException("Unable to determine the size of the SolidFire volume"); + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/util/solidfire/SolidFireIntegrationTestUtil.java ---------------------------------------------------------------------- diff --git a/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/util/solidfire/SolidFireIntegrationTestUtil.java b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/util/solidfire/SolidFireIntegrationTestUtil.java new file mode 100644 index 0000000..307e8c5 --- /dev/null +++ b/plugins/api/solidfire-intg-test/src/org/apache/cloudstack/util/solidfire/SolidFireIntegrationTestUtil.java @@ -0,0 +1,112 @@ +// 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.util.solidfire; + +import java.util.ArrayList; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.response.solidfire.ApiVolumeSnapshotDetailsResponse; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; + +import com.cloud.dc.ClusterVO; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.storage.SnapshotVO; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.SnapshotDao; +import com.cloud.storage.dao.SnapshotDetailsDao; +import com.cloud.storage.dao.SnapshotDetailsVO; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.user.Account; +import com.cloud.user.dao.AccountDao; + +public class SolidFireIntegrationTestUtil { + @Inject private AccountDao accountDao; + @Inject private ClusterDao clusterDao; + @Inject private PrimaryDataStoreDao storagePoolDao; + @Inject private SnapshotDao snapshotDao; + @Inject private SnapshotDetailsDao snapshotDetailsDao; + @Inject private VolumeDao volumeDao; + + private SolidFireIntegrationTestUtil() {} + + public long getAccountIdForAccountUuid(String accountUuid) { + Account account = accountDao.findByUuid(accountUuid); + + return account.getAccountId(); + } + + public long getAccountIdForVolumeUuid(String volumeUuid) { + VolumeVO volume = volumeDao.findByUuid(volumeUuid); + + return volume.getAccountId(); + } + + public long getAccountIdForSnapshotUuid(String snapshotUuid) { + SnapshotVO snapshot = snapshotDao.findByUuid(snapshotUuid); + + return snapshot.getAccountId(); + } + + public long getClusterIdForClusterUuid(String clusterUuid) { + ClusterVO cluster = clusterDao.findByUuid(clusterUuid); + + return cluster.getId(); + } + + public long getStoragePoolIdForStoragePoolUuid(String storagePoolUuid) { + StoragePoolVO storagePool = storagePoolDao.findByUuid(storagePoolUuid); + + return storagePool.getId(); + } + + public String getPathForVolumeUuid(String volumeUuid) { + VolumeVO volume = volumeDao.findByUuid(volumeUuid); + + return volume.getPath(); + } + + public String getVolume_iScsiName(String volumeUuid) { + VolumeVO volume = volumeDao.findByUuid(volumeUuid); + + return volume.get_iScsiName(); + } + + public List getSnapshotDetails(String snapshotUuid) { + SnapshotVO snapshot = snapshotDao.findByUuid(snapshotUuid); + + List snapshotDetails = snapshotDetailsDao.listDetails(snapshot.getId()); + + List responses = new ArrayList<>(); + + if (snapshotDetails != null) { + for (SnapshotDetailsVO snapshotDetail : snapshotDetails) { + ApiVolumeSnapshotDetailsResponse response = new ApiVolumeSnapshotDetailsResponse( + snapshotDetail.getResourceId(), + snapshotDetail.getName(), + snapshotDetail.getValue() + ); + + responses.add(response); + } + } + + return responses; + } +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java index 92e985e..ad87469 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java @@ -47,6 +47,8 @@ import org.apache.cloudstack.storage.command.DettachAnswer; import org.apache.cloudstack.storage.command.DettachCommand; import org.apache.cloudstack.storage.command.ForgetObjectCmd; import org.apache.cloudstack.storage.command.IntroduceObjectCmd; +import org.apache.cloudstack.storage.command.ResignatureAnswer; +import org.apache.cloudstack.storage.command.ResignatureCommand; import org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer; import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand; import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; @@ -148,6 +150,13 @@ public class KVMStorageProcessor implements StorageProcessor { } @Override + public ResignatureAnswer resignature(final ResignatureCommand cmd) { + s_logger.info("'ResignatureAnswer resignature(ResignatureCommand)' not currently used for KVMStorageProcessor"); + + return new ResignatureAnswer(); + } + + @Override public Answer copyTemplateToPrimaryStorage(final CopyCommand cmd) { final DataTO srcData = cmd.getSrcTO(); final DataTO destData = cmd.getDestTO(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessor.java b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessor.java index 3c28f1f..7c89921 100644 --- a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessor.java +++ b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3StorageProcessor.java @@ -31,6 +31,8 @@ import org.apache.cloudstack.storage.command.DeleteCommand; import org.apache.cloudstack.storage.command.DettachCommand; import org.apache.cloudstack.storage.command.ForgetObjectCmd; import org.apache.cloudstack.storage.command.IntroduceObjectCmd; +import org.apache.cloudstack.storage.command.ResignatureAnswer; +import org.apache.cloudstack.storage.command.ResignatureCommand; import org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer; import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand; import org.apache.cloudstack.storage.to.SnapshotObjectTO; @@ -805,9 +807,17 @@ public class Ovm3StorageProcessor implements StorageProcessor { * iSCSI? */ @Override - public Answer snapshotAndCopy(SnapshotAndCopyCommand cmd) { - LOGGER.debug("execute snapshotAndCopy: "+ cmd.getClass()); - return new SnapshotAndCopyAnswer("not implemented yet"); + public SnapshotAndCopyAnswer snapshotAndCopy(SnapshotAndCopyCommand cmd) { + LOGGER.info("'SnapshotAndCopyAnswer snapshotAndCopy(SnapshotAndCopyCommand)' not currently used for Ovm3StorageProcessor"); + + return new SnapshotAndCopyAnswer("Not implemented"); + } + + @Override + public ResignatureAnswer resignature(final ResignatureCommand cmd) { + LOGGER.info("'ResignatureAnswer resignature(ResignatureCommand)' not currently used for Ovm3StorageProcessor"); + + return new ResignatureAnswer("Not implemented"); } /** http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java index cae9261..9d86bc3 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java @@ -35,6 +35,8 @@ import org.apache.cloudstack.storage.command.DettachAnswer; import org.apache.cloudstack.storage.command.DettachCommand; import org.apache.cloudstack.storage.command.ForgetObjectCmd; import org.apache.cloudstack.storage.command.IntroduceObjectCmd; +import org.apache.cloudstack.storage.command.ResignatureAnswer; +import org.apache.cloudstack.storage.command.ResignatureCommand; import org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer; import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand; import org.apache.cloudstack.storage.to.SnapshotObjectTO; @@ -67,6 +69,13 @@ public class SimulatorStorageProcessor implements StorageProcessor { } @Override + public ResignatureAnswer resignature(ResignatureCommand cmd) { + s_logger.info("'ResignatureAnswer resignature(ResignatureCommand)' not currently used for SimulatorStorageProcessor"); + + return new ResignatureAnswer(); + } + + @Override public Answer copyTemplateToPrimaryStorage(CopyCommand cmd) { TemplateObjectTO template = new TemplateObjectTO(); template.setPath(UUID.randomUUID().toString()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java index 21f79f9..b2766e6 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java +++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java @@ -62,6 +62,8 @@ import org.apache.cloudstack.storage.command.DeleteCommand; import org.apache.cloudstack.storage.command.DettachCommand; import org.apache.cloudstack.storage.command.ForgetObjectCmd; import org.apache.cloudstack.storage.command.IntroduceObjectCmd; +import org.apache.cloudstack.storage.command.ResignatureAnswer; +import org.apache.cloudstack.storage.command.ResignatureCommand; import org.apache.cloudstack.storage.command.SnapshotAndCopyAnswer; import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand; import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; @@ -144,6 +146,13 @@ public class VmwareStorageProcessor implements StorageProcessor { return new SnapshotAndCopyAnswer(); } + @Override + public ResignatureAnswer resignature(ResignatureCommand cmd) { + s_logger.info("'ResignatureAnswer resignature(ResignatureCommand)' not currently used for VmwareStorageProcessor"); + + return new ResignatureAnswer(); + } + private String getOVFFilePath(String srcOVAFileName) { File file = new File(srcOVAFileName); assert (_storage != null); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2bd035d1/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index efc3f81..026d0c1 100644 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -37,6 +37,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Properties; import java.util.Queue; import java.util.Random; @@ -164,9 +165,16 @@ import com.xensource.xenapi.XenAPIObject; * */ public abstract class CitrixResourceBase implements ServerResource, HypervisorResource, VirtualRouterDeployer { - + /** + * used to describe what type of resource a storage device is of + */ public enum SRType { - EXT, FILE, ISCSI, ISO, LVM, LVMOHBA, LVMOISCSI, NFS; + EXT, FILE, ISCSI, ISO, LVM, LVMOHBA, LVMOISCSI, + /** + * used for resigning metadata (like SR UUID and VDI UUID when a + * particular storage manager is installed on a XenServer host (for back-end snapshots to work)) + */ + RELVMOISCSI, NFS; String _str; @@ -1794,10 +1802,26 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe cmd.setPod(_pod); cmd.setVersion(CitrixResourceBase.class.getPackage().getImplementationVersion()); + try { + final String cmdLine = "xe sm-list | grep \"resigning of duplicates\""; + + final XenServerUtilitiesHelper xenServerUtilitiesHelper = getXenServerUtilitiesHelper(); + + Pair result = xenServerUtilitiesHelper.executeSshWrapper(_host.getIp(), 22, _username, null, getPwdFromQueue(), cmdLine); + + boolean supportsClonedVolumes = result != null && result.first() != null && result.first() && + result.second() != null && result.second().length() > 0; + + cmd.setSupportsClonedVolumes(supportsClonedVolumes); + } catch (NumberFormatException ex) { + s_logger.warn("Issue sending 'xe sm-list' via SSH to XenServer host: " + ex.getMessage()); + } } catch (final XmlRpcException e) { - throw new CloudRuntimeException("XML RPC Exception" + e.getMessage(), e); + throw new CloudRuntimeException("XML RPC Exception: " + e.getMessage(), e); } catch (final XenAPIException e) { - throw new CloudRuntimeException("XenAPIException" + e.toString(), e); + throw new CloudRuntimeException("XenAPIException: " + e.toString(), e); + } catch (final Exception e) { + throw new CloudRuntimeException("Exception: " + e.toString(), e); } } @@ -2264,6 +2288,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe public SR getIscsiSR(final Connection conn, final String srNameLabel, final String target, String path, final String chapInitiatorUsername, final String chapInitiatorPassword, final boolean ignoreIntroduceException) { + return getIscsiSR(conn, srNameLabel, target, path, chapInitiatorUsername, chapInitiatorPassword, false, ignoreIntroduceException); + } + + public SR getIscsiSR(final Connection conn, final String srNameLabel, final String target, String path, final String chapInitiatorUsername, + final String chapInitiatorPassword, final boolean resignature, final boolean ignoreIntroduceException) { synchronized (srNameLabel.intern()) { final Map deviceConfig = new HashMap(); try { @@ -2353,17 +2382,52 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe throw new CloudRuntimeException(msg, e); } } + deviceConfig.put("SCSIid", scsiid); - final String result = SR.probe(conn, host, deviceConfig, type, smConfig); + String result = SR.probe(conn, host, deviceConfig, type, smConfig); + String pooluuid = null; + if (result.indexOf("") != -1) { pooluuid = result.substring(result.indexOf("") + 6, result.indexOf("")).trim(); } if (pooluuid == null || pooluuid.length() != 36) { sr = SR.create(conn, host, deviceConfig, new Long(0), srNameLabel, srNameLabel, type, "user", true, smConfig); - } else { + } + else { + if (resignature) { + try { + SR.create(conn, host, deviceConfig, new Long(0), srNameLabel, srNameLabel, SRType.RELVMOISCSI.toString(), "user", true, smConfig); + + // The successful outcome of SR.create (right above) is to throw an exception of type XenAPIException (with expected + // toString() text) after resigning the metadata (we indicated to perform a resign by passing in SRType.RELVMOISCSI.toString()). + // That being the case, if this CloudRuntimeException statement is executed, there appears to have been some kind + // of failure in the execution of the above SR.create (resign) method. + throw new CloudRuntimeException("Problem resigning the metadata"); + } + catch (XenAPIException ex) { + String msg = ex.toString(); + + if (!msg.contains("successfully resigned")) { + throw ex; + } + + result = SR.probe(conn, host, deviceConfig, type, smConfig); + + pooluuid = null; + + if (result.indexOf("") != -1) { + pooluuid = result.substring(result.indexOf("") + 6, result.indexOf("")).trim(); + } + + if (pooluuid == null || pooluuid.length() != 36) { + throw new CloudRuntimeException("Non-existent or invalid SR UUID"); + } + } + } + try { sr = SR.introduce(conn, pooluuid, srNameLabel, srNameLabel, type, "user", true, smConfig); } catch (final XenAPIException ex) { @@ -2375,11 +2439,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } final Set setHosts = Host.getAll(conn); + if (setHosts == null) { - final String msg = "Unable to create Iscsi SR " + deviceConfig + " due to hosts not available."; + final String msg = "Unable to create iSCSI SR " + deviceConfig + " due to hosts not available."; + s_logger.warn(msg); + throw new CloudRuntimeException(msg); } + for (final Host currentHost : setHosts) { final PBD.Record rec = new PBD.Record(); @@ -2392,7 +2460,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe pbd.plug(conn); } } + sr.scan(conn); + return sr; } catch (final XenAPIException e) { final String msg = "Unable to create Iscsi SR " + deviceConfig + " due to " + e.toString(); @@ -3969,11 +4039,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } - // the idea here is to see if the DiskTO in question is from managed storage - // and - // does not yet have an SR - // if no SR, create it and create a VDI in it - public VDI prepareManagedDisk(final Connection conn, final DiskTO disk, final String vmName) throws Exception { + // The idea here is to see if the DiskTO in question is from managed storage and does not yet have an SR. + // If no SR, create it and create a VDI in it. + public VDI prepareManagedDisk(final Connection conn, final DiskTO disk, final long vmId, final String vmName) throws Exception { final Map details = disk.getDetails(); if (details == null) { @@ -3994,7 +4062,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return null; } - final String vdiNameLabel = vmName + "-DATA"; + final String vdiNameLabel = Volume.Type.ROOT.equals(disk.getType()) ? ("ROOT-" + vmId) : (vmName + "-DATA"); return prepareManagedStorage(conn, details, null, vdiNameLabel); } @@ -4024,19 +4092,25 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe VDI vdi = getVDIbyUuid(conn, path, false); final Long volumeSize = Long.parseLong(details.get(DiskTO.VOLUME_SIZE)); + Set vdisInSr = sr.getVDIs(conn); + + // If a VDI already exists in the SR (in case we cloned from a template cache), use that. + if (vdisInSr.size() == 1) { + vdi = vdisInSr.iterator().next(); + } + if (vdi == null) { vdi = createVdi(sr, vdiNameLabel, volumeSize); } else { - // if VDI is not null, it must have already been created, so check - // whether a resize of the volume was performed - // if true, resize the VDI to the volume size + // If vdi is not null, it must have already been created, so check whether a resize of the volume was performed. + // If true, resize the VDI to the volume size. - s_logger.info("checking for the resize of the datadisk"); + s_logger.info("Checking for the resize of the datadisk"); final long vdiVirtualSize = vdi.getVirtualSize(conn); if (vdiVirtualSize != volumeSize) { - s_logger.info("resizing the data disk (vdi) from vdiVirtualsize: " + vdiVirtualSize + " to volumeSize: " + volumeSize); + s_logger.info("Resizing the data disk (VDI) from vdiVirtualSize: " + vdiVirtualSize + " to volumeSize: " + volumeSize); try { vdi.resize(conn, volumeSize); @@ -4044,6 +4118,15 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.warn("Unable to resize volume", e); } } + + // change the name-label in case of a cloned VDI + if (!Objects.equals(vdi.getNameLabel(conn), vdiNameLabel)) { + try { + vdi.setNameLabel(conn, vdiNameLabel); + } catch (final Exception e) { + s_logger.warn("Unable to rename volume", e); + } + } } return vdi;