Search in sources :

Example 6 with PoolType

use of com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.PoolType in project cosmic by MissionCriticalCloud.

the class LibvirtStoragePoolDefTest method testRbdStoragePool.

public void testRbdStoragePool() {
    final PoolType type = PoolType.RBD;
    final String name = "myRBDPool";
    final String uuid = "921ef8b2-955a-4c18-a697-66bb9adf6131";
    final String host = "127.0.0.1";
    final String dir = "cloudstackrbdpool";
    final String authUsername = "admin";
    final String secretUuid = "08c2fa02-50d0-4a78-8903-b742d3f34934";
    final AuthenticationType auth = AuthenticationType.CEPH;
    final int port = 6789;
    final LibvirtStoragePoolDef pool = new LibvirtStoragePoolDef(type, name, uuid, host, port, dir, authUsername, auth, secretUuid);
    final String expectedXml = "<pool type='" + type.toString() + "'>\n<name>" + name + "</name>\n<uuid>" + uuid + "</uuid>\n" + "<source>\n<host name='" + host + "' port='" + port + "'/>\n<name>" + dir + "</name>\n" + "<auth username='" + authUsername + "' type='" + auth.toString() + "'>\n<secret uuid='" + secretUuid + "'/>\n" + "</auth>\n</source>\n</pool>\n";
    assertEquals(expectedXml, pool.toString());
}
Also used : PoolType(com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.PoolType) AuthenticationType(com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.AuthenticationType)

Example 7 with PoolType

use of com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.PoolType in project cloudstack by apache.

the class LibvirtStoragePoolDefTest method testRbdStoragePoolWithoutPort.

public void testRbdStoragePoolWithoutPort() {
    PoolType type = PoolType.RBD;
    String name = "myRBDPool";
    String uuid = "30a5fb6f-7277-44ce-9065-67e2bfdb0ebb";
    String host = "::1";
    String dir = "rbd";
    String authUsername = "admin";
    String secretUuid = "d0d616dd-3446-409e-84d7-44465e325b35";
    AuthenticationType auth = AuthenticationType.CEPH;
    int port = 0;
    LibvirtStoragePoolDef pool = new LibvirtStoragePoolDef(type, name, uuid, host, port, dir, authUsername, auth, secretUuid);
    String expectedXml = "<pool type='" + type.toString() + "'>\n<name>" + name + "</name>\n<uuid>" + uuid + "</uuid>\n" + "<source>\n<host name='" + host + "'/>\n<name>" + dir + "</name>\n" + "<auth username='" + authUsername + "' type='" + auth.toString() + "'>\n<secret uuid='" + secretUuid + "'/>\n" + "</auth>\n</source>\n</pool>\n";
    assertEquals(expectedXml, pool.toString());
}
Also used : PoolType(com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.PoolType) AuthenticationType(com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.AuthenticationType)

Aggregations

PoolType (com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.PoolType)7 AuthenticationType (com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.AuthenticationType)3