seems netapp part of code is missing due to merge

Revert "bug 10837: rename api related to netapp"

This reverts commit 5db6b500dd1bbb96bfddbd7eda6cf1f616e2e0f9.

Conflicts:

	api/src/com/cloud/api/commands/MigrateVolumeCmd.java
	client/tomcatconf/commands-ext.properties.in
This commit is contained in:
Edison Su 2012-01-12 15:17:27 -08:00
parent a7daf4b9b4
commit 3aa9a312b4
15 changed files with 952 additions and 0 deletions

View File

@ -23,3 +23,16 @@ addTrafficMonitor=com.cloud.api.commands.AddTrafficMonitorCmd;1
deleteTrafficMonitor=com.cloud.api.commands.DeleteTrafficMonitorCmd;1
listTrafficMonitors=com.cloud.api.commands.ListTrafficMonitorsCmd;1
####Netapp integration commands
createVolumeOnFiler=com.cloud.api.commands.netapp.CreateVolumeCmd;15
destroyVolumeOnFiler=com.cloud.api.commands.netapp.DestroyVolumeCmd;15
listVolumesOnFiler=com.cloud.api.commands.netapp.ListVolumesCmd;15
createLunOnFiler=com.cloud.api.commands.netapp.CreateLunCmd;15
destroyLunOnFiler=com.cloud.api.commands.netapp.DestroyLunCmd;15
listLunsOnFiler=com.cloud.api.commands.netapp.ListLunsCmd;15
associateLun=com.cloud.api.commands.netapp.AssociateLunCmd;15
dissociateLun=com.cloud.api.commands.netapp.DissociateLunCmd;15
createPool=com.cloud.api.commands.netapp.CreatePoolCmd;15
deletePool=com.cloud.api.commands.netapp.DeletePoolCmd;15
modifyPool=com.cloud.api.commands.netapp.ModifyPoolCmd;15
listPools=com.cloud.api.commands.netapp.ListPoolsCmd;15

View File

