forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathVirtualMachineTemplate.java
More file actions
158 lines (113 loc) · 4.9 KB
/
VirtualMachineTemplate.java
File metadata and controls
158 lines (113 loc) · 4.9 KB
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
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.template;
import java.util.Date;
import java.util.Map;
import com.cloud.cpu.CPU;
import com.cloud.user.UserData;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachineTemplate.State> {
int MAXIMUM_TEMPLATE_NAME_LENGTH = 255;
enum State {
Active,
Inactive,
NotUploaded,
UploadInProgress,
UploadError,
UploadAbandoned;
public static StateMachine2<State, Event, VirtualMachineTemplate> getStateMachine() {
return s_fsm;
}
private final static StateMachine2<State, Event, VirtualMachineTemplate> s_fsm = new StateMachine2<State, Event, VirtualMachineTemplate>();
static {
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(NotUploaded, Event.OperationTimeout, UploadAbandoned, null));
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(NotUploaded, Event.UploadRequested, UploadInProgress, null));
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(NotUploaded, Event.OperationSucceeded, Active, null));
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(NotUploaded, Event.OperationFailed, UploadError, null));
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(UploadInProgress, Event.OperationSucceeded, Active, null));
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(UploadInProgress, Event.OperationFailed, UploadError, null));
s_fsm.addTransition(new StateMachine2.Transition<State, Event>(UploadInProgress, Event.OperationTimeout, UploadError, null));
}
}
enum Event {
OperationFailed,
OperationSucceeded,
UploadRequested,
OperationTimeout;
}
public static enum BootloaderType {
PyGrub, HVM, External, CD
};
public enum TemplateFilter {
featured, // returns templates that have been marked as featured and public
self, // returns templates that have been registered or created by the calling user
selfexecutable, // same as self, but only returns templates that are ready to be deployed with
shared, // including templates that have been granted to the calling user by another user
sharedexecutable, // ready templates that have been granted to the calling user by another user
executable, // templates that are owned by the calling user, or public templates, that can be used to deploy a
community, // returns templates that have been marked as public but not featured
all // all templates (only usable by admins)
}
@Override
State getState();
boolean isFeatured();
/**
* @return public or private template
*/
boolean isPublicTemplate();
boolean isExtractable();
/**
* @return name
*/
String getName();
ImageFormat getFormat();
boolean isRequiresHvm();
String getDisplayText();
boolean isEnablePassword();
boolean isEnableSshKey();
boolean isCrossZones();
Date getCreated();
long getGuestOSId();
boolean isBootable();
TemplateType getTemplateType();
HypervisorType getHypervisorType();
int getBits();
String getUniqueName();
String getUrl();
String getChecksum();
Long getSourceTemplateId();
String getTemplateTag();
Map getDetails();
boolean isDynamicallyScalable();
Long getParentTemplateId();
long getUpdatedCount();
void incrUpdatedCount();
Date getUpdated();
boolean isDeployAsIs();
boolean isForCks();
Long getUserDataId();
UserData.UserDataOverridePolicy getUserDataOverridePolicy();
CPU.CPUArch getArch();
Long getExtensionId();
}