qemu_process.h 4.5 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
int qemuProcessPrepareMonitorChr(virQEMUDriverConfigPtr cfg,
29 30 31
                                 virDomainChrSourceDefPtr monConfig,
                                 const char *vm);

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

42 43
void qemuProcessAutostartAll(virQEMUDriverPtr driver);
void qemuProcessReconnectAll(virConnectPtr conn, virQEMUDriverPtr driver);
44 45 46

int qemuProcessAssignPCIAddresses(virDomainDefPtr def);

47 48 49
typedef enum {
    VIR_QEMU_PROCESS_START_COLD         = 1 << 0,
    VIR_QEMU_PROCESS_START_PAUSED       = 1 << 1,
50
    VIR_QEMU_PROCESS_START_AUTODESTROY  = 1 << 2,
51 52
} qemuProcessStartFlags;

53
int qemuProcessStart(virConnectPtr conn,
54
                     virQEMUDriverPtr driver,
55
                     virDomainObjPtr vm,
56
                     int asyncJob,
57 58 59
                     const char *migrateFrom,
                     int stdin_fd,
                     const char *stdin_path,
60
                     virDomainSnapshotObjPtr snapshot,
61
                     virNetDevVPortProfileOp vmop,
62
                     unsigned int flags);
63

64
typedef enum {
65 66
    VIR_QEMU_PROCESS_STOP_MIGRATED      = 1 << 0,
    VIR_QEMU_PROCESS_STOP_NO_RELABEL    = 1 << 1,
67 68
} qemuProcessStopFlags;

69
void qemuProcessStop(virQEMUDriverPtr driver,
70
                     virDomainObjPtr vm,
71 72
                     virDomainShutoffReason reason,
                     unsigned int flags);
73

74
int qemuProcessAttach(virConnectPtr conn,
75
                      virQEMUDriverPtr driver,
76
                      virDomainObjPtr vm,
77
                      pid_t pid,
78 79 80 81
                      const char *pidfile,
                      virDomainChrSourceDefPtr monConfig,
                      bool monJSON);

82 83 84
typedef enum {
   VIR_QEMU_PROCESS_KILL_FORCE  = 1 << 0,
   VIR_QEMU_PROCESS_KILL_NOWAIT = 1 << 1,
85
   VIR_QEMU_PROCESS_KILL_NOCHECK = 1 << 2, /* bypass the running vm check */
86 87
} virQemuProcessKillMode;

88
int qemuProcessKill(virDomainObjPtr vm, unsigned int flags);
89

90 91 92
void qemuProcessShutdownOrReboot(virQEMUDriverPtr driver,
                                 virDomainObjPtr vm);

93 94 95
int qemuProcessAutoDestroyInit(virQEMUDriverPtr driver);
void qemuProcessAutoDestroyShutdown(virQEMUDriverPtr driver);
int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver,
96 97
                              virDomainObjPtr vm,
                              virConnectPtr conn);
98
int qemuProcessAutoDestroyRemove(virQEMUDriverPtr driver,
99
                                 virDomainObjPtr vm);
100
bool qemuProcessAutoDestroyActive(virQEMUDriverPtr driver,
101
                                  virDomainObjPtr vm);
102
virBitmapPtr qemuPrepareCpumap(virQEMUDriverPtr driver,
103
                               virBitmapPtr nodemask);
104

105 106
int qemuProcessReadLog(int fd, char *buf, int buflen, int off, bool skipchar);

107 108 109
int qemuProcessSetSchedParams(int id, pid_t pid, size_t nsp,
                              virDomainThreadSchedParamPtr sp);

110 111 112 113 114
int qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
                                  virQEMUDriverConfigPtr cfg,
                                  virDomainGraphicsDefPtr graphics,
                                  bool allocate);

115 116 117
virDomainDiskDefPtr qemuProcessFindDomainDiskByAlias(virDomainObjPtr vm,
                                                     const char *alias);

118
#endif /* __QEMU_PROCESS_H__ */