qemu_process.h 8.1 KB
Newer Older
1
/*
2
 * qemu_process.h: QEMU process management
3
 *
4
 * Copyright (C) 2006-2012, 2015 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16
 *
 * 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
17
 * License along with this library.  If not, see
O
Osier Yang 已提交
18
 * <http://www.gnu.org/licenses/>.
19 20 21 22 23 24 25
 *
 */

#ifndef __QEMU_PROCESS_H__
# define __QEMU_PROCESS_H__

# include "qemu_conf.h"
26
# include "qemu_domain.h"
27

28 29
int qemuProcessPrepareMonitorChr(virDomainChrSourceDefPtr monConfig,
                                 const char *domainDir);
30

31
int qemuProcessStartCPUs(virQEMUDriverPtr driver,
J
Jiri Denemark 已提交
32 33
                         virDomainObjPtr vm,
                         virConnectPtr conn,
34
                         virDomainRunningReason reason,
35
                         qemuDomainAsyncJob asyncJob);
36
int qemuProcessStopCPUs(virQEMUDriverPtr driver,
J
Jiri Denemark 已提交
37
                        virDomainObjPtr vm,
38
                        virDomainPausedReason reason,
39
                        qemuDomainAsyncJob asyncJob);
40

41 42
void qemuProcessAutostartAll(virQEMUDriverPtr driver);
void qemuProcessReconnectAll(virConnectPtr conn, virQEMUDriverPtr driver);
43

44 45 46
typedef struct _qemuProcessIncomingDef qemuProcessIncomingDef;
typedef qemuProcessIncomingDef *qemuProcessIncomingDefPtr;
struct _qemuProcessIncomingDef {
47
    char *address; /* address where QEMU is supposed to listen */
48
    char *launchURI; /* used as a parameter for -incoming command line option */
49
    char *deferredURI; /* used when calling migrate-incoming QMP command */
50 51 52 53 54
    int fd; /* for fd:N URI */
    const char *path; /* path associated with fd */
};

qemuProcessIncomingDefPtr qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,
55
                                                    const char *listenAddress,
56 57 58 59 60
                                                    const char *migrateFrom,
                                                    int fd,
                                                    const char *path);
void qemuProcessIncomingDefFree(qemuProcessIncomingDefPtr inc);

61 62 63 64 65
int qemuProcessBeginJob(virQEMUDriverPtr driver,
                        virDomainObjPtr vm);
void qemuProcessEndJob(virQEMUDriverPtr driver,
                       virDomainObjPtr vm);

66 67 68
typedef enum {
    VIR_QEMU_PROCESS_START_COLD         = 1 << 0,
    VIR_QEMU_PROCESS_START_PAUSED       = 1 << 1,
69
    VIR_QEMU_PROCESS_START_AUTODESTROY  = 1 << 2,
70
    VIR_QEMU_PROCESS_START_PRETEND      = 1 << 3,
71 72
} qemuProcessStartFlags;

73
int qemuProcessStart(virConnectPtr conn,
74
                     virQEMUDriverPtr driver,
75
                     virDomainObjPtr vm,
76
                     qemuDomainAsyncJob asyncJob,
77 78 79
                     const char *migrateFrom,
                     int stdin_fd,
                     const char *stdin_path,
80
                     virDomainSnapshotObjPtr snapshot,
81
                     virNetDevVPortProfileOp vmop,
82
                     unsigned int flags);
83

84 85 86 87 88 89 90
virCommandPtr qemuProcessCreatePretendCmd(virConnectPtr conn,
                                          virQEMUDriverPtr driver,
                                          virDomainObjPtr vm,
                                          const char *migrateURI,
                                          bool forceFips,
                                          bool standalone,
                                          unsigned int flags);
91

92 93
int qemuProcessStartValidate(virQEMUDriverPtr driver,
                             virDomainObjPtr vm,
94 95
                             virQEMUCapsPtr qemuCaps,
                             bool migration,
96 97
                             bool snap,
                             unsigned int flags);
98

J
Jiri Denemark 已提交
99 100
int qemuProcessInit(virQEMUDriverPtr driver,
                    virDomainObjPtr vm,
101
                    qemuDomainAsyncJob asyncJob,
102
                    bool migration,
103 104
                    bool snap,
                    unsigned int flags);
