Github user mike-tutkowski commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1671#discussion_r77635744 --- Diff: plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixDeleteStoragePoolCommandWrapper.java --- @@ -32,22 +34,40 @@ @ResourceWrapper(handles = DeleteStoragePoolCommand.class) public final class CitrixDeleteStoragePoolCommandWrapper extends CommandWrapper<DeleteStoragePoolCommand, Answer, CitrixResourceBase> { - private static final Logger s_logger = Logger.getLogger(CitrixDeleteStoragePoolCommandWrapper.class); @Override public Answer execute(final DeleteStoragePoolCommand command, final CitrixResourceBase citrixResourceBase) { final Connection conn = citrixResourceBase.getConnection(); final StorageFilerTO poolTO = command.getPool(); + try { - final SR sr = citrixResourceBase.getStorageRepository(conn, poolTO.getUuid()); + final SR sr; + + // getRemoveDatastore being true indicates we are using managed storage and need to pull the SR name out of a Map + // instead of pulling it out using getUuid of the StorageFilerTO instance. + if (command.getRemoveDatastore()) { + Map<String, String> details = command.getDetails(); + + String srNameLabel = details.get(DeleteStoragePoolCommand.DATASTORE_NAME); + + sr = citrixResourceBase.getStorageRepository(conn, srNameLabel); + } + else { + sr = citrixResourceBase.getStorageRepository(conn, poolTO.getUuid()); + } + citrixResourceBase.removeSR(conn, sr); + final Answer answer = new Answer(command, true, "success"); + return answer; } catch (final Exception e) { - final String msg = "DeleteStoragePoolCommand XenAPIException:" + e.getMessage() + " host:" + citrixResourceBase.getHost().getUuid() + " pool: " + poolTO.getHost() - + poolTO.getPath(); + final String msg = "DeleteStoragePoolCommand XenAPIException:" + e.getMessage() + " host:" + citrixResourceBase.getHost().getUuid() + + " pool: " + poolTO.getHost() + poolTO.getPath(); + s_logger.warn(msg, e); --- End diff -- Sure, sounds good.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---