Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions api/src/com/cloud/agent/api/to/VirtualMachineTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.util.List;
import java.util.Map;
import java.util.HashMap;

import com.cloud.template.VirtualMachineTemplate.BootloaderType;
import com.cloud.vm.VirtualMachine;
Expand Down Expand Up @@ -69,6 +70,7 @@ public class VirtualMachineTO {
String configDriveIsoRootFolder = null;
String configDriveIsoFile = null;

Map<String, String> guestOsDetails = new HashMap<String, String>();

public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
Expand Down Expand Up @@ -331,4 +333,11 @@ public void setConfigDriveIsoFile(String configDriveIsoFile) {
this.configDriveIsoFile = configDriveIsoFile;
}

public Map<String, String> getGuestOsDetails() {
return guestOsDetails;
}

public void setGuestOsDetails(Map<String, String> guestOsDetails) {
this.guestOsDetails = guestOsDetails;
}
}
3 changes: 2 additions & 1 deletion api/src/com/cloud/server/ResourceTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public enum ResourceObjectType {
AutoScaleVmGroup(false, true),
LBStickinessPolicy(false, true),
LBHealthCheckPolicy(false, true),
SnapshotPolicy(false, true);
SnapshotPolicy(false, true),
GuestOs(false, true);


ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
import com.cloud.storage.GuestOS;
import com.cloud.user.Account;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

@APICommand(name = "addGuestOs", description = "Add a new guest OS type", responseObject = GuestOSResponse.class,
since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AddGuestOsCmd extends BaseAsyncCreateCmd {
Expand All @@ -53,8 +58,11 @@ public class AddGuestOsCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = false, description = "Optional name for Guest OS")
private String osName;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, required = true, description = "Map of (key/value pairs)")
private Map details;


/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////

Expand All @@ -70,6 +78,22 @@ public String getOsName() {
return osName;
}

public Map getDetails() {
Map<String, String> detailsMap = new HashMap<String, String>();
if (!details.isEmpty()) {
Collection<?> servicesCollection = details.values();
Iterator<?> iter = servicesCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> services = (HashMap<String, String>)iter.next();
String key = services.get("key");
String value = services.get("value");
detailsMap.put(key, value);
}
}
return detailsMap;
}


/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
import com.cloud.storage.GuestOS;
import com.cloud.user.Account;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

@APICommand(name = "updateGuestOs", description = "Updates the information about Guest OS", responseObject = GuestOSResponse.class,
since = "4.4.0", requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class UpdateGuestOsCmd extends BaseAsyncCmd {
Expand All @@ -49,6 +54,10 @@ public class UpdateGuestOsCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.OS_DISPLAY_NAME, type = CommandType.STRING, required = true, description = "Unique display name for Guest OS")
private String osDisplayName;

@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, required = true, description = "Map of (key/value pairs)")
private Map details;


/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand All @@ -61,6 +70,21 @@ public String getOsDisplayName() {
return osDisplayName;
}

public Map getDetails() {
Map<String, String> detailsMap = new HashMap<String, String>();;
if (!details.isEmpty()) {
Collection<?> servicesCollection = details.values();
Iterator<?> iter = servicesCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> services = (HashMap<String, String>)iter.next();
String key = services.get("key");
String value = services.get("value");
detailsMap.put(key, value);
}
}
return detailsMap;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,5 +349,5 @@
<bean id="LBStickinessPolicyDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.LBStickinessPolicyDetailsDaoImpl" />
<bean id="LBHealthCheckPolicyDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.LBHealthCheckPolicyDetailsDaoImpl" />
<bean id="outOfBandManagementDaoImpl" class="org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDaoImpl" />

<bean id="GuestOsDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.GuestOsDetailsDaoImpl" />
</beans>
Loading