Search in sources :

Example 11 with LibvirtStoragePoolDef

use of com.cloud.agent.resource.kvm.xml.LibvirtStoragePoolDef in project cosmic by MissionCriticalCloud.

the class LibvirtStorageAdaptor method createLVMStoragePool.

private StoragePool createLVMStoragePool(final Connect conn, final String uuid, final String path) {
    final LibvirtStoragePoolDef libvirtStoragePoolDef = new LibvirtStoragePoolDef();
    libvirtStoragePoolDef.setPoolName(uuid);
    libvirtStoragePoolDef.setUuid(uuid);
    libvirtStoragePoolDef.setTargetPath("/dev/" + path);
    libvirtStoragePoolDef.setSource(path);
    libvirtStoragePoolDef.setPoolType(PoolType.LOGICAL);
    try {
        this.logger.debug(libvirtStoragePoolDef.toString());
        return conn.storagePoolCreateXML(libvirtStoragePoolDef.toString(), 0);
    } catch (final LibvirtException e) {
        this.logger.error("Unable to add LVM storage pool: ", e);
        return null;
    }
}
Also used : LibvirtException(org.libvirt.LibvirtException) LibvirtStoragePoolDef(com.cloud.agent.resource.kvm.xml.LibvirtStoragePoolDef)

Aggregations

LibvirtStoragePoolDef (com.cloud.agent.resource.kvm.xml.LibvirtStoragePoolDef)11 LibvirtException (org.libvirt.LibvirtException)8 StoragePool (org.libvirt.StoragePool)6 PoolType (com.cloud.agent.resource.kvm.xml.LibvirtStoragePoolDef.PoolType)3 CloudRuntimeException (com.cloud.legacymodel.exceptions.CloudRuntimeException)3 Connect (org.libvirt.Connect)3 Secret (org.libvirt.Secret)2 LibvirtSecretDef (com.cloud.agent.resource.kvm.xml.LibvirtSecretDef)1 AuthenticationType (com.cloud.agent.resource.kvm.xml.LibvirtStoragePoolDef.AuthenticationType)1 StoragePoolType (com.cloud.model.enumeration.StoragePoolType)1