Package org.apache.cloudstack.utils.qemu

Examples of org.apache.cloudstack.utils.qemu.QemuImg.convert()


                    qemu.create(destFile, backingFile);
                } else if (format == PhysicalDiskFormat.RAW) {
                    QemuImgFile sourceFile = new QemuImgFile(template.getPath(), template.getFormat());
                    QemuImgFile destFile = new QemuImgFile(disk.getPath(), PhysicalDiskFormat.RAW);
                    QemuImg qemu = new QemuImg();
                    qemu.convert(sourceFile, destFile);
                }
            } else {
                format = PhysicalDiskFormat.RAW;
                disk = new KVMPhysicalDisk(destPool.getSourceDir() + "/" + newUuid, newUuid, destPool);
                disk.setFormat(format);
View Full Code Here


                        disk.getPath()));
                destFile.setFormat(format);

                if (srcPool.getType() != StoragePoolType.RBD) {
                    srcFile = new QemuImgFile(template.getPath(), template.getFormat());
                    qemu.convert(srcFile, destFile);
                } else {

                    /**
                     * We have to find out if the source file is in the same RBD pool and has
                     * RBD format 2 before we can do a layering/clone operation on the RBD image
View Full Code Here

                    if (sourceFormat.equals(destFormat) && backingFile == null) {
                        Script.runSimpleBashScript("cp -f " + sourcePath + " " + destPath);
                    } else {
                        destFile = new QemuImgFile(destPath, destFormat);
                        try {
                            qemu.convert(srcFile, destFile);
                        } catch (QemuImgException e) {
                            s_logger.error("Failed to convert " + srcFile.getFileName() + " to "
                                    + destFile.getFileName() + " the error was: " + e.getMessage());
                            newDisk = null;
                        }
View Full Code Here

            try {
                if (sourceFormat != destFormat) {
                    srcFile = new QemuImgFile(sourcePath, sourceFormat);
                    destFile = new QemuImgFile("/tmp/" + name);
                    s_logger.debug("Converting " + srcFile.getFileName() " to " + destFile.getFileName() " as a temporary file for RBD conversion");
                    qemu.convert(srcFile, destFile);
                    sourceFile = destFile.getFileName();
                    useTmpFile = true;
                } else {
                    // Source file is RAW, we can write directly to RBD
                    sourceFile = sourcePath;
View Full Code Here

            srcFile.setFormat(sourceFormat);
            destFile = new QemuImgFile(destPath);
            destFile.setFormat(destFormat);

            try {
                qemu.convert(srcFile, destFile);
            } catch (QemuImgException e) {
                s_logger.error("Failed to convert " + srcFile.getFileName() + " to "
                        + destFile.getFileName() + " the error was: " + e.getMessage());
                newDisk = null;
            }
View Full Code Here

                QemuImgFile destFile = new QemuImgFile(tmpltPath + "/" + cmd.getUniqueName() + ".qcow2");
                destFile.setFormat(PhysicalDiskFormat.QCOW2);

                QemuImg q = new QemuImg();
                try {
                    q.convert(srcFile, destFile);
                } catch (QemuImgException e) {
                    s_logger.error("Failed to create new template while converting "
                                    + srcFile.getFileName() + " to " + destFile.getFileName() + " the error was: " + e.getMessage());
                }
View Full Code Here

                QemuImgFile destFile = new QemuImgFile(tmpltPath + "/" + templateName + ".qcow2");
                destFile.setFormat(PhysicalDiskFormat.QCOW2);

                QemuImg q = new QemuImg();
                try {
                    q.convert(srcFile, destFile);
                } catch (QemuImgException e) {
                    s_logger.error("Failed to create new template while converting " + srcFile.getFileName() + " to "
                            + destFile.getFileName() + " the error was: " + e.getMessage());
                }
View Full Code Here

                    qemu.create(destFile, backingFile);
                } else if (format == PhysicalDiskFormat.RAW) {
                    QemuImgFile sourceFile = new QemuImgFile(template.getPath(), template.getFormat());
                    QemuImgFile destFile = new QemuImgFile(disk.getPath(), PhysicalDiskFormat.RAW);
                    QemuImg qemu = new QemuImg(timeout);
                    qemu.convert(sourceFile, destFile);
                }
            } else {
                format = PhysicalDiskFormat.RAW;
                disk = new KVMPhysicalDisk(destPool.getSourceDir() + "/" + newUuid, newUuid, destPool);
                disk.setFormat(format);
View Full Code Here

                        disk.getPath()));
                destFile.setFormat(format);

                if (srcPool.getType() != StoragePoolType.RBD) {
                    srcFile = new QemuImgFile(template.getPath(), template.getFormat());
                    qemu.convert(srcFile, destFile);
                } else {

                    /**
                     * We have to find out if the source file is in the same RBD pool and has
                     * RBD format 2 before we can do a layering/clone operation on the RBD image
View Full Code Here

                            throw new CloudRuntimeException("Failed to create disk: " + result);
                        }
                    } else {
                        destFile = new QemuImgFile(destPath, destFormat);
                        try {
                            qemu.convert(srcFile, destFile);
                        } catch (QemuImgException e) {
                            s_logger.error("Failed to convert " + srcFile.getFileName() + " to "
                                    + destFile.getFileName() + " the error was: " + e.getMessage());
                            newDisk = null;
                        }
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.