qemu_command.h 7.0 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
/* Generate the object properties for a secret */
int qemuBuildSecretInfoProps(qemuDomainSecretInfoPtr secinfo,
                             virJSONValuePtr *propsret);

67 68 69
/* Generate '-device' string for chardev device */
int
qemuBuildChrDeviceStr(char **deviceStr,
70
                      const virDomainDef *vmdef,
71 72
                      virDomainChrDefPtr chr,
                      virQEMUCapsPtr qemuCaps);
73

74
/* With vlan == -1, use netdev syntax, else old hostnet */
75 76 77 78 79
char *qemuBuildHostNetStr(virDomainNetDefPtr net,
                          virQEMUDriverPtr driver,
                          char type_sep,
                          int vlan,
                          char **tapfd,
80
                          size_t tapfdSize,
81
                          char **vhostfd,
82
                          size_t vhostfdSize);
83 84

/* Legacy, pre device support */
85 86 87
char *qemuBuildNicStr(virDomainNetDefPtr net,
                      const char *prefix,
                      int vlan);
88 89

/* Current, best practice */
90 91 92
char *qemuBuildNicDevStr(virDomainDefPtr def,
                         virDomainNetDefPtr net,
                         int vlan,
93
                         unsigned int bootindex,
94
                         size_t vhostfdSize,
95
                         virQEMUCapsPtr qemuCaps);
96

97
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk);
98 99

/* Both legacy & current support */
100
char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
101
                        bool bootable,
102
                        virQEMUCapsPtr qemuCaps);
103 104

/* Current, best practice */
105
char *qemuBuildDriveDevStr(const virDomainDef *def,
106
                           virDomainDiskDefPtr disk,
107
                           unsigned int bootindex,
108
                           virQEMUCapsPtr qemuCaps);
109

110
/* Current, best practice */
111
char *qemuBuildControllerDevStr(const virDomainDef *domainDef,
112 113 114
                                virDomainControllerDefPtr def,
                                virQEMUCapsPtr qemuCaps,
                                int *nusbcontroller);
115

116 117 118 119 120 121 122 123 124 125 126 127
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);

128
char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem);
129

130
/* Current, best practice */
131
char *qemuBuildPCIHostdevDevStr(const virDomainDef *def,
132
                                virDomainHostdevDefPtr dev,
133
                                unsigned int bootIndex,
134 135
                                const char *configfd,
                                virQEMUCapsPtr qemuCaps);
136

137
char *qemuBuildRNGDevStr(const virDomainDef *def,
138 139
                         virDomainRNGDefPtr dev,
                         virQEMUCapsPtr qemuCaps);
140 141 142 143
int qemuBuildRNGBackendProps(virDomainRNGDefPtr rng,
                             virQEMUCapsPtr qemuCaps,
                             const char **type,
                             virJSONValuePtr *props);
144

145 146 147 148
char *qemuBuildShmemDevStr(virDomainDefPtr def,
                           virDomainShmemDefPtr shmem,
                           virQEMUCapsPtr qemuCaps);

149 150 151
int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);

/* Current, best practice */
152
char *qemuBuildUSBHostdevDevStr(const virDomainDef *def,
153 154 155
                                virDomainHostdevDefPtr dev,
                                virQEMUCapsPtr qemuCaps);

156
char *qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev);
J
Ján Tomko 已提交
157

158
char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
159
                                 virDomainHostdevDefPtr dev,
160
                                 virQEMUCapsPtr qemuCaps);
161

162
char *qemuBuildRedirdevDevStr(const virDomainDef *def,
163 164
                              virDomainRedirdevDefPtr dev,
                              virQEMUCapsPtr qemuCaps);
165

166 167
int qemuNetworkPrepareDevices(virDomainDefPtr def);

168
int qemuGetDriveSourceString(virStorageSourcePtr src,
169
                             qemuDomainSecretInfoPtr secinfo,
170
                             char **source);
171 172

int qemuCheckDiskConfig(virDomainDiskDefPtr disk);
173 174 175

bool
qemuCheckFips(void);
176

177
bool qemuCheckCCWS390AddressSupport(const virDomainDef *def,
178 179 180
                                    virDomainDeviceInfo info,
                                    virQEMUCapsPtr qemuCaps,
                                    const char *devicename);
181

182 183 184
virJSONValuePtr qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
    ATTRIBUTE_NONNULL(1);

185
#endif /* __QEMU_COMMAND_H__*/