Github user serg38 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1605#discussion_r75796954
  
    --- Diff: 
plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
 ---
    @@ -2042,49 +2043,46 @@ protected void 
postVideoCardMemoryConfigBeforeStart(VirtualMachineMO vmMo, Virtu
          * Search for vm video card iterating through vm device list
          * @param vmMo virtual machine mo
          * @param svgaVmramSize new svga vram size (in KB)
    +     * @param vmConfigSpec virtual machine config spec
          */
    -    private void setNewVRamSizeVmVideoCard(VirtualMachineMO vmMo, long 
svgaVmramSize) throws Exception {
    +    protected void setNewVRamSizeVmVideoCard(VirtualMachineMO vmMo, long 
svgaVmramSize, VirtualMachineConfigSpec vmConfigSpec) throws Exception {
             for (VirtualDevice device : vmMo.getAllDeviceList()){
                 if (device instanceof VirtualMachineVideoCard){
                     VirtualMachineVideoCard videoCard = 
(VirtualMachineVideoCard) device;
    -                modifyVmVideoCardVRamSize(videoCard, vmMo, svgaVmramSize);
    +                modifyVmVideoCardVRamSize(videoCard, vmMo, svgaVmramSize, 
vmConfigSpec);
                 }
             }
         }
     
         /**
    -     * Modifies vm vram size if it was set to a different size to the one 
provided in svga.vramSize (user_vm_details or template_vm_details)
    +     * Modifies vm vram size if it was set to a different size to the one 
provided in svga.vramSize (user_vm_details or template_vm_details) on {@code 
vmConfigSpec}
          * @param videoCard vm's video card device
          * @param vmMo virtual machine mo
          * @param svgaVmramSize new svga vram size (in KB)
    +     * @param vmConfigSpec virtual machine config spec
          */
    -    private void modifyVmVideoCardVRamSize(VirtualMachineVideoCard 
videoCard, VirtualMachineMO vmMo, long svgaVmramSize) throws Exception {
    +    private void modifyVmVideoCardVRamSize(VirtualMachineVideoCard 
videoCard, VirtualMachineMO vmMo, long svgaVmramSize, VirtualMachineConfigSpec 
vmConfigSpec) throws Exception {
             if (videoCard.getVideoRamSizeInKB().longValue() != svgaVmramSize){
                 s_logger.info("Video card memory was set " + 
videoCard.getVideoRamSizeInKB().longValue() + "kb instead of " + svgaVmramSize 
+ "kb");
    -            VirtualMachineConfigSpec newSizeSpecs = 
configSpecVideoCardNewVRamSize(videoCard, svgaVmramSize);
    -            boolean res = vmMo.configureVm(newSizeSpecs);
    -            if (res) {
    -                s_logger.info("Video card memory successfully updated to " 
+ svgaVmramSize + "kb");
    -            }
    +            configSpecVideoCardNewVRamSize(videoCard, svgaVmramSize, 
vmConfigSpec);
             }
         }
     
         /**
    -     * Returns a VirtualMachineConfigSpec to edit its svga vram size
    +     * Add edit spec on {@code vmConfigSpec} to modify svga vram size
          * @param videoCard video card device to edit providing the svga vram 
size
          * @param svgaVmramSize new svga vram size (in KB)
    +     * @param vmConfigSpec virtual machine spec
          */
    -    private VirtualMachineConfigSpec 
configSpecVideoCardNewVRamSize(VirtualMachineVideoCard videoCard, long 
svgaVmramSize){
    +    private void configSpecVideoCardNewVRamSize(VirtualMachineVideoCard 
videoCard, long svgaVmramSize, VirtualMachineConfigSpec vmConfigSpec){
             videoCard.setVideoRamSizeInKB(svgaVmramSize);
             videoCard.setUseAutoDetect(false);
     
             VirtualDeviceConfigSpec arrayVideoCardConfigSpecs = new 
VirtualDeviceConfigSpec();
             arrayVideoCardConfigSpecs.setDevice(videoCard);
             
arrayVideoCardConfigSpecs.setOperation(VirtualDeviceConfigSpecOperation.EDIT);
     
    -        VirtualMachineConfigSpec changeVideoCardSpecs = new 
VirtualMachineConfigSpec();
    -        
changeVideoCardSpecs.getDeviceChange().add(arrayVideoCardConfigSpecs);
    -        return changeVideoCardSpecs;
    +        vmConfigSpec.getDeviceChange().add(arrayVideoCardConfigSpecs);
    --- End diff --
    
    I don't think so. Device change done in the structure locally  and 
exception  occurs during the VM reconfiguration on the hypervisor if anything 
in the config is wrong. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to