qemu_command.h 7.8 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
                         virQEMUCapsPtr qemuCaps);
105

106
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk);
107 108

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

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

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

126 127 128 129 130 131 132 133 134 135 136 137
int qemuBuildMemoryBackendStr(unsigned long long size,
                              unsigned long long pagesize,
                              int guestNode,
                              virBitmapPtr userNodeset,
                              virBitmapPtr autoNodeset,
                              virDomainDefPtr def,
                              virQEMUCapsPtr qemuCaps,
                              virQEMUDriverConfigPtr cfg,
                              const char **backendType,
                              virJSONValuePtr *backendProps,
                              bool force);

138
char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem);
139

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

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

155 156 157
int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);

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

162
char *qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev);
J
Ján Tomko 已提交
163

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

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

177 178
int qemuNetworkPrepareDevices(virDomainDefPtr def);

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

int qemuCheckDiskConfig(virDomainDiskDefPtr disk);
184 185 186

bool
qemuCheckFips(void);
187

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

193 194 195
virJSONValuePtr qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
    ATTRIBUTE_NONNULL(1);

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

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



206
#endif /* __QEMU_COMMAND_H__*/