@ -0,0 +1,163 @@
/**
* * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author-aj
*/
package com.cloud.api.commands.netapp;
import java.net.UnknownHostException;
import java.rmi.ServerException;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.netapp.NetappManager;
import com.cloud.server.ManagementService;
import com.cloud.server.api.response.netapp.CreateVolumeOnFilerCmdResponse;
import com.cloud.utils.component.ComponentLocator;
@Implementation(description="Create a volume", responseObject = CreateVolumeOnFilerCmdResponse.class)
public class CreateVolumeOnFilerCmd extends BaseCmd {
private static final String s_name = "createvolumeresponse";
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, required = true, description="ip address.")
private String ipAddress;
@Parameter(name=ApiConstants.AGGREGATE_NAME, type=CommandType.STRING, required = true, description="aggregate name.")
private String aggrName;
@Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
@Parameter(name=ApiConstants.VOLUME_NAME, type=CommandType.STRING, required = true, description="volume name.")
private String volName;
@Parameter(name=ApiConstants.SIZE, type=CommandType.INTEGER, required = true, description="volume size.")
private Integer volSize;
@Parameter(name=ApiConstants.SNAPSHOT_POLICY, type=CommandType.STRING, required = false, description="snapshot policy.")
private String snapshotPolicy;
@Parameter(name=ApiConstants.SNAPSHOT_RESERVATION, type=CommandType.INTEGER, required = false, description="snapshot reservation.")
private Integer snapshotReservation;
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="user name.")
private String userName;
@Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="password.")
private String password;
public String getIpAddress() {
return ipAddress;
}
public String getAggrName() {
return aggrName;
}
public String getPoolName() {
return poolName;
}
public String volName() {
return volName;
}
public Integer getVolSize() {
return volSize;
}
public String getSnapshotPolicy() {
return snapshotPolicy;
}
public Integer getSnapshotReservation() {
return snapshotReservation;
}
public String getUserName() {
return userName;
}
public String getPassword() {
return password;
}
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
//param checks
if(snapshotReservation != null && (snapshotReservation<0 || snapshotReservation>100))
throw new InvalidParameterValueException("Invalid snapshot reservation");
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
StringBuilder s = new StringBuilder(getVolSize().toString());
s.append("g");
try {
netappMgr.createVolumeOnFiler(ipAddress, aggrName, poolName, volName, s.toString(), snapshotPolicy, snapshotReservation, userName, password);
CreateVolumeOnFilerCmdResponse response = new CreateVolumeOnFilerCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (ServerException e) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
} catch (InvalidParameterValueException e) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
} catch (UnknownHostException e) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
}
}
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@ -0,0 +1,101 @@
/**
* * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*@author-aj
*/
package com.cloud.api.commands.netapp;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.netapp.NetappManager;
import com.cloud.server.ManagementService;
import com.cloud.server.api.response.netapp.CreateVolumePoolCmdResponse;
import com.cloud.utils.component.ComponentLocator;
@Implementation(description="Create a pool", responseObject = CreateVolumePoolCmdResponse.class)
public class CreateVolumePoolCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateVolumePoolCmd.class.getName());
private static final String s_name = "createpoolresponse";
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
@Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required = true, description="algorithm.")
private String algorithm;
public String getPoolName() {
return poolName;
}
public String getAlgorithm() {
return algorithm;
}
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
try {
CreateVolumePoolCmdResponse response = new CreateVolumePoolCmdResponse();
netappMgr.createPool(getPoolName(), getAlgorithm());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
}
}
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@ -0,0 +1,93 @@
/**
* * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*@author-aj
*/
package com.cloud.api.commands.netapp;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.netapp.NetappManager;
import com.cloud.server.ManagementService;
import com.cloud.server.api.response.netapp.DeleteVolumePoolCmdResponse;
import com.cloud.utils.component.ComponentLocator;
@Implementation(description="Delete a pool", responseObject = DeleteVolumePoolCmdResponse.class)
public class DeleteVolumePoolCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteVolumePoolCmd.class.getName());
private static final String s_name = "deletepoolresponse";
@Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
try {
netappMgr.deletePool(poolName);
DeleteVolumePoolCmdResponse response = new DeleteVolumePoolCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
} catch (ResourceInUseException e) {
throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString());
}
}
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@ -0,0 +1,104 @@
/**
* * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author-aj
*/
package com.cloud.api.commands.netapp;
import java.rmi.ServerException;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.netapp.NetappManager;
import com.cloud.server.ManagementService;
import com.cloud.server.api.response.netapp.DeleteVolumeOnFilerCmdResponse;
import com.cloud.utils.component.ComponentLocator;
@Implementation(description="Destroy a Volume", responseObject = DeleteVolumeOnFilerCmdResponse.class)
public class DestroyVolumeOnFilerCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DestroyVolumeOnFilerCmd.class.getName());
private static final String s_name = "destroyvolumeresponse";
@Parameter(name=ApiConstants.AGGREGATE_NAME, type=CommandType.STRING, required = true, description="aggregate name.")
private String aggrName;
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, required = true, description="ip address.")
private String ipAddr;
@Parameter(name=ApiConstants.VOLUME_NAME, type=CommandType.STRING, required = true, description="volume name.")
private String volumeName;
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
try {
netappMgr.destroyVolumeOnFiler(ipAddr, aggrName, volumeName);
DeleteVolumeOnFilerCmdResponse response = new DeleteVolumeOnFilerCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
} catch (ResourceInUseException e) {
throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString());
} catch (ServerException e) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
}
}
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@ -0,0 +1,101 @@
/**
* * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*@author-aj
*/
package com.cloud.api.commands.netapp;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.netapp.NetappManager;
import com.cloud.netapp.PoolVO;
import com.cloud.server.ManagementService;
import com.cloud.server.api.response.netapp.ListVolumePoolsCmdResponse;
import com.cloud.utils.component.ComponentLocator;
@Implementation(description="List Pool", responseObject = ListVolumePoolsCmdResponse.class)
public class ListVolumePoolsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ListVolumePoolsCmd.class.getName());
private static final String s_name = "listpoolresponse";
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
try {
List<PoolVO> poolList = netappMgr.listPools();
ListResponse<ListVolumePoolsCmdResponse> listResponse = new ListResponse<ListVolumePoolsCmdResponse>();
List<ListVolumePoolsCmdResponse> responses = new ArrayList<ListVolumePoolsCmdResponse>();
for (PoolVO pool : poolList) {
ListVolumePoolsCmdResponse response = new ListVolumePoolsCmdResponse();
response.setId(pool.getId());
response.setName(pool.getName());
response.setAlgorithm(pool.getAlgorithm());
response.setObjectName("pool");
responses.add(response);
}
listResponse.setResponses(responses);
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
}
}
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@ -0,0 +1,111 @@
/**
* * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*@author-aj
*/
package com.cloud.api.commands.netapp;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.response.ListResponse;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.netapp.NetappManager;
import com.cloud.netapp.NetappVolumeVO;
import com.cloud.server.ManagementService;
import com.cloud.server.api.response.netapp.ListVolumesOnFilerCmdResponse;
import com.cloud.utils.component.ComponentLocator;
@Implementation(description="List Volumes", responseObject = ListVolumesOnFilerCmdResponse.class)
public class ListVolumesOnFilerCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ListVolumesOnFilerCmd.class.getName());
private static final String s_name = "listvolumesresponse";
@Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
try {
List<NetappVolumeVO> volumes = netappMgr.listVolumesOnFiler(poolName);
ListResponse<ListVolumesOnFilerCmdResponse> listResponse = new ListResponse<ListVolumesOnFilerCmdResponse>();
List<ListVolumesOnFilerCmdResponse> responses = new ArrayList<ListVolumesOnFilerCmdResponse>();
for (NetappVolumeVO volume : volumes) {
ListVolumesOnFilerCmdResponse response = new ListVolumesOnFilerCmdResponse();
response.setId(volume.getId());
response.setIpAddress(volume.getIpAddress());
response.setPoolName(volume.getPoolName());
response.setAggrName(volume.getAggregateName());
response.setVolumeName(volume.getVolumeName());
response.setSnapshotPolicy(volume.getSnapshotPolicy());
response.setSnapshotReservation(volume.getSnapshotReservation());
response.setVolumeSize(volume.getVolumeSize());
response.setObjectName("volume");
responses.add(response);
}
listResponse.setResponses(responses);
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
}
}
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@ -0,0 +1,90 @@
/**
* * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*@author-aj
*/
package com.cloud.api.commands.netapp;
import org.apache.log4j.Logger;
import com.cloud.api.ApiConstants;
import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.netapp.NetappManager;
import com.cloud.server.ManagementService;
import com.cloud.server.api.response.netapp.ModifyVolumePoolCmdResponse;
import com.cloud.utils.component.ComponentLocator;
@Implementation(description="Modify pool", responseObject = ModifyVolumePoolCmdResponse.class)
public class ModifyVolumePoolCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ModifyVolumePoolCmd.class.getName());
private static final String s_name = "modifypoolresponse";
@Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
private String poolName;
@Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required = true, description="algorithm.")
private String algorithm;
@Override
public void execute() throws ResourceUnavailableException,
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
NetappManager netappMgr = locator.getManager(NetappManager.class);
netappMgr.modifyPool(poolName, algorithm);
ModifyVolumePoolCmdResponse response = new ModifyVolumePoolCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
@Override
public String getCommandName() {
// TODO Auto-generated method stub
return s_name;
}
@Override
public long getEntityOwnerId() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@ -0,0 +1,6 @@
package com.cloud.server.api.response.netapp;
import com.cloud.api.response.BaseResponse;
public class CreateVolumeOnFilerCmdResponse extends BaseResponse {
}

