mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Removed unused agent command AttachVolumeCommand and corresponding answer AttachVolumeAnswer
This commit is contained in:
parent
44ba14d17b
commit
e1db6efc74
@ -1,64 +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 com.cloud.agent.api;
|
||||
|
||||
public class AttachVolumeAnswer extends Answer {
|
||||
private Long deviceId;
|
||||
private String vdiUuid;
|
||||
private String chainInfo;
|
||||
|
||||
public AttachVolumeAnswer(AttachVolumeCommand cmd, String result) {
|
||||
super(cmd, false, result);
|
||||
this.deviceId = null;
|
||||
}
|
||||
|
||||
public AttachVolumeAnswer(AttachVolumeCommand cmd, Long deviceId) {
|
||||
super(cmd);
|
||||
this.deviceId = deviceId;
|
||||
this.vdiUuid = "";
|
||||
}
|
||||
|
||||
public AttachVolumeAnswer(AttachVolumeCommand cmd, Long deviceId, String vdiUuid) {
|
||||
super(cmd);
|
||||
this.deviceId = deviceId;
|
||||
this.vdiUuid = vdiUuid;
|
||||
}
|
||||
|
||||
public AttachVolumeAnswer(AttachVolumeCommand cmd) {
|
||||
super(cmd);
|
||||
this.deviceId = null;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public String getVdiUuid() {
|
||||
return vdiUuid;
|
||||
}
|
||||
|
||||
public void setChainInfo(String chainInfo) {
|
||||
this.chainInfo = chainInfo;
|
||||
}
|
||||
|
||||
public String getChainInfo() {
|
||||
return chainInfo;
|
||||
}
|
||||
}
|
||||
@ -1,216 +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 com.cloud.agent.api;
|
||||
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
public class AttachVolumeCommand extends Command {
|
||||
private boolean attach;
|
||||
private boolean _managed;
|
||||
private String vmName;
|
||||
private StoragePoolType pooltype;
|
||||
private String volumePath;
|
||||
private String volumeName;
|
||||
private Long volumeSize;
|
||||
private Long deviceId;
|
||||
private String chainInfo;
|
||||
private String poolUuid;
|
||||
private String _storageHost;
|
||||
private int _storagePort;
|
||||
private String _iScsiName;
|
||||
private String _chapInitiatorUsername;
|
||||
private String _chapInitiatorPassword;
|
||||
private String _chapTargetUsername;
|
||||
private String _chapTargetPassword;
|
||||
private Long bytesReadRate;
|
||||
private Long bytesWriteRate;
|
||||
private Long iopsReadRate;
|
||||
private Long iopsWriteRate;
|
||||
private String cacheMode;
|
||||
|
||||
protected AttachVolumeCommand() {
|
||||
}
|
||||
|
||||
public AttachVolumeCommand(boolean attach, boolean managed, String vmName, StoragePoolType pooltype, String volumePath, String volumeName, Long volumeSize,
|
||||
Long deviceId, String chainInfo) {
|
||||
this.attach = attach;
|
||||
this._managed = managed;
|
||||
this.vmName = vmName;
|
||||
this.pooltype = pooltype;
|
||||
this.volumePath = volumePath;
|
||||
this.volumeName = volumeName;
|
||||
this.volumeSize = volumeSize;
|
||||
this.deviceId = deviceId;
|
||||
this.chainInfo = chainInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean getAttach() {
|
||||
return attach;
|
||||
}
|
||||
|
||||
public String getVmName() {
|
||||
return vmName;
|
||||
}
|
||||
|
||||
public StoragePoolType getPooltype() {
|
||||
return pooltype;
|
||||
}
|
||||
|
||||
public void setPooltype(StoragePoolType pooltype) {
|
||||
this.pooltype = pooltype;
|
||||
}
|
||||
|
||||
public String getVolumePath() {
|
||||
return volumePath;
|
||||
}
|
||||
|
||||
public String getVolumeName() {
|
||||
return volumeName;
|
||||
}
|
||||
|
||||
public Long getVolumeSize() {
|
||||
return volumeSize;
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(Long deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getPoolUuid() {
|
||||
return poolUuid;
|
||||
}
|
||||
|
||||
public void setPoolUuid(String poolUuid) {
|
||||
this.poolUuid = poolUuid;
|
||||
}
|
||||
|
||||
public String getChainInfo() {
|
||||
return chainInfo;
|
||||
}
|
||||
|
||||
public void setStorageHost(String storageHost) {
|
||||
_storageHost = storageHost;
|
||||
}
|
||||
|
||||
public String getStorageHost() {
|
||||
return _storageHost;
|
||||
}
|
||||
|
||||
public void setStoragePort(int storagePort) {
|
||||
_storagePort = storagePort;
|
||||
}
|
||||
|
||||
public int getStoragePort() {
|
||||
return _storagePort;
|
||||
}
|
||||
|
||||
public boolean isManaged() {
|
||||
return _managed;
|
||||
}
|
||||
|
||||
public void set_iScsiName(String iScsiName) {
|
||||
this._iScsiName = iScsiName;
|
||||
}
|
||||
|
||||
public String get_iScsiName() {
|
||||
return _iScsiName;
|
||||
}
|
||||
|
||||
public void setChapInitiatorUsername(String chapInitiatorUsername) {
|
||||
_chapInitiatorUsername = chapInitiatorUsername;
|
||||
}
|
||||
|
||||
public String getChapInitiatorUsername() {
|
||||
return _chapInitiatorUsername;
|
||||
}
|
||||
|
||||
public void setChapInitiatorPassword(String chapInitiatorPassword) {
|
||||
_chapInitiatorPassword = chapInitiatorPassword;
|
||||
}
|
||||
|
||||
public String getChapInitiatorPassword() {
|
||||
return _chapInitiatorPassword;
|
||||
}
|
||||
|
||||
public void setChapTargetUsername(String chapTargetUsername) {
|
||||
_chapTargetUsername = chapTargetUsername;
|
||||
}
|
||||
|
||||
public String getChapTargetUsername() {
|
||||
return _chapTargetUsername;
|
||||
}
|
||||
|
||||
public void setChapTargetPassword(String chapTargetPassword) {
|
||||
_chapTargetPassword = chapTargetPassword;
|
||||
}
|
||||
|
||||
public String getChapTargetPassword() {
|
||||
return _chapTargetPassword;
|
||||
}
|
||||
|
||||
public void setBytesReadRate(Long bytesReadRate) {
|
||||
this.bytesReadRate = bytesReadRate;
|
||||
}
|
||||
|
||||
public Long getBytesReadRate() {
|
||||
return bytesReadRate;
|
||||
}
|
||||
|
||||
public void setBytesWriteRate(Long bytesWriteRate) {
|
||||
this.bytesWriteRate = bytesWriteRate;
|
||||
}
|
||||
|
||||
public Long getBytesWriteRate() {
|
||||
return bytesWriteRate;
|
||||
}
|
||||
|
||||
public void setIopsReadRate(Long iopsReadRate) {
|
||||
this.iopsReadRate = iopsReadRate;
|
||||
}
|
||||
|
||||
public Long getIopsReadRate() {
|
||||
return iopsReadRate;
|
||||
}
|
||||
|
||||
public void setIopsWriteRate(Long iopsWriteRate) {
|
||||
this.iopsWriteRate = iopsWriteRate;
|
||||
}
|
||||
|
||||
public Long getIopsWriteRate() {
|
||||
return iopsWriteRate;
|
||||
}
|
||||
|
||||
public void setCacheMode(String cacheMode) {
|
||||
this.cacheMode = cacheMode;
|
||||
}
|
||||
|
||||
public String getCacheMode() {
|
||||
return cacheMode;
|
||||
}
|
||||
}
|
||||
@ -1,66 +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.agent.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.cloud.agent.api.AttachVolumeAnswer;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
public class AttachVolumeAnswerTest {
|
||||
AttachVolumeCommand avc = new AttachVolumeCommand(true, false, "vmname", StoragePoolType.Filesystem, "vPath", "vName", 1073741824L, 123456789L, "chainInfo");
|
||||
AttachVolumeAnswer ava1 = new AttachVolumeAnswer(avc);
|
||||
String results = "";
|
||||
AttachVolumeAnswer ava2 = new AttachVolumeAnswer(avc, results);
|
||||
Long deviceId = 10L;
|
||||
AttachVolumeAnswer ava3 = new AttachVolumeAnswer(avc, deviceId);
|
||||
|
||||
@Test
|
||||
public void testGetDeviceId() {
|
||||
Long dId = ava1.getDeviceId();
|
||||
assertTrue(dId == null);
|
||||
|
||||
dId = ava2.getDeviceId();
|
||||
assertTrue(dId == null);
|
||||
|
||||
dId = ava3.getDeviceId();
|
||||
Long expected = 10L;
|
||||
assertEquals(expected, dId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetChainInfo() {
|
||||
ava1.setChainInfo("chainInfo");
|
||||
String chainInfo = ava1.getChainInfo();
|
||||
assertTrue(chainInfo.equals("chainInfo"));
|
||||
|
||||
ava2.setChainInfo("chainInfo");
|
||||
chainInfo = ava2.getChainInfo();
|
||||
assertTrue(chainInfo.equals("chainInfo"));
|
||||
|
||||
ava3.setChainInfo("chainInfo");
|
||||
chainInfo = ava3.getChainInfo();
|
||||
assertTrue(chainInfo.equals("chainInfo"));
|
||||
}
|
||||
}
|
||||
@ -1,115 +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.agent.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
public class AttachVolumeCommandTest {
|
||||
AttachVolumeCommand avc = new AttachVolumeCommand(true, false, "vmname", StoragePoolType.Filesystem, "vPath", "vName", 1073741824L, 123456789L, "chainInfo");
|
||||
|
||||
@Test
|
||||
public void testExecuteInSequence() {
|
||||
boolean b = avc.executeInSequence();
|
||||
assertTrue(b);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAttach() {
|
||||
boolean b = avc.getAttach();
|
||||
assertTrue(b);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVmName() {
|
||||
String vmName = avc.getVmName();
|
||||
assertTrue(vmName.equals("vmname"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPooltype() {
|
||||
StoragePoolType pt = avc.getPooltype();
|
||||
assertTrue(pt.equals(StoragePoolType.Filesystem));
|
||||
|
||||
avc.setPooltype(StoragePoolType.NetworkFilesystem);
|
||||
pt = avc.getPooltype();
|
||||
assertTrue(pt.equals(StoragePoolType.NetworkFilesystem));
|
||||
|
||||
avc.setPooltype(StoragePoolType.IscsiLUN);
|
||||
pt = avc.getPooltype();
|
||||
assertTrue(pt.equals(StoragePoolType.IscsiLUN));
|
||||
|
||||
avc.setPooltype(StoragePoolType.Iscsi);
|
||||
pt = avc.getPooltype();
|
||||
assertTrue(pt.equals(StoragePoolType.Iscsi));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVolumePath() {
|
||||
String vPath = avc.getVolumePath();
|
||||
assertTrue(vPath.equals("vPath"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetVolumeName() {
|
||||
String vName = avc.getVolumeName();
|
||||
assertTrue(vName.equals("vName"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDeviceId() {
|
||||
Long dId = avc.getDeviceId();
|
||||
Long expected = 123456789L;
|
||||
assertEquals(expected, dId);
|
||||
|
||||
avc.setDeviceId(5L);
|
||||
dId = avc.getDeviceId();
|
||||
expected = 5L;
|
||||
assertEquals(expected, dId);
|
||||
|
||||
avc.setDeviceId(0L);
|
||||
dId = avc.getDeviceId();
|
||||
expected = 0L;
|
||||
assertEquals(expected, dId);
|
||||
|
||||
avc.setDeviceId(-5L);
|
||||
dId = avc.getDeviceId();
|
||||
expected = -5L;
|
||||
assertEquals(expected, dId);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPoolUuid() {
|
||||
avc.setPoolUuid("420fa39c-4ef1-a83c-fd93-46dc1ff515ae");
|
||||
String pUuid = avc.getPoolUuid();
|
||||
assertTrue(pUuid.equals("420fa39c-4ef1-a83c-fd93-46dc1ff515ae"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetWait() {
|
||||
String cInfo = avc.getChainInfo();
|
||||
assertTrue(cInfo.equals("chainInfo"));
|
||||
}
|
||||
}
|
||||
@ -668,8 +668,6 @@ namespace HypervResource
|
||||
{
|
||||
public const string Answer = "com.cloud.agent.api.Answer";
|
||||
public const string AttachIsoCommand = "com.cloud.agent.api.AttachIsoCommand";
|
||||
public const string AttachVolumeAnswer = "com.cloud.agent.api.AttachVolumeAnswer";
|
||||
public const string AttachVolumeCommand = "com.cloud.agent.api.AttachVolumeCommand";
|
||||
public const string AnsBackupSnapshotAnswerwer = "com.cloud.agent.api.BackupSnapshotAnswer";
|
||||
public const string BackupSnapshotCommand = "com.cloud.agent.api.BackupSnapshotCommand";
|
||||
public const string BumpUpPriorityCommand = "com.cloud.agent.api.BumpUpPriorityCommand";
|
||||
|
||||
@ -1,60 +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 com.cloud.hypervisor.kvm.resource.wrapper;
|
||||
|
||||
import org.libvirt.Connect;
|
||||
import org.libvirt.LibvirtException;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachVolumeAnswer;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource;
|
||||
import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk;
|
||||
import com.cloud.hypervisor.kvm.storage.KVMStoragePool;
|
||||
import com.cloud.resource.CommandWrapper;
|
||||
import com.cloud.resource.ResourceWrapper;
|
||||
|
||||
@ResourceWrapper(handles = AttachVolumeCommand.class)
|
||||
public final class LibvirtAttachVolumeCommandWrapper extends CommandWrapper<AttachVolumeCommand, Answer, LibvirtComputingResource> {
|
||||
|
||||
@Override
|
||||
public Answer execute(final AttachVolumeCommand command, final LibvirtComputingResource libvirtComputingResource) {
|
||||
try {
|
||||
final LibvirtUtilitiesHelper libvirtUtilitiesHelper = libvirtComputingResource.getLibvirtUtilitiesHelper();
|
||||
|
||||
final Connect conn = libvirtUtilitiesHelper.getConnectionByVmName(command.getVmName());
|
||||
|
||||
final KVMStoragePool primary = libvirtComputingResource.getStoragePoolMgr().getStoragePool(command.getPooltype(), command.getPoolUuid());
|
||||
final KVMPhysicalDisk disk = primary.getPhysicalDisk(command.getVolumePath());
|
||||
|
||||
libvirtComputingResource.attachOrDetachDisk(conn, command.getAttach(), command.getVmName(), disk,
|
||||
command.getDeviceId().intValue(), command.getBytesReadRate(), command.getBytesWriteRate(), command.getIopsReadRate(), command.getIopsWriteRate(),
|
||||
command.getCacheMode());
|
||||
|
||||
} catch (final LibvirtException e) {
|
||||
return new AttachVolumeAnswer(command, e.toString());
|
||||
} catch (final InternalErrorException e) {
|
||||
return new AttachVolumeAnswer(command, e.toString());
|
||||
}
|
||||
|
||||
return new AttachVolumeAnswer(command, command.getDeviceId(), command.getVolumePath());
|
||||
}
|
||||
}
|
||||
@ -76,7 +76,6 @@ import org.xml.sax.SAXException;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachIsoCommand;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.BackupSnapshotCommand;
|
||||
import com.cloud.agent.api.CheckHealthCommand;
|
||||
import com.cloud.agent.api.CheckNetworkCommand;
|
||||
@ -1503,141 +1502,6 @@ public class LibvirtComputingResourceTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAttachVolumeCommand() {
|
||||
final Connect conn = Mockito.mock(Connect.class);
|
||||
final LibvirtUtilitiesHelper libvirtUtilitiesHelper = Mockito.mock(LibvirtUtilitiesHelper.class);
|
||||
|
||||
final boolean attach = true;
|
||||
final boolean managed = true;
|
||||
final String vmName = "Test";
|
||||
final StoragePoolType poolType = StoragePoolType.ISO;
|
||||
final String volumePath = "/path";
|
||||
final String volumeName = "volume";
|
||||
final Long volumeSize = 200l;
|
||||
final Long deviceId = 1l;
|
||||
final String chainInfo = "none";
|
||||
final AttachVolumeCommand command = new AttachVolumeCommand(attach, managed, vmName, poolType, volumePath, volumeName, volumeSize, deviceId, chainInfo);
|
||||
|
||||
final KVMStoragePoolManager poolManager = Mockito.mock(KVMStoragePoolManager.class);
|
||||
final KVMStoragePool primary = Mockito.mock(KVMStoragePool.class);
|
||||
final KVMPhysicalDisk disk = Mockito.mock(KVMPhysicalDisk.class);
|
||||
|
||||
when(libvirtComputingResource.getLibvirtUtilitiesHelper()).thenReturn(libvirtUtilitiesHelper);
|
||||
try {
|
||||
when(libvirtUtilitiesHelper.getConnectionByVmName(vmName)).thenReturn(conn);
|
||||
} catch (final LibvirtException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
when(libvirtComputingResource.getStoragePoolMgr()).thenReturn(poolManager);
|
||||
when(poolManager.getStoragePool(command.getPooltype(), command.getPoolUuid())).thenReturn(primary);
|
||||
when(primary.getPhysicalDisk(command.getVolumePath())).thenReturn(disk);
|
||||
|
||||
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
|
||||
assertNotNull(wrapper);
|
||||
|
||||
final Answer answer = wrapper.execute(command, libvirtComputingResource);
|
||||
assertTrue(answer.getResult());
|
||||
|
||||
verify(libvirtComputingResource, times(1)).getLibvirtUtilitiesHelper();
|
||||
try {
|
||||
verify(libvirtUtilitiesHelper, times(1)).getConnectionByVmName(vmName);
|
||||
} catch (final LibvirtException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testAttachVolumeCommandLibvirtException() {
|
||||
final LibvirtUtilitiesHelper libvirtUtilitiesHelper = Mockito.mock(LibvirtUtilitiesHelper.class);
|
||||
|
||||
final boolean attach = true;
|
||||
final boolean managed = true;
|
||||
final String vmName = "Test";
|
||||
final StoragePoolType poolType = StoragePoolType.ISO;
|
||||
final String volumePath = "/path";
|
||||
final String volumeName = "volume";
|
||||
final Long volumeSize = 200l;
|
||||
final Long deviceId = 1l;
|
||||
final String chainInfo = "none";
|
||||
final AttachVolumeCommand command = new AttachVolumeCommand(attach, managed, vmName, poolType, volumePath, volumeName, volumeSize, deviceId, chainInfo);
|
||||
|
||||
final KVMStoragePoolManager poolManager = Mockito.mock(KVMStoragePoolManager.class);
|
||||
final KVMStoragePool primary = Mockito.mock(KVMStoragePool.class);
|
||||
final KVMPhysicalDisk disk = Mockito.mock(KVMPhysicalDisk.class);
|
||||
|
||||
when(libvirtComputingResource.getLibvirtUtilitiesHelper()).thenReturn(libvirtUtilitiesHelper);
|
||||
try {
|
||||
when(libvirtUtilitiesHelper.getConnectionByVmName(vmName)).thenThrow(LibvirtException.class);
|
||||
} catch (final LibvirtException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
when(libvirtComputingResource.getStoragePoolMgr()).thenReturn(poolManager);
|
||||
when(poolManager.getStoragePool(command.getPooltype(), command.getPoolUuid())).thenReturn(primary);
|
||||
when(primary.getPhysicalDisk(command.getVolumePath())).thenReturn(disk);
|
||||
|
||||
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
|
||||
assertNotNull(wrapper);
|
||||
|
||||
final Answer answer = wrapper.execute(command, libvirtComputingResource);
|
||||
assertFalse(answer.getResult());
|
||||
|
||||
verify(libvirtComputingResource, times(1)).getLibvirtUtilitiesHelper();
|
||||
try {
|
||||
verify(libvirtUtilitiesHelper, times(1)).getConnectionByVmName(vmName);
|
||||
} catch (final LibvirtException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testAttachVolumeCommandInternalErrorException() {
|
||||
final LibvirtUtilitiesHelper libvirtUtilitiesHelper = Mockito.mock(LibvirtUtilitiesHelper.class);
|
||||
|
||||
final boolean attach = true;
|
||||
final boolean managed = true;
|
||||
final String vmName = "Test";
|
||||
final StoragePoolType poolType = StoragePoolType.ISO;
|
||||
final String volumePath = "/path";
|
||||
final String volumeName = "volume";
|
||||
final Long volumeSize = 200l;
|
||||
final Long deviceId = 1l;
|
||||
final String chainInfo = "none";
|
||||
final AttachVolumeCommand command = new AttachVolumeCommand(attach, managed, vmName, poolType, volumePath, volumeName, volumeSize, deviceId, chainInfo);
|
||||
|
||||
final KVMStoragePoolManager poolManager = Mockito.mock(KVMStoragePoolManager.class);
|
||||
final KVMStoragePool primary = Mockito.mock(KVMStoragePool.class);
|
||||
final KVMPhysicalDisk disk = Mockito.mock(KVMPhysicalDisk.class);
|
||||
|
||||
when(libvirtComputingResource.getLibvirtUtilitiesHelper()).thenReturn(libvirtUtilitiesHelper);
|
||||
try {
|
||||
when(libvirtUtilitiesHelper.getConnectionByVmName(vmName)).thenThrow(InternalErrorException.class);
|
||||
} catch (final LibvirtException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
when(libvirtComputingResource.getStoragePoolMgr()).thenReturn(poolManager);
|
||||
when(poolManager.getStoragePool(command.getPooltype(), command.getPoolUuid())).thenReturn(primary);
|
||||
when(primary.getPhysicalDisk(command.getVolumePath())).thenReturn(disk);
|
||||
|
||||
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
|
||||
assertNotNull(wrapper);
|
||||
|
||||
final Answer answer = wrapper.execute(command, libvirtComputingResource);
|
||||
assertFalse(answer.getResult());
|
||||
|
||||
verify(libvirtComputingResource, times(1)).getLibvirtUtilitiesHelper();
|
||||
try {
|
||||
verify(libvirtUtilitiesHelper, times(1)).getConnectionByVmName(vmName);
|
||||
} catch (final LibvirtException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWatchConsoleProxyLoadCommand() {
|
||||
final int interval = 0;
|
||||
|
||||
@ -40,8 +40,6 @@ import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import com.cloud.agent.IAgentControl;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachIsoCommand;
|
||||
import com.cloud.agent.api.AttachVolumeAnswer;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.CheckNetworkAnswer;
|
||||
import com.cloud.agent.api.CheckNetworkCommand;
|
||||
import com.cloud.agent.api.CheckVirtualMachineAnswer;
|
||||
@ -810,10 +808,6 @@ public class OvmResourceBase implements ServerResource, HypervisorResource {
|
||||
return new GetVmStatsAnswer(cmd, vmStatsNameMap);
|
||||
}
|
||||
|
||||
protected AttachVolumeAnswer execute(AttachVolumeCommand cmd) {
|
||||
return new AttachVolumeAnswer(cmd, "You must stop " + cmd.getVmName() + " first, OVM doesn't support hotplug datadisk");
|
||||
}
|
||||
|
||||
public Answer execute(DestroyCommand cmd) {
|
||||
try {
|
||||
OvmVolume.destroy(_conn, cmd.getVolume().getPoolUuid(), cmd.getVolume().getPath());
|
||||
@ -1183,8 +1177,6 @@ public class OvmResourceBase implements ServerResource, HypervisorResource {
|
||||
return execute((GetStorageStatsCommand)cmd);
|
||||
} else if (clazz == GetVmStatsCommand.class) {
|
||||
return execute((GetVmStatsCommand)cmd);
|
||||
} else if (clazz == AttachVolumeCommand.class) {
|
||||
return execute((AttachVolumeCommand)cmd);
|
||||
} else if (clazz == DestroyCommand.class) {
|
||||
return execute((DestroyCommand)cmd);
|
||||
} else if (clazz == PrepareForMigrationCommand.class) {
|
||||
|
||||
@ -38,7 +38,6 @@ import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
|
||||
import com.cloud.agent.IAgentControl;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachIsoCommand;
|
||||
// import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.CheckHealthCommand;
|
||||
import com.cloud.agent.api.CheckNetworkCommand;
|
||||
import com.cloud.agent.api.CheckOnHostCommand;
|
||||
|
||||
@ -28,8 +28,6 @@ import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
// import com.cloud.agent.api.AttachVolumeAnswer;
|
||||
// import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.GetVmStatsAnswer;
|
||||
import com.cloud.agent.api.GetVmStatsCommand;
|
||||
import com.cloud.agent.api.GetVncPortAnswer;
|
||||
@ -152,12 +150,7 @@ public class Ovm3VmSupport {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
public AttachVolumeAnswer execute(AttachVolumeCommand cmd) {
|
||||
return new AttachVolumeAnswer(cmd, "You must stop " + cmd.getVmName()
|
||||
+ " first, Ovm3 doesn't support hotplug datadisk");
|
||||
}
|
||||
*/
|
||||
|
||||
/* Migration should make sure both HVs are the same ? */
|
||||
public PrepareForMigrationAnswer execute(PrepareForMigrationCommand cmd) {
|
||||
VirtualMachineTO vm = cmd.getVirtualMachine();
|
||||
|
||||
@ -125,16 +125,4 @@ public class Ovm3VmSupportTest {
|
||||
Answer ra = hypervisor.executeRequest(cmd);
|
||||
results.basicBooleanTest(ra.getResult());
|
||||
}
|
||||
/*
|
||||
@Test
|
||||
public void AttachVolumeCommandTest() throws ConfigurationException {
|
||||
hypervisor = support.prepare(configTest.getParams());
|
||||
// boolean attach, boolean managed, String vmName, StoragePoolType pooltype,
|
||||
// String volumePath, String volumeName, Long volumeSize, Long deviceId, String chainInfo
|
||||
AttachVolumeCommand cmd = new AttachVolumeCommand(true, false, xen.getVmName(), StoragePoolType.NetworkFilesystem,
|
||||
"x", "x", 0L, 0L, "x");
|
||||
Answer ra = hypervisor.executeRequest(cmd);
|
||||
results.basicBooleanTest(ra.getResult());
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@ -24,8 +24,6 @@ import org.apache.cloudstack.storage.command.UploadStatusCommand;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachIsoCommand;
|
||||
import com.cloud.agent.api.AttachVolumeAnswer;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.BackupSnapshotCommand;
|
||||
import com.cloud.agent.api.ComputeChecksumCommand;
|
||||
import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand;
|
||||
@ -59,8 +57,6 @@ public interface MockStorageManager extends Manager {
|
||||
|
||||
public CreateAnswer createVolume(CreateCommand cmd);
|
||||
|
||||
public AttachVolumeAnswer AttachVolume(AttachVolumeCommand cmd);
|
||||
|
||||
public Answer AttachIso(AttachIsoCommand cmd);
|
||||
|
||||
public Answer DeleteStoragePool(DeleteStoragePoolCommand cmd);
|
||||
|
||||
@ -42,8 +42,6 @@ import org.apache.cloudstack.storage.command.UploadStatusCommand;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachIsoCommand;
|
||||
import com.cloud.agent.api.AttachVolumeAnswer;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.BackupSnapshotAnswer;
|
||||
import com.cloud.agent.api.BackupSnapshotCommand;
|
||||
import com.cloud.agent.api.ComputeChecksumCommand;
|
||||
@ -245,36 +243,6 @@ public class MockStorageManagerImpl extends ManagerBase implements MockStorageMa
|
||||
return new CreateAnswer(cmd, volumeTo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttachVolumeAnswer AttachVolume(AttachVolumeCommand cmd) {
|
||||
TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
|
||||
try {
|
||||
txn.start();
|
||||
String poolid = cmd.getPoolUuid();
|
||||
String volumeName = cmd.getVolumeName();
|
||||
MockVolumeVO volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath());
|
||||
if (volume == null) {
|
||||
return new AttachVolumeAnswer(cmd, "Can't find volume:" + volumeName + "on pool:" + poolid);
|
||||
}
|
||||
|
||||
String vmName = cmd.getVmName();
|
||||
MockVMVO vm = _mockVMDao.findByVmName(vmName);
|
||||
if (vm == null) {
|
||||
return new AttachVolumeAnswer(cmd, "can't vm :" + vmName);
|
||||
}
|
||||
txn.commit();
|
||||
|
||||
return new AttachVolumeAnswer(cmd, cmd.getDeviceId(), cmd.getVolumePath());
|
||||
} catch (Exception ex) {
|
||||
txn.rollback();
|
||||
throw new CloudRuntimeException("Error when attaching volume " + cmd.getVolumeName() + " to VM " + cmd.getVmName(), ex);
|
||||
} finally {
|
||||
txn.close();
|
||||
txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
|
||||
txn.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Answer AttachIso(AttachIsoCommand cmd) {
|
||||
MockVolumeVO iso = findVolumeFromSecondary(cmd.getIsoPath(), cmd.getStoreUrl(), MockVolumeType.ISO);
|
||||
|
||||
@ -37,7 +37,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachIsoCommand;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.BackupSnapshotCommand;
|
||||
import com.cloud.agent.api.CheckHealthCommand;
|
||||
import com.cloud.agent.api.CheckNetworkCommand;
|
||||
@ -331,8 +330,6 @@ public class SimulatorManagerImpl extends ManagerBase implements SimulatorManage
|
||||
answer = _mockStorageMgr.primaryStorageDownload((PrimaryStorageDownloadCommand)cmd);
|
||||
} else if (cmd instanceof CreateCommand) {
|
||||
answer = _mockStorageMgr.createVolume((CreateCommand)cmd);
|
||||
} else if (cmd instanceof AttachVolumeCommand) {
|
||||
answer = _mockStorageMgr.AttachVolume((AttachVolumeCommand)cmd);
|
||||
} else if (cmd instanceof AttachIsoCommand) {
|
||||
answer = _mockStorageMgr.AttachIso((AttachIsoCommand)cmd);
|
||||
} else if (cmd instanceof DeleteStoragePoolCommand) {
|
||||
|
||||
@ -1303,7 +1303,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, null);
|
||||
VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName);
|
||||
if (vmMo == null) {
|
||||
String msg = "Unable to find the VM to execute AttachVolumeCommand, vmName: " + vmName;
|
||||
String msg = "Unable to find the VM to execute AttachCommand, vmName: " + vmName;
|
||||
s_logger.error(msg);
|
||||
throw new Exception(msg);
|
||||
}
|
||||
@ -1329,7 +1329,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
}
|
||||
|
||||
if (morDs == null) {
|
||||
String msg = "Unable to find the mounted datastore to execute AttachVolumeCommand, vmName: " + vmName;
|
||||
String msg = "Unable to find the mounted datastore to execute AttachCommand, vmName: " + vmName;
|
||||
s_logger.error(msg);
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
@ -1,146 +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 com.cloud.hypervisor.xenserver.resource.wrapper.xenbase;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachVolumeAnswer;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.hypervisor.xenserver.resource.CitrixResourceBase;
|
||||
import com.cloud.resource.CommandWrapper;
|
||||
import com.cloud.resource.ResourceWrapper;
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.SR;
|
||||
import com.xensource.xenapi.Types;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
import com.xensource.xenapi.VBD;
|
||||
import com.xensource.xenapi.VDI;
|
||||
import com.xensource.xenapi.VM;
|
||||
|
||||
@ResourceWrapper(handles = AttachVolumeCommand.class)
|
||||
public final class CitrixAttachVolumeCommandWrapper extends CommandWrapper<AttachVolumeCommand, Answer, CitrixResourceBase> {
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(CitrixAttachVolumeCommandWrapper.class);
|
||||
|
||||
@Override
|
||||
public Answer execute(final AttachVolumeCommand command, final CitrixResourceBase citrixResourceBase) {
|
||||
final Connection conn = citrixResourceBase.getConnection();
|
||||
final boolean attach = command.getAttach();
|
||||
final String vmName = command.getVmName();
|
||||
final String vdiNameLabel = vmName + "-DATA";
|
||||
final Long deviceId = command.getDeviceId();
|
||||
|
||||
String errorMsg;
|
||||
if (attach) {
|
||||
errorMsg = "Failed to attach volume";
|
||||
} else {
|
||||
errorMsg = "Failed to detach volume";
|
||||
}
|
||||
|
||||
try {
|
||||
VDI vdi = null;
|
||||
|
||||
if (command.getAttach() && command.isManaged()) {
|
||||
final SR sr = citrixResourceBase.getIscsiSR(conn, command.get_iScsiName(), command.getStorageHost(), command.get_iScsiName(), command.getChapInitiatorUsername(),
|
||||
command.getChapInitiatorPassword(), true);
|
||||
|
||||
vdi = citrixResourceBase.getVDIbyUuid(conn, command.getVolumePath(), false);
|
||||
|
||||
if (vdi == null) {
|
||||
vdi = citrixResourceBase.createVdi(sr, vdiNameLabel, command.getVolumeSize());
|
||||
}
|
||||
} else {
|
||||
vdi = citrixResourceBase.getVDIbyUuid(conn, command.getVolumePath());
|
||||
}
|
||||
|
||||
// Look up the VM
|
||||
final VM vm = citrixResourceBase.getVM(conn, vmName);
|
||||
if (attach) {
|
||||
// Figure out the disk number to attach the VM to
|
||||
String diskNumber = null;
|
||||
if (deviceId != null) {
|
||||
if (deviceId.longValue() == 3) {
|
||||
final String msg = "Device 3 is reserved for CD-ROM, choose other device";
|
||||
return new AttachVolumeAnswer(command, msg);
|
||||
}
|
||||
if (citrixResourceBase.isDeviceUsed(conn, vm, deviceId)) {
|
||||
final String msg = "Device " + deviceId + " is used in VM " + vmName;
|
||||
return new AttachVolumeAnswer(command, msg);
|
||||
}
|
||||
diskNumber = deviceId.toString();
|
||||
} else {
|
||||
diskNumber = citrixResourceBase.getUnusedDeviceNum(conn, vm);
|
||||
}
|
||||
// Create a new VBD
|
||||
final VBD.Record vbdr = new VBD.Record();
|
||||
vbdr.VM = vm;
|
||||
vbdr.VDI = vdi;
|
||||
vbdr.bootable = false;
|
||||
vbdr.userdevice = diskNumber;
|
||||
vbdr.mode = Types.VbdMode.RW;
|
||||
vbdr.type = Types.VbdType.DISK;
|
||||
vbdr.unpluggable = true;
|
||||
final VBD vbd = VBD.create(conn, vbdr);
|
||||
|
||||
// Attach the VBD to the VM
|
||||
vbd.plug(conn);
|
||||
|
||||
// Update the VDI's label to include the VM name
|
||||
vdi.setNameLabel(conn, vdiNameLabel);
|
||||
|
||||
return new AttachVolumeAnswer(command, Long.parseLong(diskNumber), vdi.getUuid(conn));
|
||||
} else {
|
||||
// Look up all VBDs for this VDI
|
||||
final Set<VBD> vbds = vdi.getVBDs(conn);
|
||||
|
||||
// Detach each VBD from its VM, and then destroy it
|
||||
for (final VBD vbd : vbds) {
|
||||
final VBD.Record vbdr = vbd.getRecord(conn);
|
||||
|
||||
if (vbdr.currentlyAttached) {
|
||||
vbd.unplug(conn);
|
||||
}
|
||||
|
||||
vbd.destroy(conn);
|
||||
}
|
||||
|
||||
// Update the VDI's label to be "detached"
|
||||
vdi.setNameLabel(conn, "detached");
|
||||
|
||||
if (command.isManaged()) {
|
||||
citrixResourceBase.handleSrAndVdiDetach(command.get_iScsiName(), conn);
|
||||
}
|
||||
|
||||
return new AttachVolumeAnswer(command);
|
||||
}
|
||||
} catch (final XenAPIException e) {
|
||||
final String msg = errorMsg + " for uuid: " + command.getVolumePath() + " due to " + e.toString();
|
||||
s_logger.warn(msg, e);
|
||||
return new AttachVolumeAnswer(command, msg);
|
||||
} catch (final Exception e) {
|
||||
final String msg = errorMsg + " for uuid: " + command.getVolumePath() + " due to " + e.getMessage();
|
||||
s_logger.warn(msg, e);
|
||||
return new AttachVolumeAnswer(command, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,6 @@ import org.powermock.api.mockito.PowerMockito;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.AttachIsoCommand;
|
||||
import com.cloud.agent.api.AttachVolumeCommand;
|
||||
import com.cloud.agent.api.CheckHealthCommand;
|
||||
import com.cloud.agent.api.CheckNetworkCommand;
|
||||
import com.cloud.agent.api.CheckOnHostCommand;
|
||||
@ -127,7 +126,6 @@ import com.cloud.hypervisor.xenserver.resource.XsLocalNetwork;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.PhysicalNetworkSetupInfo;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc;
|
||||
import com.cloud.storage.resource.StorageSubsystemCommandHandler;
|
||||
import com.cloud.utils.Pair;
|
||||
@ -439,19 +437,6 @@ public class CitrixRequestWrapperTest {
|
||||
assertFalse(answer.getResult());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAttachVolumeCommand() {
|
||||
final AttachVolumeCommand attachCommand = new AttachVolumeCommand(false, true, "Test", StoragePoolType.LVM, "/", "DATA", 100l, 1l, "123");
|
||||
|
||||
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
|
||||
assertNotNull(wrapper);
|
||||
|
||||
final Answer answer = wrapper.execute(attachCommand, citrixResourceBase);
|
||||
verify(citrixResourceBase, times(1)).getConnection();
|
||||
|
||||
assertFalse(answer.getResult());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAttachIsoCommand() {
|
||||
final AttachIsoCommand attachCommand = new AttachIsoCommand("Test", "/", true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user