Skip to content

Commit 3419c81

Browse files
amoghvnitinmeh
authored andcommitted
CLOUDSTACK-6437:
Add ability to distinguish between user defined and system defined guest OS and mappings Add default mappings for XenServer Local testing with 1. Add new guest OS by API 2. Add new guest OS mapping by API
1 parent 4c0505f commit 3419c81

6 files changed

Lines changed: 904 additions & 1 deletion

File tree

‎api/src/com/cloud/storage/GuestOS.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ public interface GuestOS extends InternalIdentity, Identity {
3232
Date getCreated();
3333

3434
Date getRemoved();
35+
36+
boolean getIsUserDefined();
3537
}

‎api/src/com/cloud/storage/GuestOSHypervisor.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ public interface GuestOSHypervisor extends InternalIdentity {
3535
Date getRemoved();
3636

3737
Date getCreated();
38+
39+
boolean getIsUserDefined();
3840
}

‎engine/schema/src/com/cloud/storage/GuestOSHypervisorVO.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public class GuestOSHypervisorVO implements GuestOSHypervisor {
5757
@Column(name = GenericDao.CREATED_COLUMN)
5858
Date created;
5959

60+
@Column(name = "is_user_defined")
61+
private boolean isUserDefined;
62+
6063
@Override
6164
public long getId() {
6265
return id;
@@ -120,4 +123,13 @@ public void setUuid(String uuid) {
120123
public void setRemoved(Date removed) {
121124
this.removed = removed;
122125
}
126+
127+
@Override
128+
public boolean getIsUserDefined() {
129+
return isUserDefined;
130+
}
131+
132+
public void setIsUserDefined(boolean isUserDefined) {
133+
this.isUserDefined = isUserDefined;
134+
}
123135
}

‎engine/schema/src/com/cloud/storage/GuestOSVO.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public class GuestOSVO implements GuestOS {
5454
@Column(name = GenericDao.CREATED_COLUMN)
5555
private Date created;
5656

57+
@Column(name = "is_user_defined")
58+
private boolean isUserDefined;
59+
5760
@Override
5861
public long getId() {
5962
return id;
@@ -108,4 +111,13 @@ public void setRemoved(Date removed) {
108111
public Date getRemoved() {
109112
return removed;
110113
}
114+
115+
@Override
116+
public boolean getIsUserDefined() {
117+
return isUserDefined;
118+
}
119+
120+
public void setIsUserDefined(boolean isUserDefined) {
121+
this.isUserDefined = isUserDefined;
122+
}
111123
}

‎server/src/com/cloud/server/ManagementServerImpl.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,7 @@ else if (osStdName != null) {
20302030
throw new InvalidParameterValueException("Unable to find the guest OS by name or UUID");
20312031
}
20322032
//check for duplicates
2033-
GuestOSHypervisorVO duplicate = _guestOSHypervisorDao.findByOsIdAndHypervisor(osTypeId.longValue(), hypervisorType.toString(), hypervisorVersion);
2033+
GuestOSHypervisorVO duplicate = _guestOSHypervisorDao.findByOsIdAndHypervisor(guestOs.getId(), hypervisorType.toString(), hypervisorVersion);
20342034

20352035
if (duplicate != null) {
20362036
throw new InvalidParameterValueException("Mapping from hypervisor : " + hypervisorType.toString() + ", version : " + hypervisorVersion + " and guest OS : "
@@ -2041,6 +2041,7 @@ else if (osStdName != null) {
20412041
guestOsMapping.setGuestOsName(osNameForHypervisor);
20422042
guestOsMapping.setHypervisorType(hypervisorType.toString());
20432043
guestOsMapping.setHypervisorVersion(hypervisorVersion);
2044+
guestOsMapping.setIsUserDefined(true);
20442045
return _guestOSHypervisorDao.persist(guestOsMapping);
20452046

20462047
}
@@ -2073,6 +2074,7 @@ public GuestOS addGuestOs(AddGuestOsCmd cmd) {
20732074
guestOsVo.setCategoryId(categoryId.longValue());
20742075
guestOsVo.setDisplayName(displayName);
20752076
guestOsVo.setName(name);
2077+
guestOsVo.setIsUserDefined(true);
20762078
return _guestOSDao.persist(guestOsVo);
20772079
}
20782080

0 commit comments

Comments
 (0)