Automation

 View Only
Expand all | Collapse all

How can i set the system resource reservation using VI toolkit?

  • 1.  How can i set the system resource reservation using VI toolkit?

    Posted Oct 15, 2008 10:59 AM

    Hi, does anyone know how i can set the CPU and memory reservation for the service console?

    Thanks.



  • 2.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 15, 2008 11:05 AM

    I don't know of any CPU reservation for the service console.

    For the memory reservation you can have a look at



  • 3.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 15, 2008 11:16 AM

    I may not have explained myself well...

    I am referring to system resource allocation as we would like to set the shares and minimum reservation etc.



  • 4.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 15, 2008 11:28 AM

    So you are talking about resource pools ?

    That can be done via the Set-ResourcePool cmdlet.



  • 5.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 15, 2008 11:31 AM

    Nope, if you are on the VI client and go to the host, configuration tab and then select System Resource Allocation - those are the settings we would like to configure using the vi toolkit.

    Thanks.



  • 6.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 15, 2008 05:09 PM

    Ok ,I finally understood what you want to do.

    And no, there is no cmdlet in the VITK to do that.

    But the SDK can do it.

    Some info:

    - we use the UpdateSystemResources method of the HostSystem object

    - this method requires a HostSystemResourceInfo object as parameter

    - in that object you can give the new settings for a system resource object (optionally with all it's child objects).

    - the tree structure of these children is luckily always the same. The host/vim/console child is the one that has the settings you want to change.

    - for other objects in the tree look at the key property of HostSystemResourceInfo object. In this case it contains host/vim/console.

    - instead of defining all the properties I just copy the child object that I obtain from HostSystem object

    - the resource parameters are found in the ResourceAllocationInfo object (1 for the CPU resources and 1 for the memory resources)

    The script:

    $esx = Get-View -Id (Get-VMHost <ESX-host>).Id
    
    # The host/vim/console object 
    $sysresinfo = $esx.SystemResources.Child[2].Child[0]
    
    # The new values (just an example)
    $sysresinfo.Config.cpuAllocation.reservation = 268 
    $sysresinfo.Config.memoryAllocation.expandableReservation = $false
    
    $esx.UpdateSystemResources($sysresinfo) 
    

    Be careful changing the system resource allocation parameters !

    Understand what you are doing !



  • 7.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 16, 2008 08:05 AM

    Hi,

    I tried to run this code but i do not see any change although there is a task "Update System Resources".

    Thanks for helping, i appreciate it.



  • 8.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 16, 2008 08:10 AM

    Are you at the correct screen ?

    In the VI Client, select the ESX server and go to Configuration - System Resource Allocation.

    Click the button and select host/vim/console.

    In the Details pane you should see the new values.



  • 9.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 16, 2008 08:21 AM

    But we want to set the following:



  • 10.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 16, 2008 08:25 AM

    There seems to be something missing from your last post.



  • 11.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 16, 2008 08:27 AM

    But we want to adjust the settings in the simple screen, is that possible?



  • 12.  RE: How can i set the system resource reservation using VI toolkit?
    Best Answer

    Posted Oct 16, 2008 08:54 AM

    Yes, with the same method.

    You just need to know that what you see in the Simple view corresponds with host/system in the Advanced view.

    I have added a few child indexes so you see the logic behind the Child -tree

    The script then becomes

    $esx = Get-View -Id (Get-VMHost <ESX-hostname>).Id
     
    # The host/system object 
    $sysresinfo = $esx.SystemResources.Child[1]
     
    # Not the children of host/system  
    $sysresinfo.Child = $null
    
    # The new values (just an example)
    $sysresinfo.Config.cpuAllocation.reservation = 300
    $sysresinfo.Config.memoryAllocation.reservation = 1
     
    $esx.UpdateSystemResources($sysresinfo) 
    

    Again, be very careful what you are doing with this !!



  • 13.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Oct 16, 2008 09:03 AM

    thanks for persevering and helping me out.



  • 14.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Mar 25, 2009 07:58 PM

    Any ideas what is causing this?

    Exception calling "UpdateSystemResources" with "1" argument(s): "A specified parameter was not correct.

    "

    At :line:16 char:26

    + $esx.UpdateSystemResources &lt;&lt;&lt;&lt; ($sysresinfo)



  • 15.  RE: How can i set the system resource reservation using VI toolkit?

    Posted Mar 25, 2009 08:08 PM

    The error is from the first scirpt Luc provided. It works fine on the second script. Just looking to see what the differences are between the two....

    Steve