J
Jiri Denemark 已提交
105

106 107 108 109 110
int qemuProcessPrepareDomain(virConnectPtr conn,
                             virQEMUDriverPtr driver,
                             virDomainObjPtr vm,
                             unsigned int flags);

111 112 113 114
int qemuProcessPrepareHost(virQEMUDriverPtr driver,
                           virDomainObjPtr vm,
                           bool incoming);

J
Jiri Denemark 已提交
115 116 117 118 119 120 121 122 123
int qemuProcessLaunch(virConnectPtr conn,
                      virQEMUDriverPtr driver,
                      virDomainObjPtr vm,
                      qemuDomainAsyncJob asyncJob,
                      qemuProcessIncomingDefPtr incoming,
                      virDomainSnapshotObjPtr snapshot,
                      virNetDevVPortProfileOp vmop,
                      unsigned int flags);

124 125 126 127 128 129 130
int qemuProcessFinishStartup(virConnectPtr conn,
                             virQEMUDriverPtr driver,
                             virDomainObjPtr vm,
                             qemuDomainAsyncJob asyncJob,
                             bool startCPUs,
                             virDomainPausedReason pausedReason);

131
typedef enum {
132 133
    VIR_QEMU_PROCESS_STOP_MIGRATED      = 1 << 0,
    VIR_QEMU_PROCESS_STOP_NO_RELABEL    = 1 << 1,
134 135
} qemuProcessStopFlags;

136 137 138 139
int qemuProcessBeginStopJob(virQEMUDriverPtr driver,
                            virDomainObjPtr vm,
                            qemuDomainJob job,
                            bool forceKill);
140
void qemuProcessStop(virQEMUDriverPtr driver,
141
                     virDomainObjPtr vm,
142
                     virDomainShutoffReason reason,
143
                     qemuDomainAsyncJob asyncJob,
144
                     unsigned int flags);
145

146
int qemuProcessAttach(virConnectPtr conn,
147
                      virQEMUDriverPtr driver,
148
                      virDomainObjPtr vm,
149
                      pid_t pid,
150 151 152 153
                      const char *pidfile,
                      virDomainChrSourceDefPtr monConfig,
                      bool monJSON);

154 155 156
typedef enum {
   VIR_QEMU_PROCESS_KILL_FORCE  = 1 << 0,
   VIR_QEMU_PROCESS_KILL_NOWAIT = 1 << 1,
157
   VIR_QEMU_PROCESS_KILL_NOCHECK = 1 << 2, /* bypass the running vm check */
158 159
} virQemuProcessKillMode;

160
int qemuProcessKill(virDomainObjPtr vm, unsigned int flags);
161

162 163 164
void qemuProcessShutdownOrReboot(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

165 166 167
int qemuProcessAutoDestroyInit(virQEMUDriverPtr driver);
void qemuProcessAutoDestroyShutdown(virQEMUDriverPtr driver);
int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver,
168 169
                              virDomainObjPtr vm,
                              virConnectPtr conn);
170
int qemuProcessAutoDestroyRemove(virQEMUDriverPtr driver,
171
                                 virDomainObjPtr vm);
172
bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver,
173
                                  virDomainObjPtr vm);
174

175 176 177
int qemuProcessSetSchedParams(int id, pid_t pid, size_t nsp,
                              virDomainThreadSchedParamPtr sp);

178 179 180 181 182
int qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
                                  virQEMUDriverConfigPtr cfg,
                                  virDomainGraphicsDefPtr graphics,
                                  bool allocate);

183 184 185
virDomainDiskDefPtr qemuProcessFindDomainDiskByAlias(virDomainObjPtr vm,
                                                     const char *alias);

186 187
int qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm);

188 189 190

int qemuProcessSetupVcpu(virDomainObjPtr vm,
                         unsigned int vcpuid);
191 192
int qemuProcessSetupIOThread(virDomainObjPtr vm,
                             virDomainIOThreadIDDefPtr iothread);
193

194 195
int qemuRefreshVirtioChannelState(virQEMUDriverPtr driver,
                                  virDomainObjPtr vm);
196 197 198 199

int qemuProcessRefreshBalloonState(virQEMUDriverPtr driver,
                                   virDomainObjPtr vm,
                                   int asyncJob);
200
#endif /* __QEMU_PROCESS_H__ */