Commit 4b426b0cab2f3ea9d7dc5b0d2047754c85f2fa37
Add the first 0.7.5 API, virConnectCompareCPU
| |   |
| 1 | 1 | version=0.4.3 |
| 2 | 2 | release=1 |
| libvirt.required=0.7.3 |
| libvirt.required=0.7.5 |
| 4 | 4 | java.required=1:1.5.0 |
| 5 | 5 | rpm.topdir=/home/bkearney/rpmbuild |
| 6 | 6 | jar.dir=/usr/share/java |
| |   |
| package org.libvirt; |
|
| import java.util.EnumSet; |
| import java.util.HashMap; |
|
| public enum CPUCompareResult { |
| VIR_CPU_COMPARE_ERROR(-1), VIR_CPU_COMPARE_INCOMPATIBLE(0), VIR_CPU_COMPARE_IDENTICAL(1), VIR_CPU_COMPARE_SUPERSET( |
| 2); |
|
| static HashMap<Integer, CPUCompareResult> lookup = new HashMap<Integer, CPUCompareResult>(); |
|
| static { |
| for (CPUCompareResult s : EnumSet.allOf(CPUCompareResult.class)) { |
| lookup.put(s.getReturnCode(), s); |
| } |
| } |
|
| public static CPUCompareResult get(int value) { |
| return lookup.get(value); |
| } |
|
| private final int returnCode; |
|
| CPUCompareResult(int returnCode) { |
| this.returnCode = returnCode; |
| } |
|
| public int getReturnCode() { |
| return returnCode; |
| } |
|
| } |
| |   |
| 242 | 242 | } |
| 243 | 243 | return success; |
| 244 | 244 | } |
| |
| |
| /** |
| * Compares the given CPU description with the host CPU |
| * @see <a href="http://www.libvirt.org/html/libvirt-libvirt.html#virConnectCompareCPU">Libvirt Documentation</a> |
| * @param xmlDesc |
| * @return comparison result according to enum CPUCompareResult |
| * @throws LibvirtException |
| */ |
| public CPUCompareResult compareCPU(String xmlDesc) throws LibvirtException { |
| int rawResult = libvirt.virConnectCompareCPU(VCP, xmlDesc, 0); |
| processError(); |
| return CPUCompareResult.get(rawResult); |
| } |
| 245 | 259 | |
| 246 | 260 | /** |
| 247 | 261 | * Create a new device on the VM host machine, for example, virtual HBAs |
| |   |
| 95 | 95 | // Connection Functions |
| 96 | 96 | public int virConnCopyLastError(ConnectionPointer virConnectPtr, virError to); |
| 97 | 97 | public int virConnectClose(ConnectionPointer virConnectPtr); |
| public int virConnectCompareCPU(ConnectionPointer virConnectPtr, String xmlDesc, int flags); |
| 98 | 99 | public void virConnSetErrorFunc(ConnectionPointer virConnectPtr, Pointer userData, VirErrorCallback callback); |
| 99 | 100 | public int virConnectIsEncrypted(ConnectionPointer virConnectPtr) ; |
| 100 | 101 | public int virConnectIsSecure(ConnectionPointer virConnectPtr) ; |