[libvirt] [PATCH] Domain object is converted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/org/libvirt/Connect.java                     |    9 +
 src/org/libvirt/Domain.java                      |  307 +++++++++++++---------
 src/org/libvirt/DomainBlockStats.java            |   13 +
 src/org/libvirt/DomainInfo.java                  |   14 +
 src/org/libvirt/DomainInterfaceStats.java        |   17 ++
 src/org/libvirt/ErrorHandler.java                |   11 +-
 src/org/libvirt/Network.java                     |    8 +-
 src/org/libvirt/NodeInfo.java                    |    4 +-
 src/org/libvirt/SchedBooleanParameter.java       |   20 ++-
 src/org/libvirt/SchedDoubleParameter.java        |   13 +
 src/org/libvirt/SchedIntParameter.java           |   13 +
 src/org/libvirt/SchedLongParameter.java          |   14 +
 src/org/libvirt/SchedParameter.java              |   43 +++
 src/org/libvirt/SchedUintParameter.java          |   13 +
 src/org/libvirt/SchedUlongParameter.java         |   13 +
 src/org/libvirt/VcpuInfo.java                    |   13 +
 src/org/libvirt/jna/Libvirt.java                 |   42 +++-
 src/org/libvirt/jna/virDomainBlockStats.java     |   12 +
 src/org/libvirt/jna/virDomainInfo.java           |   13 +
 src/org/libvirt/jna/virDomainInterfaceStats.java |   16 ++
 src/org/libvirt/jna/virSchedParameter.java       |   11 +
 src/org/libvirt/jna/virSchedParameterValue.java  |   13 +
 src/org/libvirt/jna/virVcpuInfo.java             |   12 +
 src/test.java                                    |  154 ++++++-----
 24 files changed, 595 insertions(+), 203 deletions(-)
 create mode 100644 src/org/libvirt/jna/virDomainBlockStats.java
 create mode 100644 src/org/libvirt/jna/virDomainInfo.java
 create mode 100644 src/org/libvirt/jna/virDomainInterfaceStats.java
 create mode 100644 src/org/libvirt/jna/virSchedParameter.java
 create mode 100644 src/org/libvirt/jna/virSchedParameterValue.java
 create mode 100644 src/org/libvirt/jna/virVcpuInfo.java

diff --git a/src/org/libvirt/Connect.java b/src/org/libvirt/Connect.java
index 218bda3..bab1d23 100644
--- a/src/org/libvirt/Connect.java
+++ b/src/org/libvirt/Connect.java
@@ -820,4 +820,13 @@ public class Connect {
     protected void processError() throws LibvirtException {
         ErrorHandler.processError(libvirt, VCP) ;
     }
+    
+    public static int[] convertUUIDBytes(byte bytes[]) {
+        int[] returnValue = new int[Libvirt.VIR_UUID_BUFLEN] ;
+        for (int x = 0 ; x < Libvirt.VIR_UUID_BUFLEN ; x++) {
+            returnValue[x] = (int) bytes[x] ;
+        }
+        return returnValue ;
+    }
+                      
 }
diff --git a/src/org/libvirt/Domain.java b/src/org/libvirt/Domain.java
index e9b5d57..ab8cd94 100644
--- a/src/org/libvirt/Domain.java
+++ b/src/org/libvirt/Domain.java
@@ -1,6 +1,16 @@
 package org.libvirt;
 
+import org.libvirt.jna.Libvirt;
+import org.libvirt.jna.virDomainBlockStats;
+import org.libvirt.jna.virDomainInfo;
+import org.libvirt.jna.virDomainInterfaceStats;
+import org.libvirt.jna.virSchedParameter;
+import org.libvirt.jna.virVcpuInfo;
+
+import com.sun.jna.Native;
+import com.sun.jna.NativeLong;
 import com.sun.jna.Pointer;
