qemu_conf.h 4.1 KB
Newer Older
D
Daniel P. Berrange 已提交
1
/*
2
 * qemu_conf.h: QEMU configuration management
D
Daniel P. Berrange 已提交
3
 *
E
Eric Blake 已提交
4
 * Copyright (C) 2006-2007, 2009-2010 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>
E
Eric Blake 已提交
28
# include <stdbool.h>
29

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

48
# define QEMUD_CPUMASK_LEN CPU_SETSIZE
49

50 51 52

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

H
Hu Tao 已提交
55 56
    virThreadPoolPtr workerPool;

57 58
    int privileged;

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

63
    unsigned int qemuVersion;
64
    int nextvmid;
65

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

70
    virDomainObjList domains;
71

72
    brControl *brctl;
73 74
    /* These four directories are ones libvirtd uses (so must be root:root
     * to avoid security risk from QEMU processes */
75 76
    char *configDir;
    char *autostartDir;
77
    char *logDir;
78
    char *stateDir;
79 80 81 82
    /* These two directories are ones QEMU processes use (so must match
     * the QEMU user/group */
    char *libDir;
    char *cacheDir;
83
    char *saveDir;
C
Chris Lalancette 已提交
84
    char *snapshotDir;
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
    virCapsPtr caps;
109 110 111

    /* An array of callbacks */
    virDomainEventCallbackListPtr domainEventCallbacks;
112 113 114
    virDomainEventQueuePtr domainEventQueue;
    int domainEventTimer;
    int domainEventDispatching;
115 116 117

    char *securityDriverName;
    virSecurityDriverPtr securityDriver;
118 119
    virSecurityDriverPtr securityPrimaryDriver;
    virSecurityDriverPtr securitySecondaryDriver;
120 121

    char *saveImageFormat;
122
    char *dumpImageFormat;
123

H
Hu Tao 已提交
124 125
    char *autoDumpPath;

126
    pciDeviceList *activePciHostdevs;
127 128

    virBitmapPtr reservedVNCPorts;
129 130

    virSysinfoDefPtr hostsysinfo;
131 132
};

133 134 135 136 137 138 139 140 141 142 143
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 已提交
144
/* Port numbers used for KVM migration. */
145 146
# define QEMUD_MIGRATION_FIRST_PORT 49152
# define QEMUD_MIGRATION_NUM_PORTS 64
147

148
# define qemuReportError(code, ...)                                      \
149
    virReportErrorHelper(NULL, VIR_FROM_QEMU, code, __FILE__,           \
150
                         __FUNCTION__, __LINE__, __VA_ARGS__)
151 152


D
Daniel P. Berrange 已提交
153 154
int qemudLoadDriverConfig(struct qemud_driver *driver,
                          const char *filename);
155

156
#endif /* __QEMUD_CONF_H */