qemu_conf.h 4.6 KB
Newer Older
D
Daniel P. Berrange 已提交
1
/*
2
 * qemu_conf.h: QEMU configuration management
D
Daniel P. Berrange 已提交
3
 *
4
 * Copyright (C) 2006-2007, 2009-2012 Red Hat, Inc.
D
Daniel P. Berrange 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 * Copyright (C) 2006 Daniel P. Berrange
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

24
#ifndef __QEMUD_CONF_H
25
# define __QEMUD_CONF_H
D
Daniel P. Berrange 已提交
26

27
# include <config.h>
28

29 30 31 32 33 34 35
# include "ebtables.h"
# include "internal.h"
# include "capabilities.h"
# include "network_conf.h"
# include "domain_conf.h"
# include "domain_event.h"
# include "threads.h"
36
# include "security/security_manager.h"
37 38
# include "cgroup.h"
# include "pci.h"
39
# include "hostusb.h"
40 41
# include "cpu_conf.h"
# include "driver.h"
42
# include "bitmap.h"
E
Eric Blake 已提交
43
# include "command.h"
H
Hu Tao 已提交
44
# include "threadpool.h"
45
# include "locking/lock_manager.h"
46

47
# define QEMUD_CPUMASK_LEN CPU_SETSIZE
48

49 50 51

/* Main driver state */
struct qemud_driver {
52
    virMutex lock;
53

H
Hu Tao 已提交
54 55
    virThreadPoolPtr workerPool;

56 57
    int privileged;

58 59
    uid_t user;
    gid_t group;
60
    int dynamicOwnership;
61

62
    unsigned int qemuVersion;
63
    int nextvmid;
64

65
    virCgroupPtr cgroup;
66 67 68
    int cgroupControllers;
    char **cgroupDeviceACL;

69
    virDomainObjList domains;
70

71 72
    /* These four directories are ones libvirtd uses (so must be root:root
     * to avoid security risk from QEMU processes */
73 74
    char *configDir;
    char *autostartDir;
75
    char *logDir;
76
    char *stateDir;
77 78 79 80
    /* These two directories are ones QEMU processes use (so must match
     * the QEMU user/group */
    char *libDir;
    char *cacheDir;
81
    char *saveDir;
C
Chris Lalancette 已提交
82
    char *snapshotDir;
E
Eric Blake 已提交
83
    char *qemuImgBinary;
84
    unsigned int vncAutoUnixSocket : 1;
85 86
    unsigned int vncTLS : 1;
    unsigned int vncTLSx509verify : 1;
87
    unsigned int vncSASL : 1;
D
Daniel P. Berrange 已提交
88
    char *vncTLSx509certdir;
89
    char *vncListen;
90
    char *vncPassword;
91
    char *vncSASLdir;
92 93 94 95
    unsigned int spiceTLS : 1;
    char *spiceTLSx509certdir;
    char *spiceListen;
    char *spicePassword;
96 97
    char *hugetlbfs_mount;
    char *hugepage_path;
98

99 100 101
    unsigned int macFilter : 1;
    ebtablesContext *ebtables;

102
    unsigned int relaxedACS : 1;
103
    unsigned int vncAllowHostAudio : 1;
104
    unsigned int clearEmulatorCapabilities : 1;
105
    unsigned int allowDiskFormatProbing : 1;
106
    unsigned int setProcessName : 1;
107

108
    int maxProcesses;
109
    int maxFiles;
110

111 112
    int max_queued;

113
    virCapsPtr caps;
114

115
    virDomainEventStatePtr domainEventState;
116 117

    char *securityDriverName;
118
    virSecurityManagerPtr securityManager;
119 120

    char *saveImageFormat;
121
    char *dumpImageFormat;
122

H
Hu Tao 已提交
123
    char *autoDumpPath;
124 125 126
    bool autoDumpBypassCache;

    bool autoStartBypassCache;
H
Hu Tao 已提交
127

128
    pciDeviceList *activePciHostdevs;
129
    usbDeviceList *activeUsbHostdevs;
130

131 132 133
    /* The devices which is are not in use by the host or any guest. */
    pciDeviceList *inactivePciHostdevs;

134
    virBitmapPtr reservedVNCPorts;
135 136

    virSysinfoDefPtr hostsysinfo;
137 138

    virLockManagerPluginPtr lockManager;
139 140 141 142 143

    /* Mapping of 'char *uuidstr' -> virConnectPtr
     * of guests which will be automatically killed
     * when the virConnectPtr is closed*/
    virHashTablePtr autodestroy;
144 145 146

    int keepAliveInterval;
    unsigned int keepAliveCount;
147 148
};

149 150 151 152 153 154 155 156 157 158 159
typedef struct _qemuDomainCmdlineDef qemuDomainCmdlineDef;
typedef qemuDomainCmdlineDef *qemuDomainCmdlineDefPtr;
struct _qemuDomainCmdlineDef {
    unsigned int num_args;
    char **args;

    unsigned int num_env;
    char **env_name;
    char **env_value;
};

D
Daniel Veillard 已提交
160
/* Port numbers used for KVM migration. */
161 162
# define QEMUD_MIGRATION_FIRST_PORT 49152
# define QEMUD_MIGRATION_NUM_PORTS 64
163

164
# define qemuReportError(code, ...)                                      \
165
    virReportErrorHelper(VIR_FROM_QEMU, code, __FILE__,                  \
166
                         __FUNCTION__, __LINE__, __VA_ARGS__)
167 168


169 170
void qemuDriverLock(struct qemud_driver *driver);
void qemuDriverUnlock(struct qemud_driver *driver);
D
Daniel P. Berrange 已提交
171 172
int qemudLoadDriverConfig(struct qemud_driver *driver,
                          const char *filename);
173

174 175 176 177
struct qemuDomainDiskInfo {
    bool removable;
    bool locked;
    bool tray_open;
178
    int io_status;
179 180
};

181
#endif /* __QEMUD_CONF_H */