qemu_command.h 7.7 KB
Newer Older
1 2 3
/*
 * qemu_command.h: QEMU command generation
 *
4
 * Copyright (C) 2006-2016 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16 17
 * 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
18
 * License along with this library.  If not, see
O
Osier Yang 已提交
19
 * <http://www.gnu.org/licenses/>.
20 21 22 23 24 25 26
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#ifndef __QEMU_COMMAND_H__
# define __QEMU_COMMAND_H__

27
# include "domain_addr.h"
28
# include "domain_conf.h"
29
# include "vircommand.h"
30 31
# include "capabilities.h"
# include "qemu_conf.h"
32
# include "qemu_domain.h"
33
# include "qemu_domain_address.h"
34
# include "qemu_capabilities.h"
35
# include "logging/log_manager.h"
36 37 38 39 40 41

/* Config type for XML import/export conversions */
# define QEMU_CONFIG_FORMAT_ARGV "qemu-argv"

# define QEMU_FSDEV_HOST_PREFIX "fsdev-"

42 43
# define QEMU_BLOCK_IOTUNE_MAX 1000000000000000LL

44
VIR_ENUM_DECL(qemuVideo)
45

46
virCommandPtr qemuBuildCommandLine(virQEMUDriverPtr driver,
47
                                   virLogManagerPtr logManager,
48
                                   virDomainDefPtr def,
49
                                   virDomainChrSourceDefPtr monitor_chr,
50
                                   bool monitor_json,
51
                                   virQEMUCapsPtr qemuCaps,
52
                                   const char *migrateURI,
53
                                   virDomainSnapshotObjPtr snapshot,
54
                                   virNetDevVPortProfileOp vmop,
55
                                   bool standalone,
56
                                   bool enableFips,
57 58
                                   virBitmapPtr nodeset,
                                   size_t *nnicindexes,
59
                                   int **nicindexes,
60 61
                                   const char *domainLibDir)
    ATTRIBUTE_NONNULL(15);
62

63

64 65 66 67
/* Generate the object properties for a secret */
int qemuBuildSecretInfoProps(qemuDomainSecretInfoPtr secinfo,
                             virJSONValuePtr *propsret);

68 69
/* Generate the object properties for a tls-creds-x509 */
int qemuBuildTLSx509BackendProps(const char *tlspath,
70
                                 bool isListen,
71
                                 bool verifypeer,
72
                                 const char *secalias,
73 74 75
                                 virQEMUCapsPtr qemuCaps,
                                 virJSONValuePtr *propsret);

76 77 78
/* Generate '-device' string for chardev device */
int
qemuBuildChrDeviceStr(char **deviceStr,
79
                      const virDomainDef *vmdef,
80 81
                      virDomainChrDefPtr chr,
                      virQEMUCapsPtr qemuCaps);
82

83
/* With vlan == -1, use netdev syntax, else old hostnet */
84 85 86 87 88
char *qemuBuildHostNetStr(virDomainNetDefPtr net,
                          virQEMUDriverPtr driver,
                          char type_sep,
                          int vlan,
                          char **tapfd,
89
                          size_t tapfdSize,
90
                          char **vhostfd,
91
                          size_t vhostfdSize);
92 93

/* Legacy, pre device support */
94 95 96
char *qemuBuildNicStr(virDomainNetDefPtr net,
                      const char *prefix,
                      int vlan);
97 98

/* Current, best practice */
99 100 101
char *qemuBuildNicDevStr(virDomainDefPtr def,
                         virDomainNetDefPtr net,
                         int vlan,
102
                         unsigned int bootindex,
103
                         size_t vhostfdSize,
104 105
                         virQEMUCapsPtr qemuCaps,
                         unsigned int mtu);
106

107
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk);
108 109

/* Both legacy & current support */
110
char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
111
                        virQEMUDriverConfigPtr cfg,
112
                        bool bootable,
113
                        virQEMUCapsPtr qemuCaps);
114 115

/* Current, best practice */
116
char *qemuBuildDriveDevStr(const virDomainDef *def,
117
                           virDomainDiskDefPtr disk,
118
                           unsigned int bootindex,
119
                           virQEMUCapsPtr qemuCaps);
120

121
/* Current, best practice */
122
char *qemuBuildControllerDevStr(const virDomainDef *domainDef,
123 124 125
                                virDomainControllerDefPtr def,
                                virQEMUCapsPtr qemuCaps,
                                int *nusbcontroller);
126

127
int qemuBuildMemoryBackendStr(virDomainMemoryDefPtr mem,
128 129 130 131 132 133 134 135
                              virBitmapPtr autoNodeset,
                              virDomainDefPtr def,
                              virQEMUCapsPtr qemuCaps,
                              virQEMUDriverConfigPtr cfg,
                              const char **backendType,
                              virJSONValuePtr *backendProps,
                              bool force);

136
char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem);
137

138
/* Current, best practice */
139
char *qemuBuildPCIHostdevDevStr(const virDomainDef *def,
140
                                virDomainHostdevDefPtr dev,
141
                                unsigned int bootIndex,
142 143
                                const char *configfd,
                                virQEMUCapsPtr qemuCaps);
144

145
char *qemuBuildRNGDevStr(const virDomainDef *def,
146 147
                         virDomainRNGDefPtr dev,
                         virQEMUCapsPtr qemuCaps);
148 149 150 151
int qemuBuildRNGBackendProps(virDomainRNGDefPtr rng,
                             virQEMUCapsPtr qemuCaps,
                             const char **type,
                             virJSONValuePtr *props);
152

153 154 155
int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);

/* Current, best practice */
156
char *qemuBuildUSBHostdevDevStr(const virDomainDef *def,
157 158 159
                                virDomainHostdevDefPtr dev,
                                virQEMUCapsPtr qemuCaps);

160
char *qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev);
J
Ján Tomko 已提交
161

162
char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
163
                                 virDomainHostdevDefPtr dev,
164
                                 virQEMUCapsPtr qemuCaps);
165 166 167 168 169
char *
qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
                                virDomainHostdevDefPtr dev,
                                virQEMUCapsPtr qemuCaps,
                                char *vhostfdName);
170

171
char *qemuBuildRedirdevDevStr(const virDomainDef *def,
172 173
                              virDomainRedirdevDefPtr dev,
                              virQEMUCapsPtr qemuCaps);
174

175 176
int qemuNetworkPrepareDevices(virDomainDefPtr def);

177
int qemuGetDriveSourceString(virStorageSourcePtr src,
178
                             qemuDomainSecretInfoPtr secinfo,
179
                             char **source);
180 181

int qemuCheckDiskConfig(virDomainDiskDefPtr disk);
182 183 184

bool
qemuCheckFips(void);
185

186
bool qemuCheckCCWS390AddressSupport(const virDomainDef *def,
187 188 189
                                    virDomainDeviceInfo info,
                                    virQEMUCapsPtr qemuCaps,
                                    const char *devicename);
190

191 192 193
virJSONValuePtr qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
    ATTRIBUTE_NONNULL(1);

194 195 196 197 198 199 200 201 202 203
virJSONValuePtr qemuBuildShmemBackendMemProps(virDomainShmemDefPtr shmem)
    ATTRIBUTE_NONNULL(1);

char *qemuBuildShmemDevStr(virDomainDefPtr def,
                           virDomainShmemDefPtr shmem,
                           virQEMUCapsPtr qemuCaps)
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);



204
#endif /* __QEMU_COMMAND_H__*/