Move QemuImg to the package 'qemu' We probably will get more objects
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/f11affe1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/f11affe1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/f11affe1 Branch: refs/heads/qemu-img Commit: f11affe19ebec66017aef5cb0b632dffc24ccecc Parents: 9ae1221 Author: Wido den Hollander <w...@widodh.nl> Authored: Wed Feb 6 20:49:09 2013 +0100 Committer: Wido den Hollander <w...@42on.com> Committed: Thu Feb 14 15:01:59 2013 +0100 ---------------------------------------------------------------------- .../kvm/resource/LibvirtComputingResource.java | 2 +- .../kvm/resource/LibvirtDomainXMLParser.java | 2 +- .../hypervisor/kvm/storage/KVMPhysicalDisk.java | 2 +- .../hypervisor/kvm/storage/KVMStoragePool.java | 2 +- .../kvm/storage/KVMStoragePoolManager.java | 2 +- .../kvm/storage/LibvirtStorageAdaptor.java | 2 +- .../hypervisor/kvm/storage/LibvirtStoragePool.java | 2 +- .../hypervisor/kvm/storage/StorageAdaptor.java | 2 +- utils/src/org/apache/cloudstack/utils/QemuImg.java | 106 --------------- .../org/apache/cloudstack/utils/qemu/QemuImg.java | 106 +++++++++++++++ 10 files changed, 114 insertions(+), 114 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 92b8ac7..6c3b87d 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -55,7 +55,7 @@ import javax.ejb.Local; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; -import org.apache.cloudstack.utils.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; import org.libvirt.Connect; import org.libvirt.Domain; import org.libvirt.DomainInfo; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java index 26c8968..893dfa9 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java @@ -25,7 +25,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.apache.cloudstack.utils.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; import org.apache.log4j.Logger; import org.w3c.dom.Document; import org.w3c.dom.Element; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java index a3e3cee..907c251 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java @@ -16,7 +16,7 @@ // under the License. package com.cloud.hypervisor.kvm.storage; -import org.apache.cloudstack.utils.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; public class KVMPhysicalDisk { private String path; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePool.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePool.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePool.java index 956a6c1..9ab1216 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePool.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePool.java @@ -18,7 +18,7 @@ package com.cloud.hypervisor.kvm.storage; import java.util.List; -import org.apache.cloudstack.utils.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; import com.cloud.storage.Storage.StoragePoolType; public interface KVMStoragePool { http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java index 0ab7808..2a3b14e 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java @@ -23,7 +23,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.HashMap; import java.util.UUID; -import org.apache.cloudstack.utils.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; import com.cloud.hypervisor.kvm.resource.KVMHABase; import com.cloud.hypervisor.kvm.resource.KVMHABase.PoolType; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java index b809498..5aafc0c 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java @@ -24,7 +24,7 @@ import java.util.List; import java.util.UUID; import org.apache.log4j.Logger; import org.apache.commons.codec.binary.Base64; -import org.apache.cloudstack.utils.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; import org.libvirt.Connect; import org.libvirt.LibvirtException; import org.libvirt.Secret; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java index 688ab95..cba8aad 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java @@ -18,7 +18,7 @@ package com.cloud.hypervisor.kvm.storage; import java.util.List; -import org.apache.cloudstack.utils.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; import org.libvirt.StoragePool; import com.cloud.storage.Storage.StoragePoolType; http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/StorageAdaptor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/StorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/StorageAdaptor.java index 4e4e91b..dd75677 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/StorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/StorageAdaptor.java @@ -18,7 +18,7 @@ package com.cloud.hypervisor.kvm.storage; import java.util.List; -import org.apache.cloudstack.utils.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; import com.cloud.storage.Storage.StoragePoolType; public interface StorageAdaptor { http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/utils/src/org/apache/cloudstack/utils/QemuImg.java ---------------------------------------------------------------------- diff --git a/utils/src/org/apache/cloudstack/utils/QemuImg.java b/utils/src/org/apache/cloudstack/utils/QemuImg.java deleted file mode 100644 index 414022f..0000000 --- a/utils/src/org/apache/cloudstack/utils/QemuImg.java +++ /dev/null @@ -1,106 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package org.apache.cloudstack.utils; - -import com.cloud.utils.script.Script; - -import java.util.List; -import java.util.Map; - -public class QemuImg { - - /* The qemu-img binary. We expect this to be in $PATH */ - public static String _qemuImgPath = "qemu-img"; - - /* Shouldn't we have KVMPhysicalDisk and LibvirtVMDef read this? */ - public static enum PhysicalDiskFormat { - RAW("raw"), QCOW2("qcow2"), VMDK("vmdk"), FILE("file"), RBD("rbd"), SHEEPDOG("sheepdog"), HTTP("http"), HTTPS("https"); - String format; - - private PhysicalDiskFormat(String format) { - this.format = format; - } - - public String toString() { - return this.format; - } - } - - /* These are all methods supported by the qemu-img tool */ - - /* Perform a consistency check on the disk image */ - public static void check() { - - } - - /* Create a new disk image */ - public static void create(String filename, long size, PhysicalDiskFormat format, List<Map<String, String>> options) { - Script s = new Script(_qemuImgPath); - s.add("create"); - s.add("-f"); - s.add(format.toString()); - s.add(filename); - s.add(Long.toString(size)); - } - - public static void create(String filename, long size, PhysicalDiskFormat format) { - QemuImg.create(filename, size, format, null); - } - - /* Convert the disk image filename or a snapshot snapshot_name to disk image output_filename using format output_fmt. */ - public static void convert() { - - } - - /* Commit the changes recorded in filename in its base image */ - public static void commit(String filename, PhysicalDiskFormat format) { - - } - - public static void commit(String filename) { - QemuImg.commit(filename, null); - } - - /* Give information about the disk image */ - public static void info(String filename, PhysicalDiskFormat format) { - - } - - public static void info(String filename) { - QemuImg.info(filename, null); - } - - /* List, apply, create or delete snapshots in image */ - public static void snapshot() { - - } - - /* Changes the backing file of an image */ - public static void rebase() { - - } - - /* Resize a disk image */ - public static void resize(String filename, long size) { - String newSize = null; - if (size > 0) { - newSize = "+" + size; - } else { - newSize = "-" + size; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f11affe1/utils/src/org/apache/cloudstack/utils/qemu/QemuImg.java ---------------------------------------------------------------------- diff --git a/utils/src/org/apache/cloudstack/utils/qemu/QemuImg.java b/utils/src/org/apache/cloudstack/utils/qemu/QemuImg.java new file mode 100644 index 0000000..a853939 --- /dev/null +++ b/utils/src/org/apache/cloudstack/utils/qemu/QemuImg.java @@ -0,0 +1,106 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.utils.qemu; + +import com.cloud.utils.script.Script; + +import java.util.List; +import java.util.Map; + +public class QemuImg { + + /* The qemu-img binary. We expect this to be in $PATH */ + public static String _qemuImgPath = "qemu-img"; + + /* Shouldn't we have KVMPhysicalDisk and LibvirtVMDef read this? */ + public static enum PhysicalDiskFormat { + RAW("raw"), QCOW2("qcow2"), VMDK("vmdk"), FILE("file"), RBD("rbd"), SHEEPDOG("sheepdog"), HTTP("http"), HTTPS("https"); + String format; + + private PhysicalDiskFormat(String format) { + this.format = format; + } + + public String toString() { + return this.format; + } + } + + /* These are all methods supported by the qemu-img tool */ + + /* Perform a consistency check on the disk image */ + public static void check() { + + } + + /* Create a new disk image */ + public static void create(String filename, long size, PhysicalDiskFormat format, List<Map<String, String>> options) { + Script s = new Script(_qemuImgPath); + s.add("create"); + s.add("-f"); + s.add(format.toString()); + s.add(filename); + s.add(Long.toString(size)); + } + + public static void create(String filename, long size, PhysicalDiskFormat format) { + QemuImg.create(filename, size, format, null); + } + + /* Convert the disk image filename or a snapshot snapshot_name to disk image output_filename using format output_fmt. */ + public static void convert() { + + } + + /* Commit the changes recorded in filename in its base image */ + public static void commit(String filename, PhysicalDiskFormat format) { + + } + + public static void commit(String filename) { + QemuImg.commit(filename, null); + } + + /* Give information about the disk image */ + public static void info(String filename, PhysicalDiskFormat format) { + + } + + public static void info(String filename) { + QemuImg.info(filename, null); + } + + /* List, apply, create or delete snapshots in image */ + public static void snapshot() { + + } + + /* Changes the backing file of an image */ + public static void rebase() { + + } + + /* Resize a disk image */ + public static void resize(String filename, long size) { + String newSize = null; + if (size > 0) { + newSize = "+" + size; + } else { + newSize = "-" + size; + } + } +} \ No newline at end of file