+import com.sun.jna.ptr.IntByReference;
 
 public class Domain {
 
@@ -35,6 +45,11 @@ public class Domain {
 	 * The Connect Object that represents the Hypervisor of this Domain
 	 */
 	private Connect virConnect;
+	
+    /**
+     * The libvirt connection from the hypervisor
+     */
+    protected Libvirt libvirt ;	
 
 
 	/**
@@ -47,6 +62,7 @@ public class Domain {
 	Domain(Connect virConnect, Pointer VDP){
 		this.virConnect = virConnect;
 		this.VDP = VDP;
+        this.libvirt = virConnect.libvirt ;		
 	}
 
 	/**
@@ -59,11 +75,11 @@ public class Domain {
 	 * @see <a href="http://libvirt.org/format.html#Normal1"; >The XML Description format </a>
 	 */
 	public String getXMLDesc(int flags) throws LibvirtException{
-//		return _getXMLDesc(VDP, flags);
-        throw new RuntimeException("Not Implemented") ;	    
+        String returnValue = libvirt.virDomainGetXMLDesc(VDP, flags) ;
+        processError() ;
+        return returnValue  ;    
 	}
 
-//	private native String _getXMLDesc(long VDP, int flags) throws LibvirtException;
 
 	/**
 	 * Provides a boolean value indicating whether the network is configured to be automatically started when the host machine boots.
@@ -72,13 +88,13 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public boolean getAutostart() throws LibvirtException{
-//		return _getAutostart(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        IntByReference autoStart = new IntByReference() ;
+        libvirt.virDomainGetAutostart(VDP, autoStart) ;
+        processError() ;        
+        return autoStart.getValue() != 0 ? true : false ; 
 	}
 
 
-//	private native boolean _getAutostart(long VDP) throws LibvirtException;
-
 	/**
 	 * Configures the network to be automatically started when the host machine boots.
 	 *
@@ -86,11 +102,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setAutostart(boolean autostart) throws LibvirtException{
-//			_setAutostart(VDP, autostart);
-        throw new RuntimeException("Not Implemented") ;	    
+        int autoValue = autostart ? 1 : 0 ;
+        libvirt.virDomainSetAutostart(VDP, autoValue) ;    
+        processError() ;  
 	}
 
-//	private native int _setAutostart(long VDP, boolean autostart) throws LibvirtException;
 
 	/**
 	 * Provides the connection object associated with a domain.
@@ -108,11 +124,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public int getID() throws LibvirtException{
-//		return _getID(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+	    int returnValue = libvirt.virDomainGetID(VDP);
+	    processError() ;
+	    return returnValue ;
 	}
 
-//	private native int _getID(long VDP) throws LibvirtException;
 
 
 	/**
@@ -123,12 +139,16 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public DomainInfo getInfo() throws LibvirtException{
-//		return _getInfo(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+	    DomainInfo returnValue = null ;
+	    virDomainInfo vInfo = new virDomainInfo() ;
+	    int success = libvirt.virDomainGetInfo(VDP, vInfo) ;
+	    processError() ;
+	    if (success == 0) {
+	        returnValue = new DomainInfo(vInfo) ;
+	    }
+	    return returnValue ;
 	}
 
-//	private native DomainInfo _getInfo(long VDP) throws LibvirtException;
-
 	/**
 	 * Retrieve the maximum amount of physical memory allocated to a domain.
 	 *
@@ -136,11 +156,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public long getMaxMemory() throws LibvirtException{
-//		return _getMaxMemory(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+	    NativeLong returnValue = libvirt.virDomainGetMaxMemory(VDP) ;
+	    processError() ;
+        return returnValue.longValue() ;	    
 	}
 
-//	private native long _getMaxMemory(long VDP) throws LibvirtException;
 
 	/**
 	 * * Dynamically change the maximum amount of physical memory allocated to a domain.
@@ -150,12 +170,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setMaxMemory(long memory) throws LibvirtException{
-//		 _setMaxMemory(VDP, memory);
-        throw new RuntimeException("Not Implemented") ;	    
+	    libvirt.virDomainSetMaxMemory(VDP, new NativeLong(memory)) ;
+	    processError() ;
 	}
 
-//	private native long _setMaxMemory(long VDP,  long memory) throws LibvirtException;
-
 
 	/**
 	 * Provides the maximum number of virtual CPUs supported for the guest VM.
@@ -166,12 +184,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public int getMaxVcpus() throws LibvirtException{
-//		return _getMaxVcpus(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        int returnValue = libvirt.virDomainGetMaxVcpus(VDP) ;
+        processError() ; 
+        return returnValue ;        
 	}
 
-//	private native int _getMaxVcpus(long VDP) throws LibvirtException;
-
 
 	/**
 	 * Gets the public name for this domain
@@ -180,11 +197,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public String getName() throws LibvirtException{
-//		return _getName(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        String returnValue = libvirt.virDomainGetName(VDP);
+        processError() ;
+        return returnValue ;    
 	}
 
-//	private native String _getName(long VDP) throws LibvirtException;
 
 	/**
 	 * Gets the type of domain operation system.
@@ -193,12 +210,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public String getOSType() throws LibvirtException{
-//		return _getOSType(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        String returnValue = libvirt.virDomainGetOSType(VDP);
+        processError() ;
+        return returnValue ;       
 	}
 
-//	private native String _getOSType(long VDP) throws LibvirtException;
-
 
 	/**
 	 * Gets the scheduler parameters.
@@ -207,11 +223,23 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public SchedParameter[] getSchedulerParameters() throws LibvirtException{
-//		return _getSchedulerParameters(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+	    IntByReference nParams = new IntByReference() ;
+	    SchedParameter[] returnValue = new SchedParameter[0] ; 
+	    String scheduler = libvirt.virDomainGetSchedulerType(VDP, nParams) ;
+	    processError() ;
+	    if (scheduler != null) {
+	        virSchedParameter[] nativeParams = new virSchedParameter[nParams.getValue()] ;
+	        returnValue = new SchedParameter[nParams.getValue()] ;
+	        libvirt.virDomainGetSchedulerParameters(VDP, nativeParams, nParams) ;
+	        processError() ;
+	        for (int x = 0 ; x < nParams.getValue() ; x++ ) {
+	            returnValue[x] = SchedParameter.create(nativeParams[x]) ;
+	        }
+	    } 
+	    
+	    return returnValue ;
 	}
 
-//	private native SchedParameter[] _getSchedulerParameters (long VDP) throws LibvirtException;
 
 	/**
 	 * Changes the scheduler parameters
@@ -220,11 +248,16 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setSchedulerParameters(SchedParameter[] params) throws LibvirtException{
-//		_setSchedulerParameters(VDP, params);
-        throw new RuntimeException("Not Implemented") ;	    
+        IntByReference nParams = new IntByReference() ;
+        nParams.setValue(params.length) ;
+        virSchedParameter[] input = new virSchedParameter[params.length] ; 
+        for (int x = 0 ; x < params.length ; x++) {
+            input[x] = SchedParameter.toNative(params[x]) ;
+        }
+        libvirt.virDomainSetSchedulerParameters(VDP, input, nParams) ;
+        processError() ;	    
 	}
 
-//	private native int _setSchedulerParameters(long VDP, SchedParameter[] params) throws LibvirtException;
 
 	//getSchedulerType
 	//We don't expose the nparams return value, it's only needed for the SchedulerParameters allocations,
@@ -236,11 +269,14 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public String[] getSchedulerType() throws LibvirtException{
-//		return _getSchedulerType(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        IntByReference nParams = new IntByReference() ;	    
+        String returnValue = libvirt.virDomainGetSchedulerType(VDP, nParams) ;
+        processError() ;
+        String[] array = new String[1] ;
+        array[0] = returnValue ;
+        return array;
 	}
 
-//	private native String[] _getSchedulerType(long VDP) throws LibvirtException;
 
 	/**
 	 * Get the UUID for this domain.
@@ -250,11 +286,16 @@ public class Domain {
 	 * @see <a href="http://www.ietf.org/rfc/rfc4122.txt";>rfc4122</a>
 	 */
 	public int[] getUUID() throws LibvirtException{
-//		return _getUUID(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        byte[] bytes = new byte[Libvirt.VIR_UUID_BUFLEN] ;
+        int success = libvirt.virDomainGetUUID(VDP, bytes) ;
+        processError() ;        
+        int[] returnValue = new int[0] ; 
+        if (success == 0) {
+            returnValue = Connect.convertUUIDBytes(bytes) ;
+        }
+        return returnValue ;  
 	}
-
-//	private native int[] _getUUID(long VDP) throws LibvirtException;
+	
 
 	/**
 	 * Gets the UUID for this domain as string.
@@ -264,12 +305,16 @@ public class Domain {
 	 * @see <a href="http://www.ietf.org/rfc/rfc4122.txt";>rfc4122</a>
 	 */
 	public String getUUIDString() throws LibvirtException{
-//		return _getUUIDString(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        byte[] bytes = new byte[Libvirt.VIR_UUID_STRING_BUFLEN] ;
+        int success = libvirt.virDomainGetUUIDString(VDP, bytes) ;
+        processError() ;        
+        String returnValue = null ; 
+        if (success == 0) {
+            returnValue = Native.toString(bytes) ;
+        }
+        return returnValue ;     
 	}
 
-//	private native String _getUUIDString(long VDP) throws LibvirtException;
-
 	/**
 	 * Extracts information about virtual CPUs of this domain
 	 *
@@ -277,11 +322,18 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public VcpuInfo[] getVcpusInfo() throws LibvirtException{
-//		return _getVcpusInfo(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+	    int cpuCount = this.getMaxVcpus() ;
+	    VcpuInfo[] returnValue = new VcpuInfo[cpuCount] ;
+	    virVcpuInfo[] infos = new virVcpuInfo[cpuCount] ;
+	    libvirt.virDomainGetVcpus(VDP, infos, cpuCount, null, 0) ;
+        processError() ;
+        for (int x = 0 ; x < cpuCount ; x++) {
+            returnValue[x] = new VcpuInfo(infos[x]) ;
+        }
+        return returnValue ;
 	}
 
-//	private native VcpuInfo[] _getVcpusInfo(long VDP) throws LibvirtException;
+
 
 	/**
 	 * Returns the cpumaps for this domain
@@ -291,12 +343,24 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public int[] getVcpusCpuMaps() throws LibvirtException{
-//		return _getVcpusCpuMaps(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+	    int[] returnValue = new int[0] ;
+	    int cpuCount = this.getMaxVcpus() ;
+	    
+	    if (cpuCount >0) {
+	        NodeInfo nodeInfo = virConnect.nodeInfo() ;
+	        int maplength = cpuMapLength(nodeInfo.maxCpus()) ;
+	        virVcpuInfo[] infos = new virVcpuInfo[cpuCount] ;
+	        returnValue = new int[cpuCount*maplength] ;
+	        byte[] cpumaps = new byte[cpuCount*maplength] ;
+	        libvirt.virDomainGetVcpus(VDP, infos, cpuCount, cpumaps, maplength) ;
+	        processError() ;	        
+	        for (int x =0 ; x < cpuCount*maplength ; x++) {
+	            returnValue[x] = (int) cpumaps[x] ;
+	        }
+	    }
+	    return returnValue ; 
 	}
 
-//	private native int[] _getVcpusCpuMaps(long VDP) throws LibvirtException;
-
 
 	/**
 	 * Dynamically changes the real CPUs which can be allocated to a virtual CPU.
@@ -307,11 +371,14 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void pinVcpu(int vcpu, int[] cpumap) throws LibvirtException{
-//		_pinVcpu(VDP, vcpu, cpumap);
-        throw new RuntimeException("Not Implemented") ;	    
+	    byte[] packedMap = new byte[cpumap.length] ;
+	    for (int x = 0 ; x < cpumap.length ; x++) {
+	        packedMap[x] = (byte) cpumap[x] ;
+	    }
+	    libvirt.virDomainPinVcpu(VDP, vcpu, packedMap, cpumap.length) ; 
+        processError() ;	    
 	}
 
-//	private native int _pinVcpu(long VDP, int vcpu, int[]cpumap) throws LibvirtException;
 
 	/**
 	 * Dynamically changes the number of virtual CPUs used by this domain.
@@ -322,11 +389,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setVcpus(int nvcpus) throws LibvirtException{
-//		_setVcpus(VDP, nvcpus);
-        throw new RuntimeException("Not Implemented") ;	    
+	    libvirt.virDomainSetVcpus(VDP, nvcpus) ;
+        processError() ;
 	}
 
-//	private native int _setVcpus(long VDP, int nvcpus) throws LibvirtException;
 
 	/**
 	 * Creates a virtual device attachment to backend.
@@ -335,12 +401,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void attachDevice(String xmlDesc) throws LibvirtException{
-//		_attachDevice(VDP, xmlDesc);
-        throw new RuntimeException("Not Implemented") ;	    
+	    libvirt.virDomainAttachDevice(VDP, xmlDesc);
+        processError() ;    
 	}
 
-//	private native int _attachDevice(long VDP, String xmlDesc) throws LibvirtException;
-
+	
 	/**
 	 * Destroys a virtual device attachment to backend.
 	 *
@@ -348,11 +413,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void detachDevice(String xmlDesc) throws LibvirtException{
-//		_detachDevice(VDP, xmlDesc);
-        throw new RuntimeException("Not Implemented") ;	    
+        libvirt.virDomainDetachDevice(VDP, xmlDesc);
+        processError() ;  
 	}
 
-//	private native int _detachDevice(long VDP, String xmlDesc) throws LibvirtException;
 
 
 	/**
@@ -368,11 +432,12 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public DomainBlockStats blockStats(String path) throws LibvirtException{
-//		return _blockStats(VDP, path);
-        throw new RuntimeException("Not Implemented") ;	    
+	    virDomainBlockStats stats = new virDomainBlockStats() ;
+	    libvirt.virDomainBlockStats(VDP, path, stats, stats.size()) ;
+        processError() ;
+	    return new DomainBlockStats(stats) ;
 	}
-
-//	private native DomainBlockStats _blockStats(long VDP, String path) throws LibvirtException;
+	
 
 	/**
 	 * Returns network interface stats for interfaces attached to this domain.
@@ -386,11 +451,12 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public DomainInterfaceStats interfaceStats(String path) throws LibvirtException{
-//		return _interfaceStats(VDP, path);
-        throw new RuntimeException("Not Implemented") ;	    
+	    virDomainInterfaceStats stats = new virDomainInterfaceStats() ;
+        libvirt.virDomainInterfaceStats(VDP, path, stats, stats.size()) ;
+        processError() ;
+        return new DomainInterfaceStats(stats) ;   
 	}
 
-//	private native DomainInterfaceStats _interfaceStats(long VDP, String path) throws LibvirtException;
 
 	/**
 	 * Dumps the core of this domain on a given file for analysis.
@@ -401,11 +467,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void coreDump(String to, int flags) throws LibvirtException{
-//		_coreDump(VDP, to, flags);
-        throw new RuntimeException("Not Implemented") ;		
+	    libvirt.virDomainCoreDump(VDP, to, flags) ;
+	    processError() ;
 	}
 
-//	private native int _coreDump(long VDP, String to, int flags) throws LibvirtException;
 
 	/**
 	 * Launches this defined domain.
@@ -414,11 +479,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void create() throws LibvirtException{
-//		_create(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+		libvirt.virDomainCreate(VDP);
+        processError() ;  
 	}
 
-//	private native int _create(long VDP) throws LibvirtException;
 
 	/**
 	 * Destroys this domain object.
@@ -429,11 +493,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void destroy() throws LibvirtException{
-//		_destroy(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        libvirt.virDomainDestroy(VDP);
+        processError() ;  	    
 	}
-
-//	private native int _destroy(long VDP) throws LibvirtException;
+	
 
 	/**
 	 * Frees this domain object.
@@ -443,12 +506,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void free() throws LibvirtException{
-//		_free(VDP);
-//		VDP=0;
-        throw new RuntimeException("Not Implemented") ;	    
+        libvirt.virDomainFree(VDP);
+        processError() ;     
+		VDP=null ;
 	}
 
-//	private native int _free(long VDP) throws LibvirtException;
 
 
 	/**
@@ -478,11 +540,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public Domain migrate(Connect dconn, long flags, String dname, String uri, long bandwidth) throws LibvirtException{
-//		return new Domain(dconn, _migrate(VDP, dconn, flags, dname, uri, bandwidth));
-        throw new RuntimeException("Not Implemented") ;	    
+	    Pointer newPtr = libvirt.virDomainMigrate(VDP, dconn.VCP, new NativeLong(flags), dname, uri, new NativeLong(bandwidth)) ;
+	    processError() ;
+	    return new Domain(dconn, newPtr) ;  
 	}
 
-//	private native long _migrate(long VDP, Connect dconn, long flags, String dname, String uri, long bandwidth) throws LibvirtException;
 
 	/**
 	 * Reboot this domain, the domain object is still usable there after but the domain OS is being stopped for a restart.
@@ -492,11 +554,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void reboot(int flags) throws LibvirtException{
-//		_reboot(VDP, flags);
-        throw new RuntimeException("Not Implemented") ;	    
+		libvirt.virDomainReboot(VDP, flags);
+		processError() ;
 	}
 
-//	private native int _reboot(long VDP, int flags) throws LibvirtException;
 
 	/**
 	 * Suspends this active domain, the process is frozen without further access to CPU resources and I/O but the memory used by the domain at the hypervisor level will stay allocated.
@@ -505,11 +566,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void suspend() throws LibvirtException{
-//		_suspend(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        libvirt.virDomainSuspend(VDP);
+        processError() ;    
 	}
 
-//	private native int _suspend(long VDP) throws LibvirtException;
 
 	/**
 	 * Resume this suspended domain, the process is restarted from the state where it was frozen by calling virSuspendDomain().
@@ -518,11 +578,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void resume() throws LibvirtException{
-//		_resume(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        libvirt.virDomainResume(VDP);
+        processError() ;    
 	}
 
-//	private native int _resume(long VDP) throws LibvirtException;
 
 	/**
 	 * Suspends this domain and saves its memory contents to a file on disk.
@@ -533,12 +592,11 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void save(String to) throws LibvirtException{
-//		_save(VDP, to);
-        throw new RuntimeException("Not Implemented") ;	    
+        libvirt.virDomainSave(VDP, to);
+        processError() ;       
 	}
 
-//	private native int _save(long VDP, String to) throws LibvirtException;
-
+	
 	/**
 	 * Shuts down this domain, the domain object is still usable there after but the domain OS is being stopped.
 	 * Note that the guest OS may ignore the request.
@@ -547,11 +605,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void shutdown() throws LibvirtException{
-//		_shutdown(VDP);
-        throw new RuntimeException("Not Implemented") ;	    
+        libvirt.virDomainShutdown(VDP);
+        processError() ;     
 	}
 
-//	private native int _shutdown(long VDP) throws LibvirtException;
 
 	/**
 	 * undefines this domain but does not stop it if it is running
@@ -559,11 +616,10 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void undefine() throws LibvirtException{
-        throw new RuntimeException("Not Implemented") ;	    
-//		_undefine(VDP);
+        libvirt.virDomainUndefine(VDP);
+        processError() ;     
 	}
 
-//	private native int _undefine(long VDP) throws LibvirtException;
 
 	/**
 	 * Dynamically changes the target amount of physical memory allocated to this domain.
@@ -573,11 +629,26 @@ public class Domain {
 	 * @throws LibvirtException
 	 */
 	public void setMemory(long memory) throws LibvirtException{
-	    throw new RuntimeException("Not Implemented") ;
-//		_setMemory(VDP, memory);
+	    libvirt.virDomainSetMemory(VDP, new NativeLong(memory)) ;
+	    processError() ;
 	}
 
-//	private native int _setMemory(long VDP, long memory) throws LibvirtException;
+	/**
+	 * It returns the length (in bytes) required to store the complete
+	 * CPU map between a single virtual & all physical CPUs of a domain.
+	 * 
+	 */	
+	public int cpuMapLength(int maxCpus) {
+	    return  (((maxCpus)+7)/8) ;
+	}
+	
+	/**
+	 * Error handling logic to throw errors. Must be called after every libvirt
+	 * call.
+	 */
+    protected void processError() throws LibvirtException {
+        virConnect.processError() ;
+    }   	
 
 
 }
diff --git a/src/org/libvirt/DomainBlockStats.java b/src/org/libvirt/DomainBlockStats.java
index c5ed067..b48c066 100644
--- a/src/org/libvirt/DomainBlockStats.java
+++ b/src/org/libvirt/DomainBlockStats.java
@@ -1,5 +1,7 @@
 package org.libvirt;
 
+import org.libvirt.jna.virDomainBlockStats;
+
 /**
  * This class holds the counters for block device statistics.
  *
@@ -12,4 +14,15 @@ public class DomainBlockStats {
 	public long  wr_req;
 	public long  wr_bytes;
 	public long  errs;
+	
+	public DomainBlockStats() {	    
+	}
+	
+	public DomainBlockStats(virDomainBlockStats vStats) {
+	    this.rd_req = vStats.rd_req ;
+        this.rd_bytes = vStats.rd_bytes ;
+        this.wr_req = vStats.wr_req ;
+        this.wr_bytes = vStats.wr_bytes ;
+        this.errs = vStats.errs ;        
+	}
 }
diff --git a/src/org/libvirt/DomainInfo.java b/src/org/libvirt/DomainInfo.java
index ec493ff..e6a03f8 100644
--- a/src/org/libvirt/DomainInfo.java
+++ b/src/org/libvirt/DomainInfo.java
@@ -1,5 +1,7 @@
 package org.libvirt;
 
+import org.libvirt.jna.virDomainInfo;
+
 /**
  * This object is returned by Domain.getInfo()
  *
@@ -62,6 +64,18 @@ public class DomainInfo {
 	     */
 	    VIR_DOMAIN_CRASHED
 	}
