qemu_command.h 7.6 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 42

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

# define QEMU_DRIVE_HOST_PREFIX "drive-"
# define QEMU_FSDEV_HOST_PREFIX "fsdev-"

43
VIR_ENUM_DECL(qemuVideo)
44

45 46 47 48
char *qemuBuildObjectCommandlineFromJSON(const char *type,
                                         const char *alias,
                                         virJSONValuePtr props);

49
virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
50
                                   virQEMUDriverPtr driver,
51
                                   virLogManagerPtr logManager,
52
                                   virDomainDefPtr def,
53
                                   virDomainChrSourceDefPtr monitor_chr,
54
                                   bool monitor_json,
55
                                   virQEMUCapsPtr qemuCaps,
56
                                   const char *migrateURI,
57
                                   virDomainSnapshotObjPtr snapshot,
58
                                   virNetDevVPortProfileOp vmop,
59
                                   bool standalone,
60
                                   bool enableFips,
61 62
                                   virBitmapPtr nodeset,
                                   size_t *nnicindexes,
63 64 65
                                   int **nicindexes,
                                   const char *domainLibDir,
                                   const char *domainChannelTargetDir)
66 67
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(11)
    ATTRIBUTE_NONNULL(17) ATTRIBUTE_NONNULL(18);
68

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

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

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

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

char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
100
                               virQEMUCapsPtr qemuCaps);
101 102

/* Both legacy & current support */
103 104
char *qemuBuildDriveStr(virConnectPtr conn,
                        virDomainDiskDefPtr disk,
105
                        bool bootable,
106
                        virQEMUCapsPtr qemuCaps);
107 108

/* Current, best practice */
109
char *qemuBuildDriveDevStr(const virDomainDef *def,
110
                           virDomainDiskDefPtr disk,
111
                           unsigned int bootindex,
112
                           virQEMUCapsPtr qemuCaps);
113

114
/* Current, best practice */
115
char *qemuBuildControllerDevStr(const virDomainDef *domainDef,
116 117 118
                                virDomainControllerDefPtr def,
                                virQEMUCapsPtr qemuCaps,
                                int *nusbcontroller);
119

120 121 122 123 124 125 126 127 128 129 130 131
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);

132
char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem);
133

134
/* Current, best practice */
135
char *qemuBuildPCIHostdevDevStr(const virDomainDef *def,
136
                                virDomainHostdevDefPtr dev,
137
                                unsigned int bootIndex,
138 139
                                const char *configfd,
                                virQEMUCapsPtr qemuCaps);
140

141
char *qemuBuildRNGDevStr(const virDomainDef *def,
142 143
                         virDomainRNGDefPtr dev,
                         virQEMUCapsPtr qemuCaps);
144 145 146 147
int qemuBuildRNGBackendProps(virDomainRNGDefPtr rng,
                             virQEMUCapsPtr qemuCaps,
                             const char **type,
                             virJSONValuePtr *props);
148

149 150 151
char *qemuBuildShmemDevStr(virDomainDefPtr def,
                           virDomainShmemDefPtr shmem,
                           virQEMUCapsPtr qemuCaps);
152 153 154 155
char *qemuBuildShmemBackendStr(virLogManagerPtr logManager,
                               virCommandPtr cmd,
                               virDomainDefPtr def,
                               virDomainShmemDefPtr shmem,
156 157 158
                               virQEMUCapsPtr qemuCaps);


159 160 161
int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);

/* Current, best practice */
162
char *qemuBuildUSBHostdevDevStr(const virDomainDef *def,
163 164 165 166 167
                                virDomainHostdevDefPtr dev,
                                virQEMUCapsPtr qemuCaps);

char *qemuBuildSCSIHostdevDrvStr(virConnectPtr conn,
                                 virDomainHostdevDefPtr dev,
J
Ján Tomko 已提交
168 169
                                 virQEMUCapsPtr qemuCaps);

170
char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def,
171
                                 virDomainHostdevDefPtr dev,
172
                                 virQEMUCapsPtr qemuCaps);
173

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

178 179
int qemuNetworkPrepareDevices(virDomainDefPtr def);

180 181 182
int qemuGetDriveSourceString(virStorageSourcePtr src,
                             virConnectPtr conn,
                             char **source);
183 184

int qemuCheckDiskConfig(virDomainDiskDefPtr disk);
185 186 187

bool
qemuCheckFips(void);
188

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

194
#endif /* __QEMU_COMMAND_H__*/