Search in sources :

Example 41 with Ovm3ResourceException

use of com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException in project cloudstack by apache.

the class StoragePluginTest method testStorageFileCreationFileExistS.

@Test(expected = Ovm3ResourceException.class)
public void testStorageFileCreationFileExistS() throws Ovm3ResourceException {
    con.setResult(results.errorResponseWrap("exceptions OSError:[Errno.17] File exists " + FILE));
    FileProperties file = sPt.storagePluginCreate(FSMNTUUID, NFSHOST, FILE, SIZE, false);
    file.getSize();
}
Also used : FileProperties(com.cloud.hypervisor.ovm3.objects.StoragePlugin.FileProperties) Test(org.junit.Test)

Example 42 with Ovm3ResourceException

use of com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException in project cloudstack by apache.

the class Ovm3HypervisorResourceTest method createOtherVmTest.

@Test
public void createOtherVmTest() throws ConfigurationException, Ovm3ResourceException {
    VirtualMachineTO vmspec = createVm(vmName);
    vmspec.setOs("bogus");
    hypervisor = vmActionPreparation();
    StartCommand cmd = new StartCommand(vmspec, getHost(hypervisor.getName()), true);
    Answer ra = hypervisor.executeRequest(cmd);
    results.basicBooleanTest(ra.getResult());
}
Also used : Answer(com.cloud.agent.api.Answer) StartCommand(com.cloud.agent.api.StartCommand) VirtualMachineTO(com.cloud.agent.api.to.VirtualMachineTO) ConnectionTest(com.cloud.hypervisor.ovm3.objects.ConnectionTest) Test(org.junit.Test) CloudStackPluginTest(com.cloud.hypervisor.ovm3.objects.CloudStackPluginTest) NetworkTest(com.cloud.hypervisor.ovm3.objects.NetworkTest) XenTest(com.cloud.hypervisor.ovm3.objects.XenTest) Ovm3SupportTest(com.cloud.hypervisor.ovm3.support.Ovm3SupportTest) XmlTestResultTest(com.cloud.hypervisor.ovm3.objects.XmlTestResultTest) Ovm3ConfigurationTest(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3ConfigurationTest)

Example 43 with Ovm3ResourceException

use of com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException in project cloudstack by apache.

the class Ovm3VmSupport method execute.

/*
     */
public GetVncPortAnswer execute(GetVncPortCommand cmd) {
    try {
        Xen host = new Xen(c);
        Xen.Vm vm = host.getRunningVmConfig(cmd.getName());
        Integer vncPort = vm.getVncPort();
        LOGGER.debug("get vnc port for " + cmd.getName() + ": " + vncPort);
        return new GetVncPortAnswer(cmd, c.getIp(), vncPort);
    } catch (Ovm3ResourceException e) {
        LOGGER.debug("get vnc port for " + cmd.getName() + " failed", e);
        return new GetVncPortAnswer(cmd, e.getMessage());
    }
}
Also used : Xen(com.cloud.hypervisor.ovm3.objects.Xen) GetVncPortAnswer(com.cloud.agent.api.GetVncPortAnswer) Ovm3ResourceException(com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException)

Example 44 with Ovm3ResourceException

use of com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException in project cloudstack by apache.

the class CloudStackPluginTest method testDomrExec.

@Test
public void testDomrExec() throws Ovm3ResourceException {
    con.setResult(domrExecXml);
    ReturnCode x = cSp.domrExec(domrIp, "ls");
    assertNotNull(x);
    assertEquals(x.getExit(), (Integer) 0);
    assertEquals(x.getRc(), true);
    assertEquals(x.getExit(), (Integer) 0);
    assertNotNull(x.getStdOut());
    /* failed */
    domrExecXml = domrExecXml.replace("<i8>0</i8>", "<i8>1</i8>");
    domrExecXml = domrExecXml.replace("<value><string></string></value>", "<value><string>Something went wrong!</string></value>");
    con.setResult(domrExecXml);
    ReturnCode y = cSp.domrExec(domrIp, "ls");
    assertNotNull(y);
    assertEquals(y.getRc(), false);
    assertEquals(y.getExit(), (Integer) 1);
    assertNotNull(x.getStdErr());
}
Also used : ReturnCode(com.cloud.hypervisor.ovm3.objects.CloudstackPlugin.ReturnCode) Test(org.junit.Test)

Example 45 with Ovm3ResourceException

use of com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException in project cloudstack by apache.

the class StoragePluginTest method testStorageFileInfo.

@Test
public void testStorageFileInfo() throws Ovm3ResourceException {
    con.setResult(results.simpleResponseWrapWrapper(FILECREATEXML));
    FileProperties file = sPt.storagePluginGetFileInfo(FSMNTUUID, NFSHOST, FILE);
    file.getName();
    file.getUuid();
    file.getType();
    file.getSize();
}
Also used : FileProperties(com.cloud.hypervisor.ovm3.objects.StoragePlugin.FileProperties) Test(org.junit.Test)

Aggregations

Ovm3ResourceException (com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException)41 Linux (com.cloud.hypervisor.ovm3.objects.Linux)13 Test (org.junit.Test)10 Answer (com.cloud.agent.api.Answer)9 DataTO (com.cloud.agent.api.to.DataTO)9 CloudstackPlugin (com.cloud.hypervisor.ovm3.objects.CloudstackPlugin)9 CopyCmdAnswer (org.apache.cloudstack.storage.command.CopyCmdAnswer)8 StoragePlugin (com.cloud.hypervisor.ovm3.objects.StoragePlugin)7 Xen (com.cloud.hypervisor.ovm3.objects.Xen)7 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)7 ConfigurationException (javax.naming.ConfigurationException)6 ConnectionTest (com.cloud.hypervisor.ovm3.objects.ConnectionTest)5 Pool (com.cloud.hypervisor.ovm3.objects.Pool)5 XenTest (com.cloud.hypervisor.ovm3.objects.XenTest)5 XmlTestResultTest (com.cloud.hypervisor.ovm3.objects.XmlTestResultTest)5 Ovm3SupportTest (com.cloud.hypervisor.ovm3.support.Ovm3SupportTest)5 CreateObjectAnswer (org.apache.cloudstack.storage.command.CreateObjectAnswer)5 SnapshotObjectTO (org.apache.cloudstack.storage.to.SnapshotObjectTO)5 CopyVolumeAnswer (com.cloud.agent.api.storage.CopyVolumeAnswer)4 VirtualMachineTO (com.cloud.agent.api.to.VirtualMachineTO)4