Skip to content

Commit

Permalink
CLOUDSTACK-9428: Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nvazquez committed Aug 5, 2016
1 parent 882bd11 commit e78a69a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions api/src/com/cloud/vm/VmDetailConstants.java
Expand Up @@ -23,4 +23,5 @@ public interface VmDetailConstants {
public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag";
public static final String HYPERVISOR_TOOLS_VERSION = "hypervisortoolsversion";
public static final String DATA_DISK_CONTROLLER = "dataDiskController";
public static final String SVGA_VRAM_SIZE = "svga.vramSize";
}
Expand Up @@ -1947,7 +1947,7 @@ protected StartAnswer execute(StartCommand cmd) {
Arrays.asList(configureVnc(extraOptions.toArray(new OptionValue[0]), hyperHost, vmInternalCSName, vmSpec.getVncPassword(), keyboardLayout)));

// config video card
videoCardMemoryConfig(vmMo, vmSpec, vmConfigSpec);
videoCardConfig(vmMo, vmSpec, vmConfigSpec);

//
// Configure VM
Expand Down Expand Up @@ -2023,10 +2023,9 @@ protected StartAnswer execute(StartCommand cmd) {
* @param vmSpec virtual machine specs
* @param vmConfigSpec virtual machine config spec
*/
protected void videoCardMemoryConfig(VirtualMachineMO vmMo, VirtualMachineTO vmSpec, VirtualMachineConfigSpec vmConfigSpec) {
String paramVRamSize = "svga.vramSize";
if (vmSpec.getDetails().containsKey(paramVRamSize)){
String value = vmSpec.getDetails().get(paramVRamSize);
protected void videoCardConfig(VirtualMachineMO vmMo, VirtualMachineTO vmSpec, VirtualMachineConfigSpec vmConfigSpec) {
if (vmSpec.getDetails().containsKey(VmDetailConstants.SVGA_VRAM_SIZE)){
String value = vmSpec.getDetails().get(VmDetailConstants.SVGA_VRAM_SIZE);
try {
long svgaVmramSize = Long.parseLong(value);
setNewVRamSizeVmVideoCard(vmMo, svgaVmramSize, vmConfigSpec);
Expand Down
Expand Up @@ -140,7 +140,7 @@ public void testStartVm3dgpuEnabled() throws Exception {
specDetails.put("svga.vramSize", String.valueOf(VRAM_MEMORY_SIZE));
when(vmSpec3dgpu.getDetails()).thenReturn(specDetails);

_resource.videoCardMemoryConfig(vmMo3dgpu, vmSpec3dgpu, vmConfigSpec);
_resource.videoCardConfig(vmMo3dgpu, vmSpec3dgpu, vmConfigSpec);
verify(_resource).setNewVRamSizeVmVideoCard(vmMo3dgpu, VRAM_MEMORY_SIZE, vmConfigSpec);
}

Expand Down

0 comments on commit e78a69a

Please sign in to comment.