+	
+	public DomainInfo() {
+	
+	}
+	
+	public DomainInfo(virDomainInfo info) {
+	    this.cpuTime = info.cpuTime ;
+	    this.maxMem = info.maxMem.longValue() ;
+	    this.memory = info.memory.longValue() ;
+	    this.nrVirtCpu = info.nrVirtCpu ;
+	    this.state = DomainState.values()[info.state] ;
+	}
 
 	public String toString(){
 		StringBuffer result = new StringBuffer("");
diff --git a/src/org/libvirt/DomainInterfaceStats.java b/src/org/libvirt/DomainInterfaceStats.java
index fd3d392..b60b628 100644
--- a/src/org/libvirt/DomainInterfaceStats.java
+++ b/src/org/libvirt/DomainInterfaceStats.java
@@ -1,5 +1,7 @@
 package org.libvirt;
 
+import org.libvirt.jna.virDomainInterfaceStats;
+
 
 /**
  * The Domain.interfaceStats method returns th network counters in this object
@@ -16,4 +18,19 @@ public class DomainInterfaceStats {
 	public long tx_packets;
 	public long tx_errs;
 	public long tx_drop;
+	
+	public DomainInterfaceStats() {
+	    
+	}
+	
+	public DomainInterfaceStats(virDomainInterfaceStats vStats) {
+	    this.rx_bytes = vStats.rx_bytes ;
+        this.rx_packets = vStats.rx_packets ; 	  
+        this.rx_errs = vStats.rx_errs ;
+        this.rx_drop = vStats.rx_drop ;   
+        this.tx_bytes = vStats.tx_bytes ;
+        this.tx_packets = vStats.tx_packets ;   
+        this.tx_errs = vStats.tx_errs ;
+        this.tx_drop = vStats.tx_drop ;           
+	}
 }
diff --git a/src/org/libvirt/ErrorHandler.java b/src/org/libvirt/ErrorHandler.java
index 0e322ba..7f77937 100644
--- a/src/org/libvirt/ErrorHandler.java
+++ b/src/org/libvirt/ErrorHandler.java
@@ -9,11 +9,17 @@ public class ErrorHandler
 {
 
     public static void processError(Libvirt libvirt) throws LibvirtException {
-        
+        virError vError = new virError() ;
+        int errorCode = libvirt.virCopyLastError(vError) ;
+        if (errorCode > 0) {        
+            Error error = new Error(vError) ;
+            libvirt.virResetLastError() ;
+            throw new LibvirtException(error) ;
+        }        
     }
+    
     public static void processError(Libvirt libvirt, Pointer conn) throws LibvirtException
     {
-
         virError vError = new virError() ;
         int errorCode = libvirt.virConnCopyLastError(conn, vError) ;
         if (errorCode > 0) {        
@@ -21,6 +27,5 @@ public class ErrorHandler
             libvirt.virConnResetLastError(conn) ;
             throw new LibvirtException(error) ;
         }
-        
     }
 }
diff --git a/src/org/libvirt/Network.java b/src/org/libvirt/Network.java
index ce80f6f..c18f239 100644
--- a/src/org/libvirt/Network.java
+++ b/src/org/libvirt/Network.java
@@ -2,6 +2,7 @@ package org.libvirt;
 
 import org.libvirt.jna.Libvirt;
 
+import com.sun.jna.Native;
 import com.sun.jna.Pointer;
 import com.sun.jna.ptr.IntByReference;
 import com.sun.jna.ptr.PointerByReference;
@@ -133,10 +134,7 @@ public class Network {
         processError() ;	    
 	    int[] returnValue = new int[0] ; 
 	    if (success == 0) {
-	        returnValue = new int[Libvirt.VIR_UUID_BUFLEN] ;
-	        for (int x = 0 ; x < Libvirt.VIR_UUID_BUFLEN ; x++) {
-	            returnValue[x] = (int) bytes[x] ;
-	        }
+	        returnValue = Connect.convertUUIDBytes(bytes) ;
 	    }
         return returnValue ;   
 	}
@@ -154,7 +152,7 @@ public class Network {
         processError() ;        
         String returnValue = null ; 
         if (success == 0) {
-            returnValue = new String(bytes) ;
+            returnValue = Native.toString(bytes) ;
         }
         return returnValue ;   	    
 	}
diff --git a/src/org/libvirt/NodeInfo.java b/src/org/libvirt/NodeInfo.java
index 16855ca..0431ed9 100644
--- a/src/org/libvirt/NodeInfo.java
+++ b/src/org/libvirt/NodeInfo.java
@@ -2,6 +2,8 @@ package org.libvirt;
 
 import org.libvirt.jna.virNodeInfo;
 
+import com.sun.jna.Native;
+
 public class NodeInfo {
 	/**
 	 * string indicating the CPU model
@@ -41,7 +43,7 @@ public class NodeInfo {
 	}
 	
 	public NodeInfo(virNodeInfo vInfo) {
-//	    this.model = new String(vInfo.model) ;
+	    this.model = Native.toString(vInfo.model) ;
         this.memory = vInfo.memory.longValue() ;
         this.cpus = vInfo.cpus ;
         this.mhz = vInfo.mhz ;        
diff --git a/src/org/libvirt/SchedBooleanParameter.java b/src/org/libvirt/SchedBooleanParameter.java
index adde0ec..5e681ca 100644
--- a/src/org/libvirt/SchedBooleanParameter.java
+++ b/src/org/libvirt/SchedBooleanParameter.java
@@ -11,12 +11,30 @@ public final class SchedBooleanParameter  extends SchedParameter{
 	 * The parameter value
 	 */
 	public boolean value;
+	
+	public SchedBooleanParameter() {
+	    
+	}
+
+	public SchedBooleanParameter(boolean value)
+    {
+        this.value = value;
+    }
+	
+    public SchedBooleanParameter(byte value)
+    {
+        this.value = (((int)value) != 0)? true : false ;
+    }	
 
-	public String getValueAsString(){
+    public String getValueAsString(){
 		return Boolean.toString(value);
 	}
 
 	public String getTypeAsString(){
 		return "VIR_DOMAIN_SCHED_FIELD_BOOLEAN";
 	}
+	
+    public int getType() {
+        return 6 ;
+    }
 }
diff --git a/src/org/libvirt/SchedDoubleParameter.java b/src/org/libvirt/SchedDoubleParameter.java
index 72e1afa..21bc217 100644
--- a/src/org/libvirt/SchedDoubleParameter.java
+++ b/src/org/libvirt/SchedDoubleParameter.java
@@ -11,6 +11,15 @@ public final class SchedDoubleParameter extends SchedParameter{
 	 * The parameter value
 	 */
 	public double value;
+	
+    public SchedDoubleParameter() {
+        
+    }
+
+    public SchedDoubleParameter(double value)
+    {
+        this.value = value;
+    }	
 
 	public String getValueAsString(){
 		return Double.toString(value);
@@ -19,4 +28,8 @@ public final class SchedDoubleParameter extends SchedParameter{
 	public String getTypeAsString(){
 		return "VIR_DOMAIN_SCHED_FIELD_DOUBLE";
 	}
+	
+    public int getType() {
+        return 5 ;
+    }	
 }
diff --git a/src/org/libvirt/SchedIntParameter.java b/src/org/libvirt/SchedIntParameter.java
index 0db5e81..af13933 100644
--- a/src/org/libvirt/SchedIntParameter.java
+++ b/src/org/libvirt/SchedIntParameter.java
@@ -3,6 +3,15 @@ package org.libvirt;
 public final class SchedIntParameter extends SchedParameter {
 	public int value;
 
+    public SchedIntParameter() {
+        
+    }
+
+    public SchedIntParameter(int value)
+    {
+        this.value = value;
+    }   
+    
 	public String getValueAsString(){
 		return Integer.toString(value);
 	}
@@ -10,4 +19,8 @@ public final class SchedIntParameter extends SchedParameter {
 	public String getTypeAsString(){
 		return "VIR_DOMAIN_SCHED_FIELD_INT";
 	}
+	
+    public int getType() {
+        return 1 ;
+    }	
 }
diff --git a/src/org/libvirt/SchedLongParameter.java b/src/org/libvirt/SchedLongParameter.java
index fafc33c..1b07971 100644
--- a/src/org/libvirt/SchedLongParameter.java
+++ b/src/org/libvirt/SchedLongParameter.java
@@ -11,6 +11,15 @@ public final class SchedLongParameter extends SchedParameter{
 	 * The parameter value
 	 */
 	public long value;
+	
+    public SchedLongParameter() {
+        
+    }
+
+    public SchedLongParameter(long value)
+    {
+        this.value = value;
+    }   	
 
 	public String getValueAsString(){
 		return Long.toString(value);
@@ -19,4 +28,9 @@ public final class SchedLongParameter extends SchedParameter{
 	public String getTypeAsString(){
 		return "VIR_DOMAIN_SCHED_FIELD_LLONG";
 	}
+	
+    public int getType() {
+        return 2 ;
+    }	
+	
 }
diff --git a/src/org/libvirt/SchedParameter.java b/src/org/libvirt/SchedParameter.java
index 6ce7855..8f38ef8 100644
--- a/src/org/libvirt/SchedParameter.java
+++ b/src/org/libvirt/SchedParameter.java
@@ -1,5 +1,12 @@
 package org.libvirt;
 
+import java.util.Arrays;
+
+import org.libvirt.jna.Libvirt;
+import org.libvirt.jna.virSchedParameter;
+
+import com.sun.jna.Native;
+
 /**
  * The abstract parent of the actual Schedparameter classes
  *
@@ -25,5 +32,41 @@ public abstract class SchedParameter {
 	 * @return the Type of the parameter as string
 	 */
 	public abstract String getTypeAsString();
+	
+    /**
+     * The type of the parameter
+     *
+     * @return the Type of the parameter 
+     */	
+	public abstract int getType() ;
 
+	public static SchedParameter create(virSchedParameter vParam) {
+	    SchedParameter returnValue = null ;
+	    switch (vParam.type) {
+    	    case (1): returnValue = new SchedIntParameter(vParam.value.i) ;break ;
+    	    case (2): returnValue = new SchedUintParameter(vParam.value.ui) ;break ;
+            case (3): returnValue = new SchedLongParameter(vParam.value.l) ;break ;
+            case (4): returnValue = new SchedUlongParameter(vParam.value.ul) ;break ;
+            case (5): returnValue = new SchedDoubleParameter(vParam.value.d) ;break ;
+            case (6): returnValue = new SchedBooleanParameter(vParam.value.b) ;break ;             
+	    }
+	    returnValue.field = Native.toString(vParam.field) ;
+	    return returnValue ;
+	}
+	
+	public static virSchedParameter toNative(SchedParameter param) {
+	    virSchedParameter returnValue = new virSchedParameter() ;
+	    returnValue.field = Arrays.copyOf(param.field.getBytes(), Libvirt.VIR_DOMAIN_SCHED_FIELD_LENGTH) ;
+	    returnValue.type = param.getType() ;
+        switch (param.getType()) {
+        case (1): returnValue.value.i = ((SchedIntParameter)param).value ;break ;
+        case (2): returnValue.value.ui = ((SchedUintParameter)param).value ;break ;
+        case (3): returnValue.value.l = ((SchedLongParameter)param).value ;break ;
+        case (4): returnValue.value.ul = ((SchedUlongParameter)param).value ;break ;
+        case (5): returnValue.value.d = ((SchedDoubleParameter)param).value ;break ;
+        case (6): returnValue.value.b = (byte)(((SchedBooleanParameter)param).value?1:0) ;break ;        
+            
+    }	    
+	    return returnValue ;
+	}
 }
diff --git a/src/org/libvirt/SchedUintParameter.java b/src/org/libvirt/SchedUintParameter.java
index e9882ec..8a6ab75 100644
--- a/src/org/libvirt/SchedUintParameter.java
+++ b/src/org/libvirt/SchedUintParameter.java
@@ -12,6 +12,15 @@ public final class SchedUintParameter extends SchedParameter {
 	 * The parameter value
 	 */
 	public int value;
+	
+    public SchedUintParameter() {
+        
+    }
+
+    public SchedUintParameter(int value)
+    {
+        this.value = value;
+    }       	
 
 	public String getValueAsString(){
 		return Integer.toString(value);
@@ -20,4 +29,8 @@ public final class SchedUintParameter extends SchedParameter {
 	public String getTypeAsString(){
 		return "VIR_DOMAIN_SCHED_FIELD_UINT";
 	}
+	
+    public int getType() {
+        return 3 ;
+    }	
 }
diff --git a/src/org/libvirt/SchedUlongParameter.java b/src/org/libvirt/SchedUlongParameter.java
index 96c1812..419c1a8 100644
--- a/src/org/libvirt/SchedUlongParameter.java
+++ b/src/org/libvirt/SchedUlongParameter.java
@@ -11,6 +11,15 @@ public final class SchedUlongParameter extends SchedParameter{
 	 * The parameter value
 	 */
 	public long value;
+	
+    public SchedUlongParameter() {
+        
+    }
+
+    public SchedUlongParameter(long value)
+    {
+        this.value = value;
+    }       	
 
 	public String getValueAsString(){
 		return Long.toString(value);
@@ -19,4 +28,8 @@ public final class SchedUlongParameter extends SchedParameter{
 	public String getTypeAsString(){
 		return "VIR_DOMAIN_SCHED_FIELD_ULLONG";
 	}
+	
+    public int getType() {
+        return 4 ;
+    }	
 }
diff --git a/src/org/libvirt/VcpuInfo.java b/src/org/libvirt/VcpuInfo.java
index 55490e2..b10c07d 100644
--- a/src/org/libvirt/VcpuInfo.java
+++ b/src/org/libvirt/VcpuInfo.java
@@ -1,5 +1,7 @@
 package org.libvirt;
 
+import org.libvirt.jna.virVcpuInfo;
+
 public class VcpuInfo {
 	public int number;
 	public VcpuState state;
@@ -10,4 +12,15 @@ public class VcpuInfo {
 		VIR_VCPU_OFFLINE,
 		VIR_VCPU_RUNNING,
 		VIR_VCPU_BLOCKED};
+		
+	public VcpuInfo() {
+	    
+	}
+	
+	public VcpuInfo(virVcpuInfo vVcpu) {
+	    this.number = vVcpu.number ;
+	    this.cpuTime = vVcpu.cpuTime ;
+	    this.cpu = vVcpu.cpu ;
+	    this.state = VcpuState.values()[vVcpu.state] ;
+	}
 }
diff --git a/src/org/libvirt/jna/Libvirt.java b/src/org/libvirt/jna/Libvirt.java
index 8727447..ec67c6f 100644
--- a/src/org/libvirt/jna/Libvirt.java
+++ b/src/org/libvirt/jna/Libvirt.java
@@ -4,6 +4,7 @@ package org.libvirt.jna;
 import com.sun.jna.Callback;
 import com.sun.jna.Library ;
 import com.sun.jna.Native;
+import com.sun.jna.NativeLong;
 import com.sun.jna.Pointer;
 import com.sun.jna.Structure.ByReference;
 import com.sun.jna.ptr.IntByReference;
@@ -16,7 +17,8 @@ public interface Libvirt extends Library
     
     // Constants we need
     public static int VIR_UUID_BUFLEN = 16 ;
-    public static int VIR_UUID_STRING_BUFLEN = (36+1) ;    
+    public static int VIR_UUID_STRING_BUFLEN = (36+1) ;
+    public static int VIR_DOMAIN_SCHED_FIELD_LENGTH = 80 ;
     
     // Global functions
     public int virCopyLastError(virError error) ;
@@ -69,13 +71,45 @@ public interface Libvirt extends Library
     public int virNetworkUndefine(Pointer virConnectPtr) ;       
     
     // Domain functions
+    public int virDomainAttachDevice(Pointer virDomainPtr, String deviceXML) ;    
+    public int virDomainBlockStats(Pointer virDomainPtr, String path, virDomainBlockStats stats, int size) ;
+    public int virDomainCreate(Pointer virDomainPtr) ;       
     public Pointer virDomainCreateLinux(Pointer virConnectPtr, String xmlDesc, int flags) ;    
     public Pointer virDomainCreateXML(Pointer virConnectPtr, String xmlDesc, int flags) ;
-    public Pointer virDomainDefineXML(Pointer virConnectPtr, String xmlDesc) ;       
+    public int virDomainCoreDump(Pointer virDomainPtr, String to, int flags) ;
+    public Pointer virDomainDefineXML(Pointer virConnectPtr, String xmlDesc) ; 
+    public int virDomainDetachDevice(Pointer virDomainPtr, String deviceXML) ;  
+    public int virDomainDestroy(Pointer virDomainPtr) ;        
+    public int virDomainFree(Pointer virDomainPtr) ;       
+    public int virDomainGetAutostart(Pointer virDomainPtr, IntByReference value) ;
+    public int virDomainGetID(Pointer virDomainPtr) ;      
+    public int virDomainGetInfo(Pointer virDomainPtr, virDomainInfo vInfo) ;
+    public NativeLong virDomainGetMaxMemory(Pointer virDomainPtr) ;
+    public int virDomainGetMaxVcpus(Pointer virDomainPtr) ;
+    public String virDomainGetName(Pointer virDomainPtr) ;    
+    public String virDomainGetOSType(Pointer virDomainPtr) ;        
+    public int virDomainGetUUID(Pointer virDomainPtr, byte[] uuidString) ;    
+    public int virDomainGetUUIDString(Pointer virDomainPtr, byte[] uuidString) ;    
+    public String virDomainGetXMLDesc(Pointer virDomainPtr, int flags) ;
+    public String virDomainGetSchedulerType(Pointer virDomainPtr, IntByReference nparams) ;
+    public int virDomainGetSchedulerParameters(Pointer virDomainPtr, virSchedParameter[] params, IntByReference nparams) ;
+    public int virDomainGetVcpus(Pointer virDomainPtr, virVcpuInfo[] info, int maxInfo, byte[] cpumaps, int maplen) ;
+    public int virDomainInterfaceStats(Pointer virDomainPtr, String path, virDomainInterfaceStats stats, int size) ;
     public Pointer virDomainLookupByID(Pointer virConnectPtr, int id) ;
     public Pointer virDomainLookupByName(Pointer virConnectPtr, String name) ;    
     public Pointer virDomainLookupByUUID(Pointer virConnectPtr, String uuidstr) ;    
     public Pointer virDomainLookupByUUIDString(Pointer virConnectPtr, String uuidstr) ;
-      
-
+    public Pointer virDomainMigrate(Pointer virDomainPtr, Pointer virConnectPtr, NativeLong flags, String dname, String uri, NativeLong bandwidth) ;
+    public int virDomainPinVcpu(Pointer virDomainPtr, int vcpu, byte[] cpumap, int maplen) ;    
+    public int virDomainReboot(Pointer virDomainPtr, int flags) ;
+    public int virDomainResume(Pointer virDomainPtr) ;    
+    public int virDomainSave(Pointer virDomainPtr, String to) ; 
+    public int virDomainSetAutostart(Pointer virDomainPtr, int autoStart) ;
+    public int virDomainSetSchedulerParameters(Pointer virDomainPtr, virSchedParameter[] params, IntByReference nparams) ;     
+    public int virDomainSetMaxMemory(Pointer virDomainPtr, NativeLong maxMemory) ;
+    public int virDomainSetMemory(Pointer virDomainPtr, NativeLong maxMemory) ;    
+    public int virDomainSetVcpus(Pointer virDomainPtr, int nvcpus) ;    
+    public int virDomainShutdown(Pointer virDomainPtr) ;        
+    public int virDomainSuspend(Pointer virDomainPtr) ;    
+    public int virDomainUndefine(Pointer virDomainPtr) ;   
 }
diff --git a/src/org/libvirt/jna/virDomainBlockStats.java b/src/org/libvirt/jna/virDomainBlockStats.java
new file mode 100644
index 0000000..446e016
--- /dev/null
+++ b/src/org/libvirt/jna/virDomainBlockStats.java
@@ -0,0 +1,12 @@
+package org.libvirt.jna;
+
+import com.sun.jna.Structure;
+
+public class virDomainBlockStats extends Structure
+{
+    public long rd_req ;
+    public long rd_bytes ;    
+    public long wr_req ;
+    public long wr_bytes ;    
+    public long errs ;    
+}
diff --git a/src/org/libvirt/jna/virDomainInfo.java b/src/org/libvirt/jna/virDomainInfo.java
new file mode 100644
index 0000000..15d4836
--- /dev/null
+++ b/src/org/libvirt/jna/virDomainInfo.java
@@ -0,0 +1,13 @@
+package org.libvirt.jna;
+
+import com.sun.jna.NativeLong;
+import com.sun.jna.Structure ;
+
+public class virDomainInfo extends Structure
+{
+    public int state ;
+    public NativeLong maxMem ;
+    public NativeLong memory ;    
+    public short nrVirtCpu ;
+    public long cpuTime ;  
+}
diff --git a/src/org/libvirt/jna/virDomainInterfaceStats.java b/src/org/libvirt/jna/virDomainInterfaceStats.java
new file mode 100644
index 0000000..3fda2dd
--- /dev/null
+++ b/src/org/libvirt/jna/virDomainInterfaceStats.java
@@ -0,0 +1,16 @@
+package org.libvirt.jna;
+
+import com.sun.jna.Structure;
+
+public class virDomainInterfaceStats extends Structure
+{
+    public long rx_bytes;
+    public long rx_packets;
+    public long rx_errs;
+    public long rx_drop;
+    public long tx_bytes;
+    public long tx_packets;
+    public long tx_errs;
+    public long tx_drop;
+    
+}
diff --git a/src/org/libvirt/jna/virSchedParameter.java b/src/org/libvirt/jna/virSchedParameter.java
new file mode 100644
index 0000000..f8440e1
--- /dev/null
+++ b/src/org/libvirt/jna/virSchedParameter.java
@@ -0,0 +1,11 @@
+package org.libvirt.jna;
+
+import com.sun.jna.Structure;
+
+public class virSchedParameter extends Structure 
+{
+    public byte field[] = new byte[Libvirt.VIR_DOMAIN_SCHED_FIELD_LENGTH] ;
+    public int type ;
+    public virSchedParameterValue value ;
+    
+}
diff --git a/src/org/libvirt/jna/virSchedParameterValue.java b/src/org/libvirt/jna/virSchedParameterValue.java
new file mode 100644
index 0000000..ff2cdfc
--- /dev/null
+++ b/src/org/libvirt/jna/virSchedParameterValue.java
@@ -0,0 +1,13 @@
+package org.libvirt.jna;
+
+import com.sun.jna.Structure;
+
+public class virSchedParameterValue extends Structure
+{
+        public int i;                          /* data for integer case */
+        public int ui;        /* data for unsigned integer case */
+        public long  l;        /* data for long long integer case */
+        public long  ul;      /* data for unsigned long long integer case */
+        public double d;       /* data for double case */
+        public byte b;         /* data for char case */
+}
diff --git a/src/org/libvirt/jna/virVcpuInfo.java b/src/org/libvirt/jna/virVcpuInfo.java
new file mode 100644
index 0000000..ba72ce8
--- /dev/null
+++ b/src/org/libvirt/jna/virVcpuInfo.java
@@ -0,0 +1,12 @@
+package org.libvirt.jna;
+
+import com.sun.jna.Structure;
+
+public class virVcpuInfo extends Structure
+{
+    public int number ;
+    public int state ;
+    public long cpuTime ;
+    public int cpu ;
+ 
+}
diff --git a/src/test.java b/src/test.java
index a7d7ec8..40e0afc 100644
--- a/src/test.java
+++ b/src/test.java
@@ -177,81 +177,93 @@ public class test {
 		
 		//Domain stuff
 		
-//		try{
+		try{
 //
 //			
 //			//Domain lookup
-//			//Domain testDomain=conn.domainLookupByID(1);
-//			//Domain testDomain=conn.domainLookupByName("test");
-//			//Domain testDomain=conn.domainLookupByUUIDString("004b96e1-2d78-c30f-5aa5-f03c87d21e69");
+			//Domain testDomain=conn.domainLookupByID(1);
+			//Domain testDomain=conn.domainLookupByName("test");
+			//Domain testDomain=conn.domainLookupByUUIDString("004b96e1-2d78-c30f-5aa5-f03c87d21e69");
+		    Domain testDomain = conn.domainLookupByID(1);
+		    System.out.println("domainLookupByID: " + testDomain) ;
+            testDomain = conn.domainLookupByName("test");
+            System.out.println("domainLookupByName: " + testDomain) ;		    
 //			Domain testDomain=conn.domainLookupByUUID(UUID);
-//			
-//			//Exercise the getter methods on the default domain
-//			System.out.println("virDomainGetXMLDesc:" + testDomain.getXMLDesc(0));
-//			System.out.println("virDomainGetAutostart:" + testDomain.getAutostart());
-//			System.out.println("virDomainGetConnect:" + testDomain.getConnect());
-//			System.out.println("virDomainGetIDt:" + testDomain.getID());
-//			System.out.println("virDomainGetInfo:" + testDomain.getInfo());
-//			System.out.println("virDomainGetMaxMemory:" + testDomain.getMaxMemory());
-//			//Should fail, test driver does not support it
-//			//System.out.println("virDomainGetMaxVcpus:" + testDomain.getMaxVcpus());
-//			System.out.println("virDomainGetName:" + testDomain.getName());
-//			System.out.println("virDomainGetOSType:" + testDomain.getOSType());
-//			System.out.println("virDomainGetSchedulerType:" + testDomain.getSchedulerType());
-//			System.out.println("virDomainGetSchedulerParameters:" + testDomain.getSchedulerParameters());
-//			//Iterate over the parameters the painful way
-//			for(SchedParameter c: testDomain.getSchedulerParameters()){
-//				if (c instanceof SchedIntParameter)
-//					System.out.println("Int:" + ((SchedIntParameter)c).field +":"+ ((SchedIntParameter)c).value);
-//				if (c instanceof SchedUintParameter)
-//					System.out.println("Uint:" + ((SchedUintParameter)c).field  +":"+  ((SchedUintParameter)c).value);
-//				if (c instanceof SchedLongParameter)
-//					System.out.println("Long:" + ((SchedLongParameter)c).field  +":"+  ((SchedLongParameter)c).value);
-//				if (c instanceof SchedUlongParameter)
-//					System.out.println("Ulong:" + ((SchedUlongParameter)c).field  +":"+  ((SchedUlongParameter)c).value);
-//				if (c instanceof SchedDoubleParameter)
-//					System.out.println("Double:" + ((SchedDoubleParameter)c).field  +":"+  ((SchedDoubleParameter)c).value);
-//				if (c instanceof SchedBooleanParameter)
-//					System.out.println("Boolean:" + ((SchedBooleanParameter)c).field  +":"+  ((SchedBooleanParameter)c).value);
-//			}
-//			//Iterate over the parameters the easy way
-//			for(SchedParameter c: testDomain.getSchedulerParameters()){
-//				System.out.println(c.getTypeAsString() +":"+ c.field +":"+  c.getValueAsString());
-//			}
-//			System.out.println("virDomainGetUUID:" + testDomain.getUUID());
-//			for(int c: testDomain.getUUID())
-//				System.out.print(Integer.toHexString(c));
-//			System.out.println();
-//			System.out.println("virDomainGetUUIDString:" + testDomain.getUUIDString());
-//			//Should fail, unimplemented in test driver		
-//			//System.out.println("virDomainGetVcpusInfo:" + testDomain.getVcpusInfo());
-//			//Same as above
-//			//System.out.println("virDomainGetVcpusCpuMap:" + testDomain.getVcpusCpuMaps());
-//			//Should test pinVcpu, when we test with real xen
-//			//Here
-//			//Attach default network to test domain
-//			//System.out.println("virDomainGetVcpusCpuMap:" + testDomain.getVcpusCpuMaps());
-//			
-//			//Should test interfacestats and blockstats with real xen
-//			
-//			//Close the connection
-//			
-//			conn.close();
-//		} catch (LibvirtException e){
-//			System.out.println("exception caught:"+e);
-//			System.out.println(e.getError());
-//		}
-//		
-//		
-//		
-//		try{
-//			//We should get an exception, not a crash
-//			System.out.println(conn.getHostName());
-//		}catch (LibvirtException e){
-//			System.out.println("exception caught:"+e);
-//			System.out.println(e.getError());
-//		}
-//		System.out.println();
+//          System.out.println("domainLookupByUUID: " + testDomain) ;               
+			
+			//Exercise the getter methods on the default domain
+			System.out.println("virDomainGetXMLDesc:" + testDomain.getXMLDesc(0));
+			System.out.println("virDomainGetAutostart:" + testDomain.getAutostart());
+			System.out.println("virDomainGetConnect:" + testDomain.getConnect());
+			System.out.println("virDomainGetID:" + testDomain.getID());
+			System.out.println("virDomainGetInfo:" + testDomain.getInfo());
+			System.out.println("virDomainGetMaxMemory:" + testDomain.getMaxMemory());
+			//Should fail, test driver does not support it
+			try {
+			    System.out.println("virDomainGetMaxVcpus:" + testDomain.getMaxVcpus());
+	            System.out.println(FIXME) ;     
+			}
+			catch (LibvirtException e) {
+			    
+			}
+			System.out.println("virDomainGetName:" + testDomain.getName());
+			System.out.println("virDomainGetOSType:" + testDomain.getOSType());
+			System.out.println("virDomainGetSchedulerType:" + testDomain.getSchedulerType());
+			System.out.println("virDomainGetSchedulerParameters:" + testDomain.getSchedulerParameters());
+			//Iterate over the parameters the painful way
+			for(SchedParameter c: testDomain.getSchedulerParameters()){
+				if (c instanceof SchedIntParameter)
+					System.out.println("Int:" + ((SchedIntParameter)c).field +":"+ ((SchedIntParameter)c).value);
+				if (c instanceof SchedUintParameter)
+					System.out.println("Uint:" + ((SchedUintParameter)c).field  +":"+  ((SchedUintParameter)c).value);
+				if (c instanceof SchedLongParameter)
+					System.out.println("Long:" + ((SchedLongParameter)c).field  +":"+  ((SchedLongParameter)c).value);
+				if (c instanceof SchedUlongParameter)
+					System.out.println("Ulong:" + ((SchedUlongParameter)c).field  +":"+  ((SchedUlongParameter)c).value);
+				if (c instanceof SchedDoubleParameter)
+					System.out.println("Double:" + ((SchedDoubleParameter)c).field  +":"+  ((SchedDoubleParameter)c).value);
+				if (c instanceof SchedBooleanParameter)
+					System.out.println("Boolean:" + ((SchedBooleanParameter)c).field  +":"+  ((SchedBooleanParameter)c).value);
+			}
+			//Iterate over the parameters the easy way
+			for(SchedParameter c: testDomain.getSchedulerParameters()){
+				System.out.println(c.getTypeAsString() +":"+ c.field +":"+  c.getValueAsString());
+			}
+			System.out.println("virDomainGetUUID:" + testDomain.getUUID());
+            System.out.println(FIXME) ;   			
+			for(int c: testDomain.getUUID())
+				System.out.print(String.format("%02x", c));
+			System.out.println();
+			System.out.println("virDomainGetUUIDString:" + testDomain.getUUIDString());
+			//Should fail, unimplemented in test driver		
+			//System.out.println("virDomainGetVcpusInfo:" + testDomain.getVcpusInfo());
+			//Same as above
+			//System.out.println("virDomainGetVcpusCpuMap:" + testDomain.getVcpusCpuMaps());
+			//Should test pinVcpu, when we test with real xen
+			//Here
+			//Attach default network to test domain
+			//System.out.println("virDomainGetVcpusCpuMap:" + testDomain.getVcpusCpuMaps());
+			
+			//Should test interfacestats and blockstats with real xen
+			
+			//Close the connection
+			
+			conn.close();
+		} catch (LibvirtException e){
+			System.out.println("exception caught:"+e);
+			System.out.println(e.getError());
+		}
+		
+		
+		
+		try{
+			//We should get an exception, not a crash
+			System.out.println(conn.getHostName());
+		}catch (LibvirtException e){
+			System.out.println("exception caught:"+e);
+			System.out.println(e.getError());
+		}
+		System.out.println("Fini!");
 	}
 
 }
-- 
1.6.0.6

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]