Skip to content

Commit bb85a56

Browse files
committed
Remove state from vm_template table, we should use template_store_ref
state column to represent the state of a template in each zone.
1 parent c5083a3 commit bb85a56

11 files changed

Lines changed: 109 additions & 280 deletions

File tree

client/tomcatconf/applicationContext.xml.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,6 @@
764764
<bean id="iSCSI" class="org.apache.cloudstack.storage.datastore.type.ISCSI" />
765765
<bean id="ISO" class="org.apache.cloudstack.storage.image.format.ISO" />
766766
<bean id="templateDataFactoryImpl" class="org.apache.cloudstack.storage.image.TemplateDataFactoryImpl" />
767-
<bean id="imageDataManagerImpl" class="org.apache.cloudstack.storage.image.manager.ImageDataManagerImpl" />
768767
<bean id="imageStoreHelper" class="org.apache.cloudstack.storage.image.datastore.ImageStoreHelper" />
769768
<bean id="imageFormatHelper" class="org.apache.cloudstack.storage.image.format.ImageFormatHelper" />
770769
<bean id="templateServiceImpl" class="org.apache.cloudstack.storage.image.TemplateServiceImpl" />

engine/schema/src/com/cloud/storage/VMTemplateVO.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
@Entity
4444
@Table(name = "vm_template")
45-
public class VMTemplateVO implements VirtualMachineTemplate, StateObject<TemplateState> {
45+
public class VMTemplateVO implements VirtualMachineTemplate {
4646
@Id
4747
@TableGenerator(name = "vm_template_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value",
4848
pkColumnValue = "vm_template_seq", allocationSize = 1)
@@ -133,9 +133,6 @@ public class VMTemplateVO implements VirtualMachineTemplate, StateObject<Templat
133133
@Column(name = "size")
134134
private Long size;
135135

136-
@Column(name = "state")
137-
private TemplateState state;
138-
139136
@Column(name = "update_count", updatable = true)
140137
protected long updatedCount;
141138

@@ -157,7 +154,6 @@ public void setUniqueName(String uniqueName) {
157154

158155
public VMTemplateVO() {
159156
this.uuid = UUID.randomUUID().toString();
160-
this.state = TemplateState.Allocated;
161157
}
162158

163159
/**
@@ -171,7 +167,6 @@ public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic,
171167
null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType,
172168
details);
173169
this.uuid = UUID.randomUUID().toString();
174-
this.state = TemplateState.Allocated;
175170
}
176171

177172
public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured,
@@ -182,7 +177,6 @@ public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic,
182177
displayText, enablePassword, guestOSId, bootable, hyperType, details);
183178
this.templateTag = templateTag;
184179
this.uuid = UUID.randomUUID().toString();
185-
this.state = TemplateState.Allocated;
186180
this.enableSshKey = sshKeyEnabled;
187181
}
188182

@@ -192,7 +186,6 @@ public static VMTemplateVO createPreHostIso(Long id, String uniqueName, String n
192186
boolean bootable, HypervisorType hyperType) {
193187
VMTemplateVO template = new VMTemplateVO(id, uniqueName, name, format, isPublic, featured, type, url, created,
194188
requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType);
195-
template.state = TemplateState.Ready;
196189
return template;
197190
}
198191

@@ -219,7 +212,6 @@ public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format,
219212
this.bootable = bootable;
220213
this.hypervisorType = hyperType;
221214
this.uuid = UUID.randomUUID().toString();
222-
this.state = TemplateState.Allocated;
223215
}
224216

225217
// Has an extra attribute - isExtractable
@@ -532,10 +524,6 @@ public Long getSize() {
532524
return this.size;
533525
}
534526

535-
public TemplateState getState() {
536-
return this.state;
537-
}
538-
539527
public long getUpdatedCount() {
540528
return this.updatedCount;
541529
}

engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
/*
3131
* Data Access Object for vm_templates table
3232
*/
33-
public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long>,
34-
StateDao<TemplateState, TemplateEvent, VMTemplateVO> {
33+
public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long> {
3534

3635
public List<VMTemplateVO> listByPublic();
3736

0 commit comments

Comments
 (0)