This repository has been archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 258
/
eucalyptus.h
245 lines (206 loc) · 9.19 KB
/
eucalyptus.h
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/*
Copyright (c) 2009 Eucalyptus Systems, Inc.
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, only version 3 of the License.
This file 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, see <http://www.gnu.org/licenses/>.
Please contact Eucalyptus Systems, Inc., 130 Castilian
Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/>
if you need additional information or have any questions.
This file may incorporate work covered under the following copyright and
permission notice:
Software License Agreement (BSD License)
Copyright (c) 2008, Regents of the University of California
Redistribution and use of this software in source and binary forms, with
or without modification, are permitted provided that the following
conditions are met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USERS OF
THIS SOFTWARE ACKNOWLEDGE THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE
LICENSED MATERIAL, COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS
SOFTWARE, AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA, SANTA
BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY, WHICH IN
THE REGENTS' DISCRETION MAY INCLUDE, WITHOUT LIMITATION, REPLACEMENT
OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO IDENTIFIED, OR
WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT NEEDED TO COMPLY WITH
ANY SUCH LICENSES OR RIGHTS.
*/
#ifndef INCLUDE_EUCALYPTUS_H
#define INCLUDE_EUCALYPTUS_H
/* environment variable set at startup */
#define EUCALYPTUS_ENV_VAR_NAME "EUCALYPTUS"
/* file paths relative to $EUCALYPTUS */
#define EUCALYPTUS_CONF_LOCATION "%s/etc/eucalyptus/eucalyptus.conf"
#define EUCALYPTUS_CONF_OVERRIDE_LOCATION "%s/etc/eucalyptus/eucalyptus.local.conf"
#define EUCALYPTUS_LIBVIRT_XSLT "%s/etc/eucalyptus/libvirt.xsl"
#define EUCALYPTUS_VOLUME_XML_PATH_FORMAT "%s/%s.xml"
#define EUCALYPTUS_ROOTWRAP "%s/usr/lib/eucalyptus/euca_rootwrap"
#define EUCALYPTUS_ADD_KEY "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/add_key.pl %s/usr/lib/eucalyptus/euca_mountwrap"
#define EUCALYPTUS_GEN_LIBVIRT_XML "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/gen_libvirt_xml"
#define EUCALYPTUS_GEN_KVM_LIBVIRT_XML "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/gen_kvm_libvirt_xml"
#define EUCALYPTUS_GET_XEN_INFO "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/get_xen_info"
#define EUCALYPTUS_GET_KVM_INFO "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/get_sys_info"
#define EUCALYPTUS_DISK_CONVERT "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/partition2disk"
#define EUCALYPTUS_VIRSH "%s/usr/lib/eucalyptus/euca_rootwrap virsh"
#define EUCALYPTUS_ROOTWRAP "%s/usr/lib/eucalyptus/euca_rootwrap"
#define EUCALYPTUS_DETACH "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/detach.pl"
#define EUCALYPTUS_XM "sudo xm"
#define EUCALYPTUS_CONNECT_ISCSI "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/connect_iscsitarget.pl"
#define EUCALYPTUS_DISCONNECT_ISCSI "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/disconnect_iscsitarget.pl"
#define EUCALYPTUS_GET_ISCSI "%s/usr/lib/eucalyptus/euca_rootwrap %s/usr/share/eucalyptus/get_iscsitarget.pl"
#define EUCALYPTUS_NC_CHECK_BUCKET "euca-check-bucket" // can be overriden from eucalyptus.conf
#define EUCALYPTUS_NC_BUNDLE_UPLOAD "euca-bundle-upload" // can be overriden from eucalyptus.conf
#define EUCALYPTUS_NC_DELETE_BUNDLE "euca-delete-bundle" // can be overriden from eucalyptus.conf
#define EUCALYPTUS_NC_HOOKS_DIR "%s/etc/eucalyptus/nc-hooks"
#define NC_NET_PATH_DEFAULT "%s/var/run/eucalyptus/net"
#define CC_NET_PATH_DEFAULT "%s/var/run/eucalyptus/net"
/* various defaults */
#define NC_NET_PORT_DEFAULT 1976
#define CC_NET_PORT_DEFAULT 1976
/* names of variables in the configuration file */
#define CONFIG_MAX_MEM "MAX_MEM"
#define CONFIG_MAX_DISK "MAX_DISK"
#define CONFIG_MAX_CORES "MAX_CORES"
#define REGISTERED_PATH "REGISTERED_PATH"
#define INSTANCE_PATH "INSTANCE_PATH"
#define CONFIG_VNET_PORT "VNET_PORT"
#define CONFIG_VNET_DHCPDAEMON "VNET_DHCPDAEMON"
#define CONFIG_VNET_PRIVINTERFACE "VNET_PRIVINTERFACE"
#define CONFIG_NC_SERVICE "NC_SERVICE"
#define CONFIG_NC_PORT "NC_PORT"
#define CONFIG_NODES "NODES"
#define CONFIG_HYPERVISOR "HYPERVISOR"
#define CONFIG_NC_CACHE_SIZE "NC_CACHE_SIZE"
#define CONFIG_NC_WORK_SIZE "NC_WORK_SIZE"
#define CONFIG_NC_SWAP_SIZE "SWAP_SIZE"
#define CONFIG_SAVE_INSTANCES "MANUAL_INSTANCES_CLEANUP"
#define CONFIG_DISABLE_KEY_INJECTION "DISABLE_KEY_INJECTION"
#define CONFIG_CONCURRENT_DISK_OPS "CONCURRENT_DISK_OPS"
#define CONFIG_USE_VIRTIO_NET "USE_VIRTIO_NET"
#define CONFIG_USE_VIRTIO_DISK "USE_VIRTIO_DISK"
#define CONFIG_USE_VIRTIO_ROOT "USE_VIRTIO_ROOT"
#define CONFIG_NC_BUNDLE_UPLOAD "NC_BUNDLE_UPLOAD_PATH"
#define CONFIG_NC_CHECK_BUCKET "NC_CHECK_BUCKET_PATH"
#define CONFIG_NC_DELETE_BUNDLE "NC_DELETE_BUNDLE_PATH"
/* name of the administrative user within Eucalyptus */
#define EUCALYPTUS_ADMIN "eucalyptus"
/* system limit defaults */
#define MAXNODES 1024
#define MAXINSTANCES 2048
#define MAXLOGFILESIZE 32768000
#define EUCA_MAX_GROUPS 64
#define EUCA_MAX_VOLUMES 64
#define EUCA_MAX_VBRS 64
#define EUCA_MAX_PATH 4096
#define EUCA_MAX_PARTITIONS 32 // partitions per disk
#define EUCA_MAX_DISKS 26 // disks per bus: sd[a-z]
#define MAX_PATH_SIZE 4096 // TODO: remove
// NC hook events
#define NC_EVENT_PRE_INIT "euca-nc-pre-init" // p1: eucalyptusHome
#define NC_EVENT_POST_INIT "euca-nc-post-init" // p1: eucalyptusHome
#define NC_EVENT_PRE_BOOT "euca-nc-pre-boot" // p1: instancePath
#define NC_EVENT_ADOPTING "euca-nc-pre-adopt" // p1: instancePath
#define NC_EVENT_PRE_CLEAN "euca-nc-pre-clean" // p1: instancePath
#define NC_EVENT_PRE_ATTACH "euca-nc-pre-attach" // p1: volumeXmlPath
#define NC_EVENT_POST_DETACH "euca-nc-post-detach" // p1: volumeXmlPath
#define MEGABYTE 1048576
// return codes
#define OK 0
#define ERROR 1
#define ERROR_FATAL 1
#define ERROR_RETRY -1
#define READER 2
#define WRITER 3
typedef enum instance_states_t { // these must match instance_sate_names[] below!
/* the first 7 should match libvirt */
NO_STATE = 0,
RUNNING,
BLOCKED,
PAUSED,
SHUTDOWN,
SHUTOFF,
CRASHED,
/* start-time states */
STAGING,
BOOTING,
CANCELED,
/* state after running */
BUNDLING_SHUTDOWN,
BUNDLING_SHUTOFF,
/* createImage states */
CREATEIMAGE_SHUTDOWN,
CREATEIMAGE_SHUTOFF,
/* the only three states reported to CLC */
PENDING, /* staging in data, starting to boot, failed to boot */
EXTANT, /* guest OS booting, running, shutting down, cleaning up state */
TEARDOWN, /* a marker for a terminated domain, one not taking up resources */
TOTAL_STATES
} instance_states;
static char * instance_state_names[] = {
"Unknown",
"Running",
"Waiting",
"Paused",
"Shutdown",
"Shutoff",
"Crashed",
"Staging",
"Booting",
"Canceled",
"Bundling-Shutdown",
"Bundling-Shutoff",
"CreateImage-Shutdown",
"CreateImage-Shutoff",
"Pending",
"Extant",
"Teardown"
};
typedef enum bundling_progress_t {
NOT_BUNDLING = 0,
BUNDLING_IN_PROGRESS,
BUNDLING_SUCCESS,
BUNDLING_FAILED,
BUNDLING_CANCELLED
} bundling_progress;
static char * bundling_progress_names[] = {
"none",
"bundling",
"succeeded",
"failed",
"cancelled"
};
typedef enum createImage_progress_t {
NOT_CREATEIMAGE = 0,
CREATEIMAGE_IN_PROGRESS,
CREATEIMAGE_SUCCESS,
CREATEIMAGE_FAILED,
CREATEIMAGE_CANCELLED
} createImage_progress;
static char * createImage_progress_names[] = {
"none",
"creating",
"succeeded",
"failed",
"cancelled"
};
#endif