You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2012/07/30 23:56:04 UTC

[3/8] Move KVM related code into plugins/hypervisor/kvm, a new jar file is created: cloud-kvm.jar

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtConnection.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtConnection.java b/agent/src/com/cloud/agent/resource/computing/LibvirtConnection.java
deleted file mode 100644
index d3a2318..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtConnection.java
+++ /dev/null
@@ -1,48 +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
-// with 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 com.cloud.agent.resource.computing;
-
-import org.apache.log4j.Logger;
-import org.libvirt.Connect;
-import org.libvirt.LibvirtException;
-
-public class LibvirtConnection {
-    private static final Logger s_logger = Logger
-            .getLogger(LibvirtConnection.class);
-    static private Connect _connection;
-    static private String _hypervisorURI;
-
-    static public Connect getConnection() throws LibvirtException {
-        if (_connection == null) {
-            _connection = new Connect(_hypervisorURI, false);
-        } else {
-            try {
-                _connection.getVersion();
-            } catch (LibvirtException e) {
-                s_logger.debug("Connection with libvirtd is broken, due to "
-                        + e.getMessage());
-                _connection = new Connect(_hypervisorURI, false);
-            }
-        }
-
-        return _connection;
-    }
-
-    static void initialize(String hypervisorURI) {
-        _hypervisorURI = hypervisorURI;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtDomainXMLParser.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtDomainXMLParser.java b/agent/src/com/cloud/agent/resource/computing/LibvirtDomainXMLParser.java
deleted file mode 100644
index 6215534..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtDomainXMLParser.java
+++ /dev/null
@@ -1,253 +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
-// with 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 com.cloud.agent.resource.computing;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import com.cloud.agent.resource.computing.LibvirtVMDef.DiskDef;
-import com.cloud.agent.resource.computing.LibvirtVMDef.InterfaceDef;
-import com.cloud.agent.resource.computing.LibvirtVMDef.InterfaceDef.nicModel;
-
-/**
- * @author chiradeep
- * 
- */
-public class LibvirtDomainXMLParser {
-    private static final Logger s_logger = Logger
-            .getLogger(LibvirtDomainXMLParser.class);
-    private final List<InterfaceDef> interfaces = new ArrayList<InterfaceDef>();
-    private final List<DiskDef> diskDefs = new ArrayList<DiskDef>();
-    private Integer vncPort;
-    private String desc;
-
-    public boolean parseDomainXML(String domXML) {
-        DocumentBuilder builder;
-        try {
-            builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-
-            InputSource is = new InputSource();
-            is.setCharacterStream(new StringReader(domXML));
-            Document doc = builder.parse(is);
-
-            Element rootElement = doc.getDocumentElement();
-
-            desc = getTagValue("description", rootElement);
-
-            Element devices = (Element) rootElement.getElementsByTagName(
-                    "devices").item(0);
-            NodeList disks = devices.getElementsByTagName("disk");
-            for (int i = 0; i < disks.getLength(); i++) {
-                Element disk = (Element) disks.item(i);
-                String diskFmtType = getAttrValue("driver", "type", disk);
-                String diskFile = getAttrValue("source", "file", disk);
-                String diskDev = getAttrValue("source", "dev", disk);
-
-                String diskLabel = getAttrValue("target", "dev", disk);
-                String bus = getAttrValue("target", "bus", disk);
-                String type = disk.getAttribute("type");
-                String device = disk.getAttribute("device");
-
-                DiskDef def = new DiskDef();
-                if (type.equalsIgnoreCase("file")) {
-                    if (device.equalsIgnoreCase("disk")) {
-                        DiskDef.diskFmtType fmt = null;
-                        if (diskFmtType != null) {
-                            fmt = DiskDef.diskFmtType.valueOf(diskFmtType
-                                    .toUpperCase());
-                        }
-                        def.defFileBasedDisk(diskFile, diskLabel,
-                                DiskDef.diskBus.valueOf(bus.toUpperCase()), fmt);
-                    } else if (device.equalsIgnoreCase("cdrom")) {
-                        def.defISODisk(diskFile);
-                    }
-                } else if (type.equalsIgnoreCase("block")) {
-                    def.defBlockBasedDisk(diskDev, diskLabel,
-                            DiskDef.diskBus.valueOf(bus.toUpperCase()));
-                }
-                diskDefs.add(def);
-            }
-
-            NodeList nics = devices.getElementsByTagName("interface");
-            for (int i = 0; i < nics.getLength(); i++) {
-                Element nic = (Element) nics.item(i);
-
-                String type = nic.getAttribute("type");
-                String mac = getAttrValue("mac", "address", nic);
-                String dev = getAttrValue("target", "dev", nic);
-                String model = getAttrValue("model", "type", nic);
-                InterfaceDef def = new InterfaceDef();
-
-                if (type.equalsIgnoreCase("network")) {
-                    String network = getAttrValue("source", "network", nic);
-                    def.defPrivateNet(network, dev, mac,
-                            nicModel.valueOf(model.toUpperCase()));
-                } else if (type.equalsIgnoreCase("bridge")) {
-                    String bridge = getAttrValue("source", "bridge", nic);
-                    def.defBridgeNet(bridge, dev, mac,
-                            nicModel.valueOf(model.toUpperCase()));
-                }
-                interfaces.add(def);
-            }
-
-            Element graphic = (Element) devices
-                    .getElementsByTagName("graphics").item(0);
-            String port = graphic.getAttribute("port");
-            if (port != null) {
-                try {
-                    vncPort = Integer.parseInt(port);
-                    if (vncPort != -1) {
-                        vncPort = vncPort - 5900;
-                    } else {
-                        vncPort = null;
-                    }
-                } catch (NumberFormatException nfe) {
-                    vncPort = null;
-                }
-            }
-
-            return true;
-        } catch (ParserConfigurationException e) {
-            s_logger.debug(e.toString());
-        } catch (SAXException e) {
-            s_logger.debug(e.toString());
-        } catch (IOException e) {
-            s_logger.debug(e.toString());
-        }
-        return false;
-    }
-
-    private static String getTagValue(String tag, Element eElement) {
-        NodeList tagNodeList = eElement.getElementsByTagName(tag);
-        if (tagNodeList == null || tagNodeList.getLength() == 0) {
-            return null;
-        }
-
-        NodeList nlList = tagNodeList.item(0).getChildNodes();
-
-        Node nValue = (Node) nlList.item(0);
-
-        return nValue.getNodeValue();
-    }
-
-    private static String getAttrValue(String tag, String attr, Element eElement) {
-        NodeList tagNode = eElement.getElementsByTagName(tag);
-        if (tagNode.getLength() == 0) {
-            return null;
-        }
-        Element node = (Element) tagNode.item(0);
-        return node.getAttribute(attr);
-    }
-
-    public Integer getVncPort() {
-        return vncPort;
-    }
-
-    public List<InterfaceDef> getInterfaces() {
-        return interfaces;
-    }
-
-    public List<DiskDef> getDisks() {
-        return diskDefs;
-    }
-
-    public String getDescription() {
-        return desc;
-    }
-
-    public static void main(String[] args) {
-        LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
-        parser.parseDomainXML("<domain type='kvm' id='12'>"
-                + "<name>r-6-CV-5002-1</name>"
-                + "<uuid>581b5a4b-b496-8d4d-e44e-a7dcbe9df0b5</uuid>"
-                + "<description>testVM</description>"
-                + "<memory>131072</memory>"
-                + "<currentMemory>131072</currentMemory>"
-                + "<vcpu>1</vcpu>"
-                + "<os>"
-                + "<type arch='i686' machine='pc-0.11'>hvm</type>"
-                + "<kernel>/var/lib/libvirt/qemu/vmlinuz-2.6.31.6-166.fc12.i686</kernel>"
-                + "<cmdline>ro root=/dev/sda1 acpi=force selinux=0 eth0ip=10.1.1.1 eth0mask=255.255.255.0 eth2ip=192.168.10.152 eth2mask=255.255.255.0 gateway=192.168.10.1 dns1=72.52.126.11 dns2=72.52.126.12 domain=v4.myvm.com</cmdline>"
-                + "<boot dev='hd'/>"
-                + "</os>"
-                + "<features>"
-                + "<acpi/>"
-                + "<pae/>"
-                + "</features>"
-                + "<clock offset='utc'/>"
-                + "<on_poweroff>destroy</on_poweroff>"
-                + "<on_reboot>restart</on_reboot>"
-                + "<on_crash>destroy</on_crash>"
-                + "<devices>"
-                + "<emulator>/usr/bin/qemu-kvm</emulator>"
-                + "<disk type='file' device='disk'>"
-                + "<driver name='qemu' type='raw'/>"
-                + "<source file='/mnt/tank//vmops/CV/vm/u000004/r000006/rootdisk'/>"
-                + "<target dev='hda' bus='ide'/>" + "</disk>"
-                + "<interface type='bridge'>"
-                + "<mac address='02:00:50:02:00:01'/>"
-                + "<source bridge='vnbr5002'/>" + "<target dev='vtap5002'/>"
-                + "<model type='e1000'/>" + "</interface>"
-                + "<interface type='network'>"
-                + "<mac address='00:16:3e:77:e2:a1'/>"
-                + "<source network='vmops-private'/>" + "<target dev='vnet3'/>"
-                + "<model type='e1000'/>" + "</interface>"
-                + "<interface type='bridge'>"
-                + "<mac address='06:85:00:00:00:04'/>"
-                + "<source bridge='br0'/>" + "<target dev='tap5002'/>"
-                + "<model type='e1000'/>" + "</interface>"
-                + "<input type='mouse' bus='ps2'/>"
-                + "<graphics type='vnc' port='6031' autoport='no' listen=''/>"
-                + "<video>" + "<model type='cirrus' vram='9216' heads='1'/>"
-                + "</video>" + "</devices>" + "</domain>"
-
-        );
-        for (InterfaceDef intf : parser.getInterfaces()) {
-            System.out.println(intf);
-        }
-        for (DiskDef disk : parser.getDisks()) {
-            System.out.println(disk);
-        }
-        System.out.println(parser.getVncPort());
-        System.out.println(parser.getDescription());
-
-        List<String> test = new ArrayList<String>(1);
-        test.add("1");
-        test.add("2");
-        if (test.contains("1")) {
-            System.out.print("fdf");
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtNetworkDef.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtNetworkDef.java b/agent/src/com/cloud/agent/resource/computing/LibvirtNetworkDef.java
deleted file mode 100644
index 7f757de..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtNetworkDef.java
+++ /dev/null
@@ -1,193 +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
-// with 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 com.cloud.agent.resource.computing;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class LibvirtNetworkDef {
-    enum netType {
-        BRIDGE, NAT, LOCAL
-    }
-
-    private final String _networkName;
-    private final String _uuid;
-    private netType _networkType;
-    private String _brName;
-    private boolean _stp;
-    private int _delay;
-    private String _fwDev;
-    private final String _domainName;
-    private String _brIPAddr;
-    private String _brNetMask;
-    private final List<IPRange> ipranges = new ArrayList<IPRange>();
-    private final List<dhcpMapping> dhcpMaps = new ArrayList<dhcpMapping>();
-
-    public static class dhcpMapping {
-        String _mac;
-        String _name;
-        String _ip;
-
-        public dhcpMapping(String mac, String name, String ip) {
-            _mac = mac;
-            _name = name;
-            _ip = ip;
-        }
-    }
-
-    public static class IPRange {
-        String _start;
-        String _end;
-
-        public IPRange(String start, String end) {
-            _start = start;
-            _end = end;
-        }
-    }
-
-    public LibvirtNetworkDef(String netName, String uuid, String domName) {
-        _networkName = netName;
-        _uuid = uuid;
-        _domainName = domName;
-    }
-
-    public void defNATNetwork(String brName, boolean stp, int delay,
-            String fwNic, String ipAddr, String netMask) {
-        _networkType = netType.NAT;
-        _brName = brName;
-        _stp = stp;
-        _delay = delay;
-        _fwDev = fwNic;
-        _brIPAddr = ipAddr;
-        _brNetMask = netMask;
-    }
-
-    public void defBrNetwork(String brName, boolean stp, int delay,
-            String fwNic, String ipAddr, String netMask) {
-        _networkType = netType.BRIDGE;
-        _brName = brName;
-        _stp = stp;
-        _delay = delay;
-        _fwDev = fwNic;
-        _brIPAddr = ipAddr;
-        _brNetMask = netMask;
-    }
-
-    public void defLocalNetwork(String brName, boolean stp, int delay,
-            String ipAddr, String netMask) {
-        _networkType = netType.LOCAL;
-        _brName = brName;
-        _stp = stp;
-        _delay = delay;
-        _brIPAddr = ipAddr;
-        _brNetMask = netMask;
-    }
-
-    public void adddhcpIPRange(String start, String end) {
-        IPRange ipr = new IPRange(start, end);
-        ipranges.add(ipr);
-    }
-
-    public void adddhcpMapping(String mac, String host, String ip) {
-        dhcpMapping map = new dhcpMapping(mac, host, ip);
-        dhcpMaps.add(map);
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder netBuilder = new StringBuilder();
-        netBuilder.append("<network>\n");
-        netBuilder.append("<name>" + _networkName + "</name>\n");
-        if (_uuid != null)
-            netBuilder.append("<uuid>" + _uuid + "</uuid>\n");
-        if (_brName != null) {
-            netBuilder.append("<bridge name='" + _brName + "'");
-            if (_stp) {
-                netBuilder.append(" stp='on'");
-            } else {
-                netBuilder.append(" stp='off'");
-            }
-            if (_delay != -1) {
-                netBuilder.append(" delay='" + _delay + "'");
-            }
-            netBuilder.append("/>\n");
-        }
-        if (_domainName != null) {
-            netBuilder.append("<domain name='" + _domainName + "'/>\n");
-        }
-        if (_networkType == netType.BRIDGE) {
-            netBuilder.append("<forward mode='route'");
-            if (_fwDev != null) {
-                netBuilder.append(" dev='" + _fwDev + "'");
-            }
-            netBuilder.append("/>\n");
-        } else if (_networkType == netType.NAT) {
-            netBuilder.append("<forward mode='nat'");
-            if (_fwDev != null) {
-                netBuilder.append(" dev='" + _fwDev + "'");
-            }
-            netBuilder.append("/>\n");
-        }
-        if (_brIPAddr != null || _brNetMask != null || !ipranges.isEmpty()
-                || !dhcpMaps.isEmpty()) {
-            netBuilder.append("<ip");
-            if (_brIPAddr != null)
-                netBuilder.append(" address='" + _brIPAddr + "'");
-            if (_brNetMask != null) {
-                netBuilder.append(" netmask='" + _brNetMask + "'");
-            }
-            netBuilder.append(">\n");
-
-            if (!ipranges.isEmpty() || !dhcpMaps.isEmpty()) {
-                netBuilder.append("<dhcp>\n");
-                for (IPRange ip : ipranges) {
-                    netBuilder.append("<range start='" + ip._start + "'"
-                            + " end='" + ip._end + "'/>\n");
-                }
-                for (dhcpMapping map : dhcpMaps) {
-                    netBuilder.append("<host mac='" + map._mac + "' name='"
-                            + map._name + "' ip='" + map._ip + "'/>\n");
-                }
-                netBuilder.append("</dhcp>\n");
-            }
-            netBuilder.append("</ip>\n");
-        }
-        netBuilder.append("</network>\n");
-        return netBuilder.toString();
-    }
-
-    /**
-     * @param args
-     */
-    public static void main(String[] args) {
-        LibvirtNetworkDef net = new LibvirtNetworkDef("cloudPrivate", null,
-                "cloud.com");
-        net.defNATNetwork("cloudbr0", false, 0, null, "192.168.168.1",
-                "255.255.255.0");
-        net.adddhcpIPRange("192.168.168.100", "192.168.168.220");
-        net.adddhcpIPRange("192.168.168.10", "192.168.168.50");
-        net.adddhcpMapping("branch0.cloud.com", "00:16:3e:77:e2:ed",
-                "192.168.168.100");
-        net.adddhcpMapping("branch1.cloud.com", "00:16:3e:77:e2:ef",
-                "192.168.168.101");
-        net.adddhcpMapping("branch2.cloud.com", "00:16:3e:77:e2:f0",
-                "192.168.168.102");
-        System.out.println(net.toString());
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtSecretDef.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtSecretDef.java b/agent/src/com/cloud/agent/resource/computing/LibvirtSecretDef.java
deleted file mode 100644
index f7e10c3..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtSecretDef.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
-// with 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 com.cloud.agent.resource.computing;
-
-public class LibvirtSecretDef {
-
-	public enum usage {
-		VOLUME("volume"), CEPH("ceph");
-		String _usage;
-
-		usage(String usage) {
-			_usage = usage;
-		}
-
-		@Override
-		public String toString() {
-			return _usage;
-		}
-	}
-
-	private usage _usage;
-	private boolean _ephemeral;
-	private boolean _private;
-	private String _uuid;
-	private String _description;
-	private String _cephName;
-	private String _volumeVolume;
-
-	public LibvirtSecretDef (usage usage, String uuid) {
-		_usage = usage;
-		_uuid = uuid;
-	}
-
-	public LibvirtSecretDef (usage usage, String uuid, String description) {
-		_usage = usage;
-		_uuid = uuid;
-		_description = description;
-	}
-
-	public boolean getEphemeral() {
-		return _ephemeral;
-	}
-
-	public boolean getPrivate() {
-		return _private;
-	}
-
-	public String getUuid() {
-		return _uuid;
-	}
-
-	public String getDescription() {
-		return _description;
-	}
-
-	public String getVolumeVolume() {
-		return _volumeVolume;
-	}
-
-	public String getCephName() {
-		return _cephName;
-	}
-
-	public void setVolumeVolume(String volume) {
-		_volumeVolume = volume;
-	}
-
-	public void setCephName(String name) {
-		_cephName = name;
-	}
-
-	@Override
-	public String toString() {
-		StringBuilder secretBuilder = new StringBuilder();
-		secretBuilder.append("<secret ephemeral='" + (_ephemeral ? "yes" : "no") + "' private='" + (_private ? "yes" : "no") + "'>\n");
-		secretBuilder.append("<uuid>" + _uuid + "</uuid>\n");
-		if (_description != null) {
-			secretBuilder.append("<description>" + _description + "</description>\n");
-		}
-		secretBuilder.append("<usage type='" + _usage + "'>\n");
-		if (_usage == _usage.VOLUME) {
-			secretBuilder.append("<volume>" + _volumeVolume + "</volume>\n");
-		}
-		if (_usage == _usage.CEPH) {
-			secretBuilder.append("<name>" + _cephName + "</name>\n");
-		}
-		secretBuilder.append("</usage>\n");
-		secretBuilder.append("</secret>\n");
-		return secretBuilder.toString();
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolDef.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolDef.java b/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolDef.java
deleted file mode 100644
index 9c28528..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolDef.java
+++ /dev/null
@@ -1,162 +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
-// with 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 com.cloud.agent.resource.computing;
-
-public class LibvirtStoragePoolDef {
-    public enum poolType {
-        ISCSI("iscsi"), NETFS("netfs"), LOGICAL("logical"), DIR("dir"), RBD("rbd");
-        String _poolType;
-
-        poolType(String poolType) {
-            _poolType = poolType;
-        }
-
-        @Override
-        public String toString() {
-            return _poolType;
-        }
-    }
-
-    public enum authType {
-        CHAP("chap"), CEPH("ceph");
-        String _authType;
-
-        authType(String authType) {
-            _authType = authType;
-        }
-
-        @Override
-        public String toString() {
-            return _authType;
-        }
-    }
-
-    private poolType _poolType;
-    private String _poolName;
-    private String _uuid;
-    private String _sourceHost;
-    private int _sourcePort;
-    private String _sourceDir;
-    private String _targetPath;
-    private String _authUsername;
-    private authType _authType;
-    private String _secretUuid;
-
-    public LibvirtStoragePoolDef(poolType type, String poolName, String uuid,
-            String host, int port, String dir, String targetPath) {
-        _poolType = type;
-        _poolName = poolName;
-        _uuid = uuid;
-        _sourceHost = host;
-        _sourcePort = port;
-        _sourceDir = dir;
-        _targetPath = targetPath;
-    }
-
-    public LibvirtStoragePoolDef(poolType type, String poolName, String uuid,
-            String host, String dir, String targetPath) {
-        _poolType = type;
-        _poolName = poolName;
-        _uuid = uuid;
-        _sourceHost = host;
-        _sourceDir = dir;
-        _targetPath = targetPath;
-    }
-
-    public LibvirtStoragePoolDef(poolType type, String poolName, String uuid,
-            String sourceHost, int sourcePort, String dir, String authUsername,
-            authType authType, String secretUuid) {
-        _poolType = type;
-        _poolName = poolName;
-        _uuid = uuid;
-        _sourceHost = sourceHost;
-        _sourcePort = sourcePort;
-        _sourceDir = dir;
-        _authUsername = authUsername;
-        _authType = authType;
-        _secretUuid = secretUuid;
-    }
-
-    public String getPoolName() {
-        return _poolName;
-    }
-
-    public poolType getPoolType() {
-        return _poolType;
-    }
-
-    public String getSourceHost() {
-        return _sourceHost;
-    }
-
-    public int getSourcePort() {
-        return _sourcePort;
-    }
-
-    public String getSourceDir() {
-        return _sourceDir;
-    }
-
-    public String getTargetPath() {
-        return _targetPath;
-    }
-
-    public String getAuthUserName() {
-        return _authUsername;
-    }
-
-    public String getSecretUUID() {
-        return _secretUuid;
-    }
-
-    public authType getAuthType() {
-        return _authType;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder storagePoolBuilder = new StringBuilder();
-        storagePoolBuilder.append("<pool type='" + _poolType + "'>\n");
-        storagePoolBuilder.append("<name>" + _poolName + "</name>\n");
-        if (_uuid != null)
-            storagePoolBuilder.append("<uuid>" + _uuid + "</uuid>\n");
-        if (_poolType == poolType.NETFS) {
-            storagePoolBuilder.append("<source>\n");
-            storagePoolBuilder.append("<host name='" + _sourceHost + "'/>\n");
-            storagePoolBuilder.append("<dir path='" + _sourceDir + "'/>\n");
-            storagePoolBuilder.append("</source>\n");
-        }
-        if (_poolType == poolType.RBD) {
-            storagePoolBuilder.append("<source>\n");
-            storagePoolBuilder.append("<host name='" + _sourceHost + "' port='" + _sourcePort + "'/>\n");
-            storagePoolBuilder.append("<name>" + _sourceDir + "</name>\n");
-            if (_authUsername != null) {
-                storagePoolBuilder.append("<auth username='" + _authUsername + "' type='" + _authType + "'>\n");
-                storagePoolBuilder.append("<secret uuid='" + _secretUuid + "'/>\n");
-                storagePoolBuilder.append("</auth>\n");
-            }
-            storagePoolBuilder.append("</source>\n");
-        }
-        if (_poolType != poolType.RBD) {
-            storagePoolBuilder.append("<target>\n");
-            storagePoolBuilder.append("<path>" + _targetPath + "</path>\n");
-            storagePoolBuilder.append("</target>\n");
-        }
-        storagePoolBuilder.append("</pool>\n");
-        return storagePoolBuilder.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolXMLParser.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolXMLParser.java b/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolXMLParser.java
deleted file mode 100644
index cff4c2b..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolXMLParser.java
+++ /dev/null
@@ -1,128 +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
-// with 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 com.cloud.agent.resource.computing;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.*;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class LibvirtStoragePoolXMLParser {
-    private static final Logger s_logger = Logger
-            .getLogger(LibvirtStoragePoolXMLParser.class);
-
-    public LibvirtStoragePoolDef parseStoragePoolXML(String poolXML) {
-        DocumentBuilder builder;
-        try {
-            builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-
-            InputSource is = new InputSource();
-            is.setCharacterStream(new StringReader(poolXML));
-            Document doc = builder.parse(is);
-
-            Element rootElement = doc.getDocumentElement();
-            String type = rootElement.getAttribute("type");
-
-            String uuid = getTagValue("uuid", rootElement);
-
-            String poolName = getTagValue("name", rootElement);
-
-            Element source = (Element) rootElement.getElementsByTagName(
-                    "source").item(0);
-            String host = getAttrValue("host", "name", source);
-
-            if (type.equalsIgnoreCase("rbd")) {
-                int port = Integer.parseInt(getAttrValue("host", "port", source));
-                String pool = getTagValue("name", source);
-
-                Element auth = (Element) source.getElementsByTagName(
-                    "auth").item(0);
-
-                if (auth != null) {
-                    String authUsername = auth.getAttribute("username");
-                    String authType = auth.getAttribute("type");
-                    return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(type.toUpperCase()),
-                        poolName, uuid, host, port, pool, authUsername, LibvirtStoragePoolDef.authType.valueOf(authType.toUpperCase()), uuid);
-                } else {
-                    return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(type.toUpperCase()),
-                        poolName, uuid, host, port, pool, "");
-                }
-            } else {
-                String path = getAttrValue("dir", "path", source);
-
-                Element target = (Element) rootElement.getElementsByTagName(
-                        "target").item(0);
-                String targetPath = getTagValue("path", target);
-
-                return new LibvirtStoragePoolDef(
-                        LibvirtStoragePoolDef.poolType.valueOf(type.toUpperCase()),
-                        poolName, uuid, host, path, targetPath);
-            }
-        } catch (ParserConfigurationException e) {
-            s_logger.debug(e.toString());
-        } catch (SAXException e) {
-            s_logger.debug(e.toString());
-        } catch (IOException e) {
-            s_logger.debug(e.toString());
-        }
-        return null;
-    }
-
-    private static String getTagValue(String tag, Element eElement) {
-        NodeList nlList = eElement.getElementsByTagName(tag).item(0)
-                .getChildNodes();
-        Node nValue = (Node) nlList.item(0);
-
-        return nValue.getNodeValue();
-    }
-
-    private static String getAttrValue(String tag, String attr, Element eElement) {
-        NodeList tagNode = eElement.getElementsByTagName(tag);
-        if (tagNode.getLength() == 0) {
-            return null;
-        }
-        Element node = (Element) tagNode.item(0);
-        return node.getAttribute(attr);
-    }
-
-    public static void main(String[] args) {
-        s_logger.addAppender(new org.apache.log4j.ConsoleAppender(
-                new org.apache.log4j.PatternLayout(), "System.out"));
-        String storagePool = "<pool type='dir'>" + "<name>test</name>"
-                + "<uuid>bf723c83-4b95-259c-7089-60776e61a11f</uuid>"
-                + "<capacity>20314165248</capacity>"
-                + "<allocation>1955450880</allocation>"
-                + "<available>18358714368</available>" + "<source>"
-                + "<host name='nfs1.lab.vmops.com'/>"
-                + "<dir path='/export/home/edison/kvm/primary'/>"
-                + "<format type='auto'/>" + "</source>" + "<target>"
-                + "<path>/media</path>" + "<permissions>" + "<mode>0700</mode>"
-                + "<owner>0</owner>" + "<group>0</group>" + "</permissions>"
-                + "</target>" + "</pool>";
-
-        LibvirtStoragePoolXMLParser parser = new LibvirtStoragePoolXMLParser();
-        LibvirtStoragePoolDef pool = parser.parseStoragePoolXML(storagePool);
-        s_logger.debug(pool.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeDef.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeDef.java b/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeDef.java
deleted file mode 100644
index ef8e22e..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeDef.java
+++ /dev/null
@@ -1,91 +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
-// with 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 com.cloud.agent.resource.computing;
-
-public class LibvirtStorageVolumeDef {
-    public enum volFormat {
-        RAW("raw"), QCOW2("qcow2"), DIR("dir");
-        private String _format;
-
-        volFormat(String format) {
-            _format = format;
-        }
-
-        @Override
-        public String toString() {
-            return _format;
-        }
-
-        public static volFormat getFormat(String format) {
-            if (format == null) {
-                return null;
-            }
-            if (format.equalsIgnoreCase("raw")) {
-                return RAW;
-            } else if (format.equalsIgnoreCase("qcow2")) {
-                return QCOW2;
-            }
-            return null;
-        }
-    }
-
-    private String _volName;
-    private Long _volSize;
-    private volFormat _volFormat;
-    private String _backingPath;
-    private volFormat _backingFormat;
-
-    public LibvirtStorageVolumeDef(String volName, Long size, volFormat format,
-            String tmplPath, volFormat tmplFormat) {
-        _volName = volName;
-        _volSize = size;
-        _volFormat = format;
-        _backingPath = tmplPath;
-        _backingFormat = tmplFormat;
-    }
-
-    public volFormat getFormat() {
-        return this._volFormat;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder storageVolBuilder = new StringBuilder();
-        storageVolBuilder.append("<volume>\n");
-        storageVolBuilder.append("<name>" + _volName + "</name>\n");
-        if (_volSize != null) {
-            storageVolBuilder
-                    .append("<capacity >" + _volSize + "</capacity>\n");
-        }
-        storageVolBuilder.append("<target>\n");
-        storageVolBuilder.append("<format type='" + _volFormat + "'/>\n");
-        storageVolBuilder.append("<permissions>");
-        storageVolBuilder.append("<mode>0744</mode>");
-        storageVolBuilder.append("</permissions>");
-        storageVolBuilder.append("</target>\n");
-        if (_backingPath != null) {
-            storageVolBuilder.append("<backingStore>\n");
-            storageVolBuilder.append("<path>" + _backingPath + "</path>\n");
-            storageVolBuilder.append("<format type='" + _backingFormat
-                    + "'/>\n");
-            storageVolBuilder.append("</backingStore>\n");
-        }
-        storageVolBuilder.append("</volume>\n");
-        return storageVolBuilder.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeXMLParser.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeXMLParser.java b/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeXMLParser.java
deleted file mode 100644
index 163ca2b..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeXMLParser.java
+++ /dev/null
@@ -1,104 +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
-// with 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 com.cloud.agent.resource.computing;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class LibvirtStorageVolumeXMLParser {
-    private static final Logger s_logger = Logger
-            .getLogger(LibvirtStorageVolumeXMLParser.class);
-
-    public LibvirtStorageVolumeDef parseStorageVolumeXML(String volXML) {
-        DocumentBuilder builder;
-        try {
-            builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-
-            InputSource is = new InputSource();
-            is.setCharacterStream(new StringReader(volXML));
-            Document doc = builder.parse(is);
-
-            Element rootElement = doc.getDocumentElement();
-
-            String VolName = getTagValue("name", rootElement);
-            Element target = (Element) rootElement.getElementsByTagName(
-                    "target").item(0);
-            String format = getAttrValue("type", "format", target);
-            Long capacity = Long
-                    .parseLong(getTagValue("capacity", rootElement));
-            return new LibvirtStorageVolumeDef(VolName, capacity,
-                    LibvirtStorageVolumeDef.volFormat.getFormat(format), null,
-                    null);
-        } catch (ParserConfigurationException e) {
-            s_logger.debug(e.toString());
-        } catch (SAXException e) {
-            s_logger.debug(e.toString());
-        } catch (IOException e) {
-            s_logger.debug(e.toString());
-        }
-        return null;
-    }
-
-    private static String getTagValue(String tag, Element eElement) {
-        NodeList nlList = eElement.getElementsByTagName(tag).item(0)
-                .getChildNodes();
-        Node nValue = (Node) nlList.item(0);
-
-        return nValue.getNodeValue();
-    }
-
-    private static String getAttrValue(String tag, String attr, Element eElement) {
-        NodeList tagNode = eElement.getElementsByTagName(tag);
-        if (tagNode.getLength() == 0) {
-            return null;
-        }
-        Element node = (Element) tagNode.item(0);
-        return node.getAttribute(attr);
-    }
-
-    public static void main(String[] args) {
-        s_logger.addAppender(new org.apache.log4j.ConsoleAppender(
-                new org.apache.log4j.PatternLayout(), "System.out"));
-        String storagePool = "<pool type='dir'>" + "<name>test</name>"
-                + "<uuid>bf723c83-4b95-259c-7089-60776e61a11f</uuid>"
-                + "<capacity>20314165248</capacity>"
-                + "<allocation>1955450880</allocation>"
-                + "<available>18358714368</available>" + "<source>"
-                + "<host name='nfs1.lab.vmops.com'/>"
-                + "<dir path='/export/home/edison/kvm/primary'/>"
-                + "<format type='auto'/>" + "</source>" + "<target>"
-                + "<path>/media</path>" + "<permissions>" + "<mode>0700</mode>"
-                + "<owner>0</owner>" + "<group>0</group>" + "</permissions>"
-                + "</target>" + "</pool>";
-
-        LibvirtStoragePoolXMLParser parser = new LibvirtStoragePoolXMLParser();
-        LibvirtStoragePoolDef pool = parser.parseStoragePoolXML(storagePool);
-        s_logger.debug(pool.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java b/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java
deleted file mode 100644
index 3b07bcd..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java
+++ /dev/null
@@ -1,964 +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
-// with 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 com.cloud.agent.resource.computing;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-public class LibvirtVMDef {
-    private String _hvsType;
-    private String _domName;
-    private String _domUUID;
-    private String _desc;
-    private final Map<String, Object> components = new HashMap<String, Object>();
-
-    public static class GuestDef {
-        enum guestType {
-            KVM, XEN, EXE
-        }
-
-        enum bootOrder {
-            HARDISK("hd"), CDROM("cdrom"), FLOOPY("fd"), NETWORK("network");
-            String _order;
-
-            bootOrder(String order) {
-                _order = order;
-            }
-
-            @Override
-            public String toString() {
-                return _order;
-            }
-        }
-
-        private guestType _type;
-        private String _arch;
-        private String _loader;
-        private String _kernel;
-        private String _initrd;
-        private String _root;
-        private String _cmdline;
-        private List<bootOrder> _bootdevs = new ArrayList<bootOrder>();
-        private String _machine;
-
-        public void setGuestType(guestType type) {
-            _type = type;
-        }
-
-        public void setGuestArch(String arch) {
-            _arch = arch;
-        }
-
-        public void setMachineType(String machine) {
-            _machine = machine;
-        }
-
-        public void setLoader(String loader) {
-            _loader = loader;
-        }
-
-        public void setBootKernel(String kernel, String initrd, String rootdev,
-                String cmdline) {
-            _kernel = kernel;
-            _initrd = initrd;
-            _root = rootdev;
-            _cmdline = cmdline;
-        }
-
-        public void setBootOrder(bootOrder order) {
-            _bootdevs.add(order);
-        }
-
-        @Override
-        public String toString() {
-            if (_type == guestType.KVM) {
-                StringBuilder guestDef = new StringBuilder();
-                guestDef.append("<os>\n");
-                guestDef.append("<type ");
-                if (_arch != null) {
-                    guestDef.append(" arch='" + _arch + "'");
-                }
-                if (_machine != null) {
-                    guestDef.append(" machine='" + _machine + "'");
-                }
-                guestDef.append(">hvm</type>\n");
-                if (!_bootdevs.isEmpty()) {
-                    for (bootOrder bo : _bootdevs) {
-                        guestDef.append("<boot dev='" + bo + "'/>\n");
-                    }
-                }
-                guestDef.append("</os>\n");
-                return guestDef.toString();
-            } else
-                return null;
-        }
-    }
-
-    public static class GuestResourceDef {
-        private long _mem;
-        private int _currentMem = -1;
-        private String _memBacking;
-        private int _vcpu = -1;
-
-        public void setMemorySize(long mem) {
-            _mem = mem;
-        }
-
-        public void setCurrentMem(int currMem) {
-            _currentMem = currMem;
-        }
-
-        public void setMemBacking(String memBacking) {
-            _memBacking = memBacking;
-        }
-
-        public void setVcpuNum(int vcpu) {
-            _vcpu = vcpu;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder resBuidler = new StringBuilder();
-            resBuidler.append("<memory>" + _mem + "</memory>\n");
-            if (_currentMem != -1) {
-                resBuidler.append("<currentMemory>" + _currentMem
-                        + "</currentMemory>\n");
-            }
-            if (_memBacking != null) {
-                resBuidler.append("<memoryBacking>" + "<" + _memBacking + "/>"
-                        + "</memoryBacking>\n");
-            }
-            if (_vcpu != -1) {
-                resBuidler.append("<vcpu>" + _vcpu + "</vcpu>\n");
-            }
-            return resBuidler.toString();
-        }
-    }
-
-    public static class FeaturesDef {
-        private final List<String> _features = new ArrayList<String>();
-
-        public void addFeatures(String feature) {
-            _features.add(feature);
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder feaBuilder = new StringBuilder();
-            feaBuilder.append("<features>\n");
-            for (String feature : _features) {
-                feaBuilder.append("<" + feature + "/>\n");
-            }
-            feaBuilder.append("</features>\n");
-            return feaBuilder.toString();
-        }
-    }
-
-    public static class TermPolicy {
-        private String _reboot;
-        private String _powerOff;
-        private String _crash;
-
-        public TermPolicy() {
-            _reboot = _powerOff = _crash = "destroy";
-        }
-
-        public void setRebootPolicy(String rbPolicy) {
-            _reboot = rbPolicy;
-        }
-
-        public void setPowerOffPolicy(String poPolicy) {
-            _powerOff = poPolicy;
-        }
-
-        public void setCrashPolicy(String crashPolicy) {
-            _crash = crashPolicy;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder term = new StringBuilder();
-            term.append("<on_reboot>" + _reboot + "</on_reboot>\n");
-            term.append("<on_poweroff>" + _powerOff + "</on_poweroff>\n");
-            term.append("<on_crash>" + _powerOff + "</on_crash>\n");
-            return term.toString();
-        }
-    }
-
-    public static class ClockDef {
-        public enum ClockOffset {
-            UTC("utc"), LOCALTIME("localtime"), TIMEZONE("timezone"), VARIABLE(
-                    "variable");
-
-            private String _offset;
-
-            private ClockOffset(String offset) {
-                _offset = offset;
-            }
-
-            @Override
-            public String toString() {
-                return _offset;
-            }
-        }
-
-        private ClockOffset _offset;
-        private String _timerName;
-        private String _tickPolicy;
-        private String _track;
-
-        public ClockDef() {
-            _offset = ClockOffset.UTC;
-        }
-
-        public void setClockOffset(ClockOffset offset) {
-            _offset = offset;
-        }
-
-        public void setTimer(String timerName, String tickPolicy, String track) {
-            _timerName = timerName;
-            _tickPolicy = tickPolicy;
-            _track = track;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder clockBuilder = new StringBuilder();
-            clockBuilder.append("<clock offset='");
-            clockBuilder.append(_offset.toString());
-            clockBuilder.append("'>\n");
-            if (_timerName != null) {
-                clockBuilder.append("<timer name='");
-                clockBuilder.append(_timerName);
-                clockBuilder.append("' ");
-
-                if (_tickPolicy != null) {
-                    clockBuilder.append("tickpolicy='");
-                    clockBuilder.append(_tickPolicy);
-                    clockBuilder.append("' ");
-                }
-
-                if (_track != null) {
-                    clockBuilder.append("track='");
-                    clockBuilder.append(_track);
-                    clockBuilder.append("' ");
-                }
-
-                clockBuilder.append(">\n");
-                clockBuilder.append("</timer>\n");
-            }
-            clockBuilder.append("</clock>\n");
-            return clockBuilder.toString();
-        }
-    }
-
-    public static class DevicesDef {
-        private String _emulator;
-        private final Map<String, List<?>> devices = new HashMap<String, List<?>>();
-
-        public boolean addDevice(Object device) {
-            Object dev = devices.get(device.getClass().toString());
-            if (dev == null) {
-                List<Object> devs = new ArrayList<Object>();
-                devs.add(device);
-                devices.put(device.getClass().toString(), devs);
-            } else {
-                List<Object> devs = (List<Object>) dev;
-                devs.add(device);
-            }
-            return true;
-        }
-
-        public void setEmulatorPath(String emulator) {
-            _emulator = emulator;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder devicesBuilder = new StringBuilder();
-            devicesBuilder.append("<devices>\n");
-            if (_emulator != null) {
-                devicesBuilder.append("<emulator>" + _emulator
-                        + "</emulator>\n");
-            }
-
-            for (List<?> devs : devices.values()) {
-                for (Object dev : devs) {
-                    devicesBuilder.append(dev.toString());
-                }
-            }
-            devicesBuilder.append("</devices>\n");
-            return devicesBuilder.toString();
-        }
-
-        @SuppressWarnings("unchecked")
-        public List<DiskDef> getDisks() {
-            return (List<DiskDef>) devices.get(DiskDef.class.toString());
-        }
-
-        @SuppressWarnings("unchecked")
-        public List<InterfaceDef> getInterfaces() {
-            return (List<InterfaceDef>) devices.get(InterfaceDef.class
-                    .toString());
-        }
-
-    }
-
-    public static class DiskDef {
-        enum deviceType {
-            FLOOPY("floopy"), DISK("disk"), CDROM("cdrom");
-            String _type;
-
-            deviceType(String type) {
-                _type = type;
-            }
-
-            @Override
-            public String toString() {
-                return _type;
-            }
-        }
-
-        enum diskType {
-            FILE("file"), BLOCK("block"), DIRECTROY("dir"), NETWORK("network");
-            String _diskType;
-
-            diskType(String type) {
-                _diskType = type;
-            }
-
-            @Override
-            public String toString() {
-                return _diskType;
-            }
-        }
-
-        enum diskProtocol {
-            RBD("rbd"), SHEEPDOG("sheepdog");
-            String _diskProtocol;
-
-            diskProtocol(String protocol) {
-                _diskProtocol = protocol;
-            }
-
-            @Override
-            public String toString() {
-                return _diskProtocol;
-            }
-        }
-
-        enum diskBus {
-            IDE("ide"), SCSI("scsi"), VIRTIO("virtio"), XEN("xen"), USB("usb"), UML(
-                    "uml"), FDC("fdc");
-            String _bus;
-
-            diskBus(String bus) {
-                _bus = bus;
-            }
-
-            @Override
-            public String toString() {
-                return _bus;
-            }
-        }
-
-        enum diskFmtType {
-            RAW("raw"), QCOW2("qcow2");
-            String _fmtType;
-
-            diskFmtType(String fmt) {
-                _fmtType = fmt;
-            }
-
-            @Override
-            public String toString() {
-                return _fmtType;
-            }
-        }
-
-        private deviceType _deviceType; /* floppy, disk, cdrom */
-        private diskType _diskType;
-        private diskProtocol _diskProtocol;
-        private String _sourcePath;
-        private String _sourceHost;
-        private int _sourcePort;
-        private String _authUserName;
-        private String _authSecretUUID;
-        private String _diskLabel;
-        private diskBus _bus;
-        private diskFmtType _diskFmtType; /* qcow2, raw etc. */
-        private boolean _readonly = false;
-        private boolean _shareable = false;
-        private boolean _deferAttach = false;
-
-        public void setDeviceType(deviceType deviceType) {
-            _deviceType = deviceType;
-        }
-
-        public void defFileBasedDisk(String filePath, String diskLabel,
-                diskBus bus, diskFmtType diskFmtType) {
-            _diskType = diskType.FILE;
-            _deviceType = deviceType.DISK;
-            _sourcePath = filePath;
-            _diskLabel = diskLabel;
-            _diskFmtType = diskFmtType;
-            _bus = bus;
-
-        }
-
-        /* skip iso label */
-        private String getDevLabel(int devId, diskBus bus) {
-            if (devId == 2) {
-                devId++;
-            }
-
-            char suffix = (char) ('a' + devId);
-            if (bus == diskBus.SCSI) {
-                return "sd" + suffix;
-            } else if (bus == diskBus.VIRTIO) {
-                return "vd" + suffix;
-            }
-            return "hd" + suffix;
-
-        }
-
-        public void defFileBasedDisk(String filePath, int devId, diskBus bus,
-                diskFmtType diskFmtType) {
-
-            _diskType = diskType.FILE;
-            _deviceType = deviceType.DISK;
-            _sourcePath = filePath;
-            _diskLabel = getDevLabel(devId, bus);
-            _diskFmtType = diskFmtType;
-            _bus = bus;
-
-        }
-
-        public void defISODisk(String volPath) {
-            _diskType = diskType.FILE;
-            _deviceType = deviceType.CDROM;
-            _sourcePath = volPath;
-            _diskLabel = "hdc";
-            _diskFmtType = diskFmtType.RAW;
-            _bus = diskBus.IDE;
-        }
-
-        public void defBlockBasedDisk(String diskName, int devId, diskBus bus) {
-            _diskType = diskType.BLOCK;
-            _deviceType = deviceType.DISK;
-            _diskFmtType = diskFmtType.RAW;
-            _sourcePath = diskName;
-            _diskLabel = getDevLabel(devId, bus);
-            _bus = bus;
-        }
-
-        public void defBlockBasedDisk(String diskName, String diskLabel,
-                diskBus bus) {
-            _diskType = diskType.BLOCK;
-            _deviceType = deviceType.DISK;
-            _diskFmtType = diskFmtType.RAW;
-            _sourcePath = diskName;
-            _diskLabel = diskLabel;
-            _bus = bus;
-        }
-
-        public void defNetworkBasedDisk(String diskName, String sourceHost, int sourcePort,
-                                        String authUserName, String authSecretUUID,
-                                        int devId, diskBus bus, diskProtocol protocol) {
-            _diskType = diskType.NETWORK;
-            _deviceType = deviceType.DISK;
-            _diskFmtType = diskFmtType.RAW;
-            _sourcePath = diskName;
-            _sourceHost = sourceHost;
-            _sourcePort = sourcePort;
-            _authUserName = authUserName;
-            _authSecretUUID = authSecretUUID;
-            _diskLabel = getDevLabel(devId, bus);
-            _bus = bus;
-            _diskProtocol = protocol;
-        }
-
-        public void defNetworkBasedDisk(String diskName, String sourceHost, int sourcePort,
-                                        String authUserName, String authSecretUUID,
-                                        String diskLabel, diskBus bus, diskProtocol protocol) {
-            _diskType = diskType.NETWORK;
-            _deviceType = deviceType.DISK;
-            _diskFmtType = diskFmtType.RAW;
-            _sourcePath = diskName;
-            _sourceHost = sourceHost;
-            _sourcePort = sourcePort;
-            _authUserName = authUserName;
-            _authSecretUUID = authSecretUUID;
-            _diskLabel = diskLabel;
-            _bus = bus;
-            _diskProtocol = protocol;
-        }
-
-        public void setReadonly() {
-            _readonly = true;
-        }
-
-        public void setSharable() {
-            _shareable = true;
-        }
-
-        public void setAttachDeferred(boolean deferAttach) {
-            _deferAttach = deferAttach;
-        }
-
-        public boolean isAttachDeferred() {
-            return _deferAttach;
-        }
-
-        public String getDiskPath() {
-            return _sourcePath;
-        }
-
-        public String getDiskLabel() {
-            return _diskLabel;
-        }
-
-        public deviceType getDeviceType() {
-            return _deviceType;
-        }
-
-        public void setDiskPath(String volPath) {
-            this._sourcePath = volPath;
-        }
-
-        public diskBus getBusType() {
-            return _bus;
-        }
-
-        public int getDiskSeq() {
-            char suffix = this._diskLabel.charAt(this._diskLabel.length() - 1);
-            return suffix - 'a';
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder diskBuilder = new StringBuilder();
-            diskBuilder.append("<disk ");
-            if (_deviceType != null) {
-                diskBuilder.append(" device='" + _deviceType + "'");
-            }
-            diskBuilder.append(" type='" + _diskType + "'");
-            diskBuilder.append(">\n");
-            diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType
-                    + "' cache='none' " + "/>\n");
-            if (_diskType == diskType.FILE) {
-                diskBuilder.append("<source ");
-                if (_sourcePath != null) {
-                    diskBuilder.append("file='" + _sourcePath + "'");
-                } else if (_deviceType == deviceType.CDROM) {
-                    diskBuilder.append("file=''");
-                }
-                diskBuilder.append("/>\n");
-            } else if (_diskType == diskType.BLOCK) {
-                diskBuilder.append("<source");
-                if (_sourcePath != null) {
-                    diskBuilder.append(" dev='" + _sourcePath + "'");
-                }
-                diskBuilder.append("/>\n");
-            } else if (_diskType == diskType.NETWORK) {
-                diskBuilder.append("<source ");
-                diskBuilder.append(" protocol='" + _diskProtocol + "'");
-                diskBuilder.append(" name='" + _sourcePath + "'");
-                diskBuilder.append(">\n");
-                diskBuilder.append("<host name='" + _sourceHost + "' port='" + _sourcePort + "'/>\n");
-                diskBuilder.append("</source>\n");
-                if (_authUserName != null) {
-                    diskBuilder.append("<auth username='" + _authUserName + "'>\n");
-                    diskBuilder.append("<secret type='ceph' uuid='" + _authSecretUUID + "'/>\n");
-                    diskBuilder.append("</auth>\n");
-                }
-            }
-            diskBuilder.append("<target dev='" + _diskLabel + "'");
-            if (_bus != null) {
-                diskBuilder.append(" bus='" + _bus + "'");
-            }
-            diskBuilder.append("/>\n");
-            diskBuilder.append("</disk>\n");
-            return diskBuilder.toString();
-        }
-    }
-
-    public static class InterfaceDef {
-        enum guestNetType {
-            BRIDGE("bridge"), NETWORK("network"), USER("user"), ETHERNET(
-                    "ethernet"), INTERNAL("internal");
-            String _type;
-
-            guestNetType(String type) {
-                _type = type;
-            }
-
-            @Override
-            public String toString() {
-                return _type;
-            }
-        }
-
-        enum nicModel {
-            E1000("e1000"), VIRTIO("virtio"), RTL8139("rtl8139"), NE2KPCI(
-                    "ne2k_pci");
-            String _model;
-
-            nicModel(String model) {
-                _model = model;
-            }
-
-            @Override
-            public String toString() {
-                return _model;
-            }
-        }
-
-        enum hostNicType {
-            DIRECT_ATTACHED_WITHOUT_DHCP, DIRECT_ATTACHED_WITH_DHCP, VNET, VLAN;
-        }
-
-        private guestNetType _netType; /*
-                                         * bridge, ethernet, network, user,
-                                         * internal
-                                         */
-        private hostNicType _hostNetType; /* Only used by agent java code */
-        private String _sourceName;
-        private String _networkName;
-        private String _macAddr;
-        private String _ipAddr;
-        private String _scriptPath;
-        private nicModel _model;
-
-        public void defBridgeNet(String brName, String targetBrName,
-                String macAddr, nicModel model) {
-            _netType = guestNetType.BRIDGE;
-            _sourceName = brName;
-            _networkName = targetBrName;
-            _macAddr = macAddr;
-            _model = model;
-        }
-
-        public void defPrivateNet(String networkName, String targetName,
-                String macAddr, nicModel model) {
-            _netType = guestNetType.NETWORK;
-            _sourceName = networkName;
-            _networkName = targetName;
-            _macAddr = macAddr;
-            _model = model;
-        }
-
-        public void setHostNetType(hostNicType hostNetType) {
-            _hostNetType = hostNetType;
-        }
-
-        public hostNicType getHostNetType() {
-            return _hostNetType;
-        }
-
-        public String getBrName() {
-            return _sourceName;
-        }
-
-        public guestNetType getNetType() {
-            return _netType;
-        }
-
-        public String getDevName() {
-            return _networkName;
-        }
-
-        public String getMacAddress() {
-            return _macAddr;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder netBuilder = new StringBuilder();
-            netBuilder.append("<interface type='" + _netType + "'>\n");
-            if (_netType == guestNetType.BRIDGE) {
-                netBuilder.append("<source bridge='" + _sourceName + "'/>\n");
-            } else if (_netType == guestNetType.NETWORK) {
-                netBuilder.append("<source network='" + _sourceName + "'/>\n");
-            }
-            if (_networkName != null) {
-                netBuilder.append("<target dev='" + _networkName + "'/>\n");
-            }
-            if (_macAddr != null) {
-                netBuilder.append("<mac address='" + _macAddr + "'/>\n");
-            }
-            if (_model != null) {
-                netBuilder.append("<model type='" + _model + "'/>\n");
-            }
-            netBuilder.append("</interface>\n");
-            return netBuilder.toString();
-        }
-    }
-
-    public static class ConsoleDef {
-        private final String _ttyPath;
-        private final String _type;
-        private final String _source;
-        private short _port = -1;
-
-        public ConsoleDef(String type, String path, String source, short port) {
-            _type = type;
-            _ttyPath = path;
-            _source = source;
-            _port = port;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder consoleBuilder = new StringBuilder();
-            consoleBuilder.append("<console ");
-            consoleBuilder.append("type='" + _type + "'");
-            if (_ttyPath != null) {
-                consoleBuilder.append("tty='" + _ttyPath + "'");
-            }
-            consoleBuilder.append(">\n");
-            if (_source != null) {
-                consoleBuilder.append("<source path='" + _source + "'/>\n");
-            }
-            if (_port != -1) {
-                consoleBuilder.append("<target port='" + _port + "'/>\n");
-            }
-            consoleBuilder.append("</console>\n");
-            return consoleBuilder.toString();
-        }
-    }
-
-    public static class SerialDef {
-        private final String _type;
-        private final String _source;
-        private short _port = -1;
-
-        public SerialDef(String type, String source, short port) {
-            _type = type;
-            _source = source;
-            _port = port;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder serialBuidler = new StringBuilder();
-            serialBuidler.append("<serial type='" + _type + "'>\n");
-            if (_source != null) {
-                serialBuidler.append("<source path='" + _source + "'/>\n");
-            }
-            if (_port != -1) {
-                serialBuidler.append("<target port='" + _port + "'/>\n");
-            }
-            serialBuidler.append("</serial>\n");
-            return serialBuidler.toString();
-        }
-    }
-
-    public static class GraphicDef {
-        private final String _type;
-        private short _port = -2;
-        private boolean _autoPort = false;
-        private final String _listenAddr;
-        private final String _passwd;
-        private final String _keyMap;
-
-        public GraphicDef(String type, short port, boolean autoPort,
-                String listenAddr, String passwd, String keyMap) {
-            _type = type;
-            _port = port;
-            _autoPort = autoPort;
-            _listenAddr = listenAddr;
-            _passwd = passwd;
-            _keyMap = keyMap;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder graphicBuilder = new StringBuilder();
-            graphicBuilder.append("<graphics type='" + _type + "'");
-            if (_autoPort) {
-                graphicBuilder.append(" autoport='yes'");
-            } else if (_port != -2) {
-                graphicBuilder.append(" port='" + _port + "'");
-            }
-            if (_listenAddr != null) {
-                graphicBuilder.append(" listen='" + _listenAddr + "'");
-            } else {
-                graphicBuilder.append(" listen='' ");
-            }
-            if (_passwd != null) {
-                graphicBuilder.append(" passwd='" + _passwd + "'");
-            } else if (_keyMap != null) {
-                graphicBuilder.append(" _keymap='" + _keyMap + "'");
-            }
-            graphicBuilder.append("/>\n");
-            return graphicBuilder.toString();
-        }
-    }
-
-    public static class InputDef {
-        private final String _type; /* tablet, mouse */
-        private final String _bus; /* ps2, usb, xen */
-
-        public InputDef(String type, String bus) {
-            _type = type;
-            _bus = bus;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder inputBuilder = new StringBuilder();
-            inputBuilder.append("<input type='" + _type + "'");
-            if (_bus != null) {
-                inputBuilder.append(" bus='" + _bus + "'");
-            }
-            inputBuilder.append("/>\n");
-            return inputBuilder.toString();
-        }
-    }
-
-    public void setHvsType(String hvs) {
-        _hvsType = hvs;
-    }
-
-    public void setDomainName(String domainName) {
-        _domName = domainName;
-    }
-
-    public void setDomUUID(String uuid) {
-        _domUUID = uuid;
-    }
-
-    public void setDomDescription(String desc) {
-        _desc = desc;
-    }
-
-    public String getGuestOSType() {
-        return _desc;
-    }
-
-    public void addComp(Object comp) {
-        components.put(comp.getClass().toString(), comp);
-    }
-
-    public DevicesDef getDevices() {
-        Object o = components.get(DevicesDef.class.toString());
-        if (o != null) {
-            return (DevicesDef) o;
-        }
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder vmBuilder = new StringBuilder();
-        vmBuilder.append("<domain type='" + _hvsType + "'>\n");
-        vmBuilder.append("<name>" + _domName + "</name>\n");
-        if (_domUUID != null) {
-            vmBuilder.append("<uuid>" + _domUUID + "</uuid>\n");
-        }
-        if (_desc != null) {
-            vmBuilder.append("<description>" + _desc + "</description>\n");
-        }
-        for (Object o : components.values()) {
-            vmBuilder.append(o.toString());
-        }
-        vmBuilder.append("</domain>\n");
-        return vmBuilder.toString();
-    }
-
-    public static void main(String[] args) {
-        System.out.println("testing");
-        LibvirtVMDef vm = new LibvirtVMDef();
-        vm.setHvsType("kvm");
-        vm.setDomainName("testing");
-        vm.setDomUUID(UUID.randomUUID().toString());
-
-        GuestDef guest = new GuestDef();
-        guest.setGuestType(GuestDef.guestType.KVM);
-        guest.setGuestArch("x86_64");
-        guest.setMachineType("pc-0.11");
-        guest.setBootOrder(GuestDef.bootOrder.HARDISK);
-        vm.addComp(guest);
-
-        GuestResourceDef grd = new GuestResourceDef();
-        grd.setMemorySize(512 * 1024);
-        grd.setVcpuNum(1);
-        vm.addComp(grd);
-
-        FeaturesDef features = new FeaturesDef();
-        features.addFeatures("pae");
-        features.addFeatures("apic");
-        features.addFeatures("acpi");
-        vm.addComp(features);
-
-        TermPolicy term = new TermPolicy();
-        term.setCrashPolicy("destroy");
-        term.setPowerOffPolicy("destroy");
-        term.setRebootPolicy("destroy");
-        vm.addComp(term);
-
-        DevicesDef devices = new DevicesDef();
-        devices.setEmulatorPath("/usr/bin/cloud-qemu-system-x86_64");
-
-        DiskDef hda = new DiskDef();
-        hda.defFileBasedDisk("/path/to/hda1", 0, DiskDef.diskBus.VIRTIO,
-                DiskDef.diskFmtType.QCOW2);
-        devices.addDevice(hda);
-
-        DiskDef hdb = new DiskDef();
-        hdb.defFileBasedDisk("/path/to/hda2", 1, DiskDef.diskBus.VIRTIO,
-                DiskDef.diskFmtType.QCOW2);
-        devices.addDevice(hdb);
-
-        InterfaceDef pubNic = new InterfaceDef();
-        pubNic.defBridgeNet("cloudbr0", "vnet1", "00:16:3e:77:e2:a1",
-                InterfaceDef.nicModel.VIRTIO);
-        devices.addDevice(pubNic);
-
-        InterfaceDef privNic = new InterfaceDef();
-        privNic.defPrivateNet("cloud-private", null, "00:16:3e:77:e2:a2",
-                InterfaceDef.nicModel.VIRTIO);
-        devices.addDevice(privNic);
-
-        InterfaceDef vlanNic = new InterfaceDef();
-        vlanNic.defBridgeNet("vnbr1000", "tap1", "00:16:3e:77:e2:a2",
-                InterfaceDef.nicModel.VIRTIO);
-        devices.addDevice(vlanNic);
-
-        SerialDef serial = new SerialDef("pty", null, (short) 0);
-        devices.addDevice(serial);
-
-        ConsoleDef console = new ConsoleDef("pty", null, null, (short) 0);
-        devices.addDevice(console);
-
-        GraphicDef grap = new GraphicDef("vnc", (short) 0, true, null, null,
-                null);
-        devices.addDevice(grap);
-
-        InputDef input = new InputDef("tablet", "usb");
-        devices.addDevice(input);
-
-        vm.addComp(devices);
-
-        System.out.println(vm.toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/resource/computing/LibvirtXMLParser.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtXMLParser.java b/agent/src/com/cloud/agent/resource/computing/LibvirtXMLParser.java
deleted file mode 100644
index b73ea0f..0000000
--- a/agent/src/com/cloud/agent/resource/computing/LibvirtXMLParser.java
+++ /dev/null
@@ -1,72 +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
-// with 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 com.cloud.agent.resource.computing;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.apache.log4j.Logger;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class LibvirtXMLParser extends DefaultHandler {
-    private static final Logger s_logger = Logger
-            .getLogger(LibvirtXMLParser.class);
-    protected static SAXParserFactory s_spf;
-
-    static {
-        s_spf = SAXParserFactory.newInstance();
-
-    }
-    protected SAXParser _sp;
-    protected boolean _initialized = false;
-
-    public LibvirtXMLParser() {
-
-        try {
-            _sp = s_spf.newSAXParser();
-            _initialized = true;
-        } catch (Exception ex) {
-        }
-
-    }
-
-    public boolean parseDomainXML(String domXML) {
-        if (!_initialized) {
-            return false;
-        }
-        try {
-            _sp.parse(new InputSource(new StringReader(domXML)), this);
-            return true;
-        } catch (SAXException se) {
-            s_logger.warn(se.getMessage());
-        } catch (IOException ie) {
-            s_logger.error(ie.getMessage());
-        }
-        return false;
-    }
-
-    @Override
-    public void characters(char[] ch, int start, int length)
-            throws SAXException {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/storage/KVMPhysicalDisk.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/storage/KVMPhysicalDisk.java b/agent/src/com/cloud/agent/storage/KVMPhysicalDisk.java
deleted file mode 100644
index cb790d9..0000000
--- a/agent/src/com/cloud/agent/storage/KVMPhysicalDisk.java
+++ /dev/null
@@ -1,98 +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
-// with 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 com.cloud.agent.storage;
-
-public class KVMPhysicalDisk {
-    private String path;
-    private String name;
-    private KVMStoragePool pool;
-
-    public static enum PhysicalDiskFormat {
-        RAW("raw"), QCOW2("qcow2");
-        String format;
-
-        private PhysicalDiskFormat(String format) {
-            this.format = format;
-        }
-
-        public String toString() {
-            return this.format;
-        }
-    }
-
-    public static String RBDStringBuilder(String monHost, int monPort,
-                            String authUserName, String authSecret, String image) {
-        String rbdOpts;
-
-        rbdOpts = "rbd:" + image;
-        rbdOpts += ":mon_host=" + monHost + "\\\\:" + monPort;
-        if (authUserName == null) {
-            rbdOpts += ":auth_supported=none";
-        } else {
-            rbdOpts += ":auth_supported=cephx";
-            rbdOpts += ":id=" + authUserName;
-            rbdOpts += ":key=" + authSecret;
-        }
-        return rbdOpts;
-    }
-
-    private PhysicalDiskFormat format;
-    private long size;
-    private long virtualSize;
-
-    public KVMPhysicalDisk(String path, String name, KVMStoragePool pool) {
-        this.path = path;
-        this.name = name;
-        this.pool = pool;
-    }
-
-    public void setFormat(PhysicalDiskFormat format) {
-        this.format = format;
-    }
-
-    public PhysicalDiskFormat getFormat() {
-        return this.format;
-    }
-
-    public void setSize(long size) {
-        this.size = size;
-    }
-
-    public long getSize() {
-        return this.size;
-    }
-
-    public void setVirtualSize(long size) {
-        this.virtualSize = size;
-    }
-
-    public long getVirtualSize() {
-        return this.virtualSize;
-    }
-
-    public String getName() {
-        return this.name;
-    }
-
-    public String getPath() {
-        return this.path;
-    }
-
-    public KVMStoragePool getPool() {
-        return this.pool;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7a0a9231/agent/src/com/cloud/agent/storage/KVMStoragePool.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/storage/KVMStoragePool.java b/agent/src/com/cloud/agent/storage/KVMStoragePool.java
deleted file mode 100644
index f1192ed..0000000
--- a/agent/src/com/cloud/agent/storage/KVMStoragePool.java
+++ /dev/null
@@ -1,65 +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
-// with 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 com.cloud.agent.storage;
-
-import java.util.List;
-
-import com.cloud.agent.storage.KVMPhysicalDisk.PhysicalDiskFormat;
-import com.cloud.storage.Storage.StoragePoolType;
-
-public interface KVMStoragePool {
-    public KVMPhysicalDisk createPhysicalDisk(String name,
-            PhysicalDiskFormat format, long size);
-
-    public KVMPhysicalDisk createPhysicalDisk(String name, long size);
-
-    public KVMPhysicalDisk getPhysicalDisk(String volumeUuid);
-
-    public boolean deletePhysicalDisk(String uuid);
-
-    public List<KVMPhysicalDisk> listPhysicalDisks();
-
-    public String getUuid();
-
-    public long getCapacity();
-
-    public long getUsed();
-
-    public boolean refresh();
-
-    public boolean isExternalSnapshot();
-
-    public String getLocalPath();
-
-    public String getSourceHost();
-
-    public String getSourceDir();
-
-    public int getSourcePort();
-
-    public String getAuthUserName();
-
-    public String getAuthSecret();
-
-    public StoragePoolType getType();
-
-    public boolean delete();
-
-    PhysicalDiskFormat getDefaultFormat();
-
-    public boolean createFolder(String path);
-}