View File

@ -0,0 +1,6 @@
package com.cloud.server.api.response.netapp;
import com.cloud.api.response.BaseResponse;
public class CreateVolumePoolCmdResponse extends BaseResponse{
}

View File

@ -0,0 +1,9 @@
package com.cloud.server.api.response.netapp;
import com.cloud.api.ApiConstants;
import com.cloud.api.response.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class DeleteVolumeOnFilerCmdResponse extends BaseResponse {
}

View File

@ -0,0 +1,6 @@
package com.cloud.server.api.response.netapp;
import com.cloud.api.response.BaseResponse;
public class DeleteVolumePoolCmdResponse extends BaseResponse {
}

View File

@ -0,0 +1,42 @@
package com.cloud.server.api.response.netapp;
import com.cloud.api.ApiConstants;
import com.cloud.api.response.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class ListVolumePoolsCmdResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="pool id")
private Long id;
@SerializedName(ApiConstants.NAME) @Param(description="pool name")
private String name;
@SerializedName(ApiConstants.ALGORITHM) @Param(description="pool algorithm")
private String algorithm;
public Long getId() {
return id;
}
public String getName() {
return name;
}
public String getAlgorithm() {
return algorithm;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setAlgorithm(String algorithm) {
this.algorithm = algorithm;
}
}

View File

@ -0,0 +1,98 @@
package com.cloud.server.api.response.netapp;
import com.cloud.api.ApiConstants;
import com.cloud.api.response.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class ListVolumesOnFilerCmdResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="volume id")
private Long id;
@SerializedName(ApiConstants.POOL_NAME) @Param(description="pool name")
private String poolName;
@SerializedName(ApiConstants.IP_ADDRESS) @Param(description="ip address")
private String ipAddress;
@SerializedName(ApiConstants.AGGREGATE_NAME) @Param(description="Aggregate name")
private String aggrName;
@SerializedName(ApiConstants.VOLUME_NAME) @Param(description="Volume name")
private String volumeName;
@SerializedName(ApiConstants.SNAPSHOT_POLICY) @Param(description="snapshot policy")
private String snapshotPolicy;
@SerializedName(ApiConstants.SNAPSHOT_RESERVATION) @Param(description="snapshot reservation")
private Integer snapshotReservation;
@SerializedName(ApiConstants.SIZE) @Param(description="volume size")
private String volumeSize;
public Long getId() {
return id;
}
public String getPoolName() {
return poolName;
}
public String getIpAddress() {
return ipAddress;
}
public String getAggrName() {
return aggrName;
}
public String getVolumeName() {
return volumeName;
}
public String getSnapshotPolicy() {
return snapshotPolicy;
}
public Integer getSnapshotReservation() {
return snapshotReservation;
}
public String getVolumeSize() {
return volumeSize;
}
public void setId(Long id) {
this.id = id;
}
public void setPoolName(String poolName) {
this.poolName = poolName;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public void setAggrName(String aggrName) {
this.aggrName = aggrName;
}
public void setVolumeName(String volumeName) {
this.volumeName = volumeName;
}
public void setSnapshotPolicy(String snapshotPolicy) {
this.snapshotPolicy = snapshotPolicy;
}
public void setSnapshotReservation(Integer snapshotReservation) {
this.snapshotReservation = snapshotReservation;
}
public void setVolumeSize(String size) {
this.volumeSize = size;
}
}

View File

@ -0,0 +1,9 @@
package com.cloud.server.api.response.netapp;
import com.cloud.api.ApiConstants;
import com.cloud.api.response.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class ModifyVolumePoolCmdResponse extends BaseResponse {
}