Examples of PhysicalDiskFormat


Examples of com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat

        }

        KVMStoragePool srcPool = disk.getPool();
        String destPath = newDisk.getPath();
        String sourcePath = disk.getPath();
        PhysicalDiskFormat sourceFormat = disk.getFormat();
        PhysicalDiskFormat destFormat = newDisk.getFormat();

        if ((srcPool.getType() != StoragePoolType.RBD) && (destPool.getType() != StoragePoolType.RBD)) {
            Script.runSimpleBashScript("qemu-img convert -f " + sourceFormat
                + " -O " + destFormat
                + " " + sourcePath
View Full Code Here

Examples of com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat

        }

        KVMStoragePool srcPool = disk.getPool();
        String destPath = newDisk.getPath();
        String sourcePath = disk.getPath();
        PhysicalDiskFormat sourceFormat = disk.getFormat();
        PhysicalDiskFormat destFormat = newDisk.getFormat();

        if ((srcPool.getType() != StoragePoolType.RBD) && (destPool.getType() != StoragePoolType.RBD)) {
            Script.runSimpleBashScript("qemu-img convert -f " + sourceFormat
                + " -O " + destFormat
                + " " + sourcePath
View Full Code Here

Examples of com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat

        }
    }

    private String getResizeScriptType (KVMStoragePool pool, KVMPhysicalDisk vol) {
        StoragePoolType poolType = pool.getType();
        PhysicalDiskFormat volFormat = vol.getFormat();
        
        if(pool.getType() == StoragePoolType.CLVM && volFormat == KVMPhysicalDisk.PhysicalDiskFormat.RAW) {
            return "CLVM";
        } else if ((poolType == StoragePoolType.NetworkFilesystem
                  || poolType == StoragePoolType.SharedMountPoint
View Full Code Here

Examples of com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat

        }
    }

    private String getResizeScriptType (KVMStoragePool pool, KVMPhysicalDisk vol) {
        StoragePoolType poolType = pool.getType();
        PhysicalDiskFormat volFormat = vol.getFormat();
        
        if(pool.getType() == StoragePoolType.CLVM && volFormat == KVMPhysicalDisk.PhysicalDiskFormat.RAW) {
            return "CLVM";
        } else if ((poolType == StoragePoolType.NetworkFilesystem
                  || poolType == StoragePoolType.SharedMountPoint
View Full Code Here

Examples of com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat

        }

        KVMStoragePool srcPool = disk.getPool();
        String destPath = newDisk.getPath();
        String sourcePath = disk.getPath();
        PhysicalDiskFormat sourceFormat = disk.getFormat();
        PhysicalDiskFormat destFormat = newDisk.getFormat();

        if ((srcPool.getType() != StoragePoolType.RBD) && (destPool.getType() != StoragePoolType.RBD)) {
            if (sourceFormat.equals(destFormat) &&
                Script.runSimpleBashScript("qemu-img info " + sourcePath + "|grep backing") == null) {
                Script.runSimpleBashScript("cp -f " + sourcePath + " " + destPath);
View Full Code Here

Examples of org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat

            It is however very unlikely that the destPool will be RBD, since it isn't supported
            for Secondary Storage
         */

        KVMStoragePool srcPool = disk.getPool();
        PhysicalDiskFormat sourceFormat = disk.getFormat();
        String sourcePath = disk.getPath();

        KVMPhysicalDisk newDisk;
        if (destPool.getType() != StoragePoolType.RBD) {
            if (disk.getFormat() == PhysicalDiskFormat.TAR) {
                newDisk = destPool.createPhysicalDisk(name, PhysicalDiskFormat.DIR, disk.getVirtualSize());
            } else {
                /* If the source device is on a RBD storage pool force the new disk to the same format (RAW) */
                if (srcPool.getType() != StoragePoolType.RBD) {
                    newDisk = destPool.createPhysicalDisk(name, disk.getVirtualSize());
                } else {
                    newDisk = destPool.createPhysicalDisk(name, sourceFormat, disk.getVirtualSize());
                }
            }
        } else {
            newDisk = new KVMPhysicalDisk(destPool.getSourceDir() + "/" + name, name, destPool);
            newDisk.setFormat(PhysicalDiskFormat.RAW);
            newDisk.setSize(disk.getVirtualSize());
            newDisk.setVirtualSize(disk.getSize());
        }

        String destPath = newDisk.getPath();
        PhysicalDiskFormat destFormat = newDisk.getFormat();

        QemuImg qemu = new QemuImg();
        QemuImgFile srcFile = null;
        QemuImgFile destFile = null;

View Full Code Here

Examples of org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat

        }
    }

    private String getResizeScriptType (KVMStoragePool pool, KVMPhysicalDisk vol) {
        StoragePoolType poolType = pool.getType();
        PhysicalDiskFormat volFormat = vol.getFormat();

        if(pool.getType() == StoragePoolType.CLVM && volFormat == PhysicalDiskFormat.RAW) {
            return "CLVM";
        } else if ((poolType == StoragePoolType.NetworkFilesystem
                  || poolType == StoragePoolType.SharedMountPoint
View Full Code Here

Examples of org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat

        assertEquals(file.getSize(), size);
    }

    @Test
    public void testFileNameAndSizeAndFormatAtContructor() {
        PhysicalDiskFormat format = PhysicalDiskFormat.RAW;
        long size = 1024;
        String filename = "/tmp/test-image.qcow2";
        QemuImgFile file = new QemuImgFile(filename, size, format);
        assertEquals(file.getFileName(), filename);
        assertEquals(file.getSize(), size);
View Full Code Here

Examples of org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat

        assertEquals(file.getFormat(), format);
    }

    @Test
    public void testFileNameAndFormatAtContructor() {
        PhysicalDiskFormat format = PhysicalDiskFormat.RAW;
        String filename = "/tmp/test-image.qcow2";
        QemuImgFile file = new QemuImgFile(filename, format);
        assertEquals(file.getFileName(), filename);
        assertEquals(file.getFormat(), format);
    }
View Full Code Here

Examples of org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat

    @Test
    public void testConvertAdvanced() throws QemuImgException {
        long srcSize = 4019200;
        String srcFileName = "/tmp/" + UUID.randomUUID() + ".qcow2";
        String destFileName = "/tmp/" + UUID.randomUUID() + ".qcow2";
        PhysicalDiskFormat srcFormat = PhysicalDiskFormat.RAW;
        PhysicalDiskFormat destFormat = PhysicalDiskFormat.QCOW2;

        QemuImgFile srcFile = new QemuImgFile(srcFileName, srcSize, srcFormat);
        QemuImgFile destFile = new QemuImgFile(destFileName, destFormat);

        QemuImg qemu = new QemuImg();
        qemu.create(srcFile);
        qemu.convert(srcFile, destFile);

        Map<String, String> info = qemu.info(destFile);

        PhysicalDiskFormat infoFormat = PhysicalDiskFormat.valueOf(info.get(new String("file_format")).toUpperCase());
        assertEquals(destFormat, infoFormat);

        Long infoSize = Long.parseLong(info.get(new String("virtual_size")));
        assertEquals(Long.valueOf(srcSize), Long.valueOf(infoSize));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.