qemu: Fix leak in qemuProcessInitCpuAffinity()
[libvirt/ericb.git] / src / qemu / qemu_migration_cookie.h
blob0c80b17e5e1390957b15f6fc01db831440718337
1 /*
2 * qemu_migration_cookie.h: QEMU migration cookie handling
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see
16 * <http://www.gnu.org/licenses/>.
19 #ifndef LIBVIRT_QEMU_MIGRATION_COOKIE_H
20 # define LIBVIRT_QEMU_MIGRATION_COOKIE_H
22 # include "qemu_migration_params.h"
23 # include "virenum.h"
25 typedef enum {
26 QEMU_MIGRATION_COOKIE_FLAG_GRAPHICS,
27 QEMU_MIGRATION_COOKIE_FLAG_LOCKSTATE,
28 QEMU_MIGRATION_COOKIE_FLAG_PERSISTENT,
29 QEMU_MIGRATION_COOKIE_FLAG_NETWORK,
30 QEMU_MIGRATION_COOKIE_FLAG_NBD,
31 QEMU_MIGRATION_COOKIE_FLAG_STATS,
32 QEMU_MIGRATION_COOKIE_FLAG_MEMORY_HOTPLUG,
33 QEMU_MIGRATION_COOKIE_FLAG_CPU_HOTPLUG,
34 QEMU_MIGRATION_COOKIE_FLAG_CPU,
35 QEMU_MIGRATION_COOKIE_FLAG_ALLOW_REBOOT,
36 QEMU_MIGRATION_COOKIE_FLAG_CAPS,
38 QEMU_MIGRATION_COOKIE_FLAG_LAST
39 } qemuMigrationCookieFlags;
41 VIR_ENUM_DECL(qemuMigrationCookieFlag);
43 typedef enum {
44 QEMU_MIGRATION_COOKIE_GRAPHICS = (1 << QEMU_MIGRATION_COOKIE_FLAG_GRAPHICS),
45 QEMU_MIGRATION_COOKIE_LOCKSTATE = (1 << QEMU_MIGRATION_COOKIE_FLAG_LOCKSTATE),
46 QEMU_MIGRATION_COOKIE_PERSISTENT = (1 << QEMU_MIGRATION_COOKIE_FLAG_PERSISTENT),
47 QEMU_MIGRATION_COOKIE_NETWORK = (1 << QEMU_MIGRATION_COOKIE_FLAG_NETWORK),
48 QEMU_MIGRATION_COOKIE_NBD = (1 << QEMU_MIGRATION_COOKIE_FLAG_NBD),
49 QEMU_MIGRATION_COOKIE_STATS = (1 << QEMU_MIGRATION_COOKIE_FLAG_STATS),
50 QEMU_MIGRATION_COOKIE_MEMORY_HOTPLUG = (1 << QEMU_MIGRATION_COOKIE_FLAG_MEMORY_HOTPLUG),
51 QEMU_MIGRATION_COOKIE_CPU_HOTPLUG = (1 << QEMU_MIGRATION_COOKIE_FLAG_CPU_HOTPLUG),
52 QEMU_MIGRATION_COOKIE_CPU = (1 << QEMU_MIGRATION_COOKIE_FLAG_CPU),
53 QEMU_MIGRATION_COOKIE_ALLOW_REBOOT = (1 << QEMU_MIGRATION_COOKIE_FLAG_ALLOW_REBOOT),
54 QEMU_MIGRATION_COOKIE_CAPS = (1 << QEMU_MIGRATION_COOKIE_FLAG_CAPS),
55 } qemuMigrationCookieFeatures;
57 typedef struct _qemuMigrationCookieGraphics qemuMigrationCookieGraphics;
58 typedef qemuMigrationCookieGraphics *qemuMigrationCookieGraphicsPtr;
59 struct _qemuMigrationCookieGraphics {
60 int type;
61 int port;
62 int tlsPort;
63 char *listen;
64 char *tlsSubject;
67 typedef struct _qemuMigrationCookieNetData qemuMigrationCookieNetData;
68 typedef qemuMigrationCookieNetData *qemuMigrationCookieNetDataPtr;
69 struct _qemuMigrationCookieNetData {
70 int vporttype; /* enum virNetDevVPortProfile */
73 * Array of pointers to saved data. Each VIF will have its own
74 * data to transfer.
76 char *portdata;
79 typedef struct _qemuMigrationCookieNetwork qemuMigrationCookieNetwork;
80 typedef qemuMigrationCookieNetwork *qemuMigrationCookieNetworkPtr;
81 struct _qemuMigrationCookieNetwork {
82 /* How many virtual NICs are we saving data for? */
83 int nnets;
85 qemuMigrationCookieNetDataPtr net;
88 typedef struct _qemuMigrationCookieNBD qemuMigrationCookieNBD;
89 typedef qemuMigrationCookieNBD *qemuMigrationCookieNBDPtr;
90 struct _qemuMigrationCookieNBD {
91 int port; /* on which port does NBD server listen for incoming data */
93 size_t ndisks; /* Number of items in @disk array */
94 struct {
95 char *target; /* Disk target */
96 unsigned long long capacity; /* And its capacity */
97 } *disks;
100 typedef struct _qemuMigrationCookieCaps qemuMigrationCookieCaps;
101 typedef qemuMigrationCookieCaps *qemuMigrationCookieCapsPtr;
102 struct _qemuMigrationCookieCaps {
103 virBitmapPtr supported;
104 virBitmapPtr automatic;
107 typedef struct _qemuMigrationCookie qemuMigrationCookie;
108 typedef qemuMigrationCookie *qemuMigrationCookiePtr;
109 struct _qemuMigrationCookie {
110 unsigned int flags;
111 unsigned int flagsMandatory;
113 /* Host properties */
114 unsigned char localHostuuid[VIR_UUID_BUFLEN];
115 unsigned char remoteHostuuid[VIR_UUID_BUFLEN];
116 char *localHostname;
117 char *remoteHostname;
119 /* Guest properties */
120 unsigned char uuid[VIR_UUID_BUFLEN];
121 char *name;
123 /* If (flags & QEMU_MIGRATION_COOKIE_LOCKSTATE) */
124 char *lockState;
125 char *lockDriver;
127 /* If (flags & QEMU_MIGRATION_COOKIE_GRAPHICS) */
128 qemuMigrationCookieGraphicsPtr graphics;
130 /* If (flags & QEMU_MIGRATION_COOKIE_PERSISTENT) */
131 virDomainDefPtr persistent;
133 /* If (flags & QEMU_MIGRATION_COOKIE_NETWORK) */
134 qemuMigrationCookieNetworkPtr network;
136 /* If (flags & QEMU_MIGRATION_COOKIE_NBD) */
137 qemuMigrationCookieNBDPtr nbd;
139 /* If (flags & QEMU_MIGRATION_COOKIE_STATS) */
140 qemuDomainJobInfoPtr jobInfo;
142 /* If flags & QEMU_MIGRATION_COOKIE_CPU */
143 virCPUDefPtr cpu;
145 /* If flags & QEMU_MIGRATION_COOKIE_ALLOW_REBOOT */
146 virTristateBool allowReboot;
148 /* If flags & QEMU_MIGRATION_COOKIE_CAPS */
149 qemuMigrationCookieCapsPtr caps;
154 qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
155 virQEMUDriverPtr driver,
156 virDomainObjPtr dom,
157 qemuMigrationParty party,
158 char **cookieout,
159 int *cookieoutlen,
160 unsigned int flags);
162 qemuMigrationCookiePtr
163 qemuMigrationEatCookie(virQEMUDriverPtr driver,
164 const virDomainDef *def,
165 const char *origname,
166 qemuDomainObjPrivatePtr priv,
167 const char *cookiein,
168 int cookieinlen,
169 unsigned int flags);
171 void
172 qemuMigrationCookieFree(qemuMigrationCookiePtr mig);
175 qemuMigrationCookieAddPersistent(qemuMigrationCookiePtr mig,
176 virDomainDefPtr *def);
178 virDomainDefPtr
179 qemuMigrationCookieGetPersistent(qemuMigrationCookiePtr mig);
181 #endif /* LIBVIRT_QEMU_MIGRATION_COOKIE_H */