File: res.h

package info (click to toggle)
vzctl 3.0.22-14
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,340 kB
  • ctags: 4,462
  • sloc: ansic: 15,696; sh: 11,712; makefile: 460
file content (145 lines) | stat: -rw-r--r-- 3,579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
 *  Copyright (C) 2000-2007 SWsoft. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
#ifndef	_RES_H_
#define _RES_H_

#include "types.h"
#include "net.h"
#include "cpu.h"
#include "dev.h"
#include "ub.h"
#include "cap.h"
#include "quota.h"
#include "fs.h"
#include "dist.h"
#include "cpt.h"
#include "meminfo.h"
#include "veth.h"

typedef struct {
	envid_t veid;
	unsigned long ipt_mask;

	/*
	 * features_known is the set of features that are present
	 * in config file. this make vzctl work with new kernel
	 * that supports features vzctl still doesn't know yet.
	 * features that kernel support and that are not present
	 * in this mask kernel sets to default values.
	 */
	unsigned long long features_mask;
	unsigned long long features_known;
} env_param;

typedef struct {
	list_head_t userpw;
	list_head_t nameserver;
	list_head_t searchdomain;
	char *hostname;
	int wait;
} misc_param;

struct mod_action;

typedef struct {
	int ioprio;
} io_param;

typedef struct name_param {
	int veid;
	char *name;
} name_param;

/** Data structure for VE resources.
 */
typedef struct vps_res {
	fs_param fs;		/**< file system parameters. */
	tmpl_param tmpl;	/**< template parameters. */
	env_param env;		/**< environment parameters. */
	net_param net;		/**< network parameters. */
	cpu_param cpu;		/**< cpu parameters. */
	dev_param dev;		/**< device parameters. */
	ub_param ub;		/**< UBC aprameters. */
	cap_param cap;		/**< capability parameters. */
	dq_param dq;		/**< disk quota parameters. */
	cpt_param cpt;		/**< chekpointing parameters */
	meminfo_param meminfo;
	veth_param veth;	/**< veth parameters */
	misc_param misc;
	name_param name;
	io_param io;
} vps_res;

enum {
	APPCONF_MAP_NAME = 0x01,
};

typedef struct {
	int save;
	int fast_kill;
	int skip_lock;
	int skip_setup;
	int start_disabled;
	int start_force;
	int setmode;
	int onboot;
	char *config;
	char *origin_sample;
	char *lockdir;
	char *apply_cfg;
	int apply_cfg_map;
	int reset_ub;
} vps_opt;

struct log_s {
	char *log_file;
	int level;
	int enable;
	int *verbose;
};

struct vps_param {
	struct log_s log;
	vps_res res;
	vps_res del_res;
	vps_opt opt;
	struct mod_action *mod;
	struct vps_param *g_param;
};
typedef struct vps_param vps_param;

/** Setting VE resources.
 *
 * @param h		VE handler.
 * @param veid		VE id.
 * @param actions	distribution action scripts.
 * @param fs		VE FS parameters
 * @param param		VE parameters.
 * @param vps_state	VE state.
 * @param action	external modules.
 * @return		0 on success.
 */
int vps_setup_res(vps_handler *h, envid_t veid, dist_actions *actions,
	fs_param *fs, vps_param *param, int vps_state, skipFlags skip,
	struct mod_action *action);
int vps_cleanup_res(vps_handler *h, envid_t veid, vps_param *param,
	int vps_state);
int setup_resource_management(vps_handler *h, envid_t veid, vps_res *res);
int need_configure(vps_res *res);

#endif