backup: Implement qemu incremental pull backup
[libvirt/ericb.git] / tests / testutilsqemu.h
blob0632141d68fb7f07ec79266b9090a7e5c06ee464
1 /*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library. If not, see
14 * <http://www.gnu.org/licenses/>.
17 #pragma once
19 #ifdef WITH_QEMU
21 # include "capabilities.h"
22 # include "virfilecache.h"
23 # include "domain_conf.h"
24 # include "qemu/qemu_capabilities.h"
25 # include "qemu/qemu_conf.h"
27 # define TEST_QEMU_CAPS_PATH abs_srcdir "/qemucapabilitiesdata"
29 enum {
30 GIC_NONE = 0,
31 GIC_V2,
32 GIC_V3,
33 GIC_BOTH,
36 typedef enum {
37 ARG_QEMU_CAPS,
38 ARG_GIC,
39 ARG_MIGRATE_FROM,
40 ARG_MIGRATE_FD,
41 ARG_FLAGS,
42 ARG_PARSEFLAGS,
43 ARG_CAPS_ARCH,
44 ARG_CAPS_VER,
45 ARG_END,
46 } testQemuInfoArgName;
48 typedef enum {
49 FLAG_EXPECT_FAILURE = 1 << 0,
50 FLAG_EXPECT_PARSE_ERROR = 1 << 1,
51 FLAG_FIPS = 1 << 2,
52 FLAG_REAL_CAPS = 1 << 3,
53 FLAG_SKIP_LEGACY_CPUS = 1 << 4,
54 } testQemuInfoFlags;
56 struct testQemuInfo {
57 const char *name;
58 char *infile;
59 char *outfile;
60 virQEMUCapsPtr qemuCaps;
61 const char *migrateFrom;
62 int migrateFd;
63 unsigned int flags;
64 unsigned int parseFlags;
67 virCapsPtr testQemuCapsInit(void);
68 virDomainXMLOptionPtr testQemuXMLConfInit(void);
71 virQEMUCapsPtr qemuTestParseCapabilitiesArch(virArch arch,
72 const char *capsFile);
73 virQEMUCapsPtr qemuTestParseCapabilities(virCapsPtr caps,
74 const char *capsFile);
76 extern virCPUDefPtr cpuDefault;
77 extern virCPUDefPtr cpuHaswell;
78 extern virCPUDefPtr cpuPower8;
79 extern virCPUDefPtr cpuPower9;
81 void qemuTestSetHostArch(virCapsPtr caps,
82 virArch arch);
83 void qemuTestSetHostCPU(virCapsPtr caps,
84 virCPUDefPtr cpu);
86 int qemuTestDriverInit(virQEMUDriver *driver);
87 void qemuTestDriverFree(virQEMUDriver *driver);
88 int qemuTestCapsCacheInsert(virFileCachePtr cache,
89 virQEMUCapsPtr caps);
91 int testQemuCapsSetGIC(virQEMUCapsPtr qemuCaps,
92 int gic);
94 char *testQemuGetLatestCapsForArch(const char *arch,
95 const char *suffix);
96 virHashTablePtr testQemuGetLatestCaps(void);
98 typedef int (*testQemuCapsIterateCallback)(const char *base,
99 const char *archName,
100 void *opaque);
101 int testQemuCapsIterate(const char *suffix,
102 testQemuCapsIterateCallback callback,
103 void *opaque);
105 int testQemuInfoSetArgs(struct testQemuInfo *info,
106 virHashTablePtr capslatest, ...);
107 void testQemuInfoClear(struct testQemuInfo *info);
109 #endif