qemu_process.h 3.9 KB
Newer Older
1
/*
2
 * qemu_process.h: QEMU process management
3
 *
4
 * Copyright (C) 2006-2012 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 56 57 58
                     virDomainObjPtr vm,
                     const char *migrateFrom,
                     int stdin_fd,
                     const char *stdin_path,
59
                     virDomainSnapshotObjPtr snapshot,
60
                     virNetDevVPortProfileOp vmop,
61
                     unsigned int flags);
62

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

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

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

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

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

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

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

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

106
#endif /* __QEMU_PROCESS_H__ */