Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcsim: Unable to set bootOrder of virtual machine #970

Closed
Akasurde opened this issue Dec 17, 2017 · 0 comments
Closed

vcsim: Unable to set bootOrder of virtual machine #970

Akasurde opened this issue Dec 17, 2017 · 0 comments

Comments

@Akasurde
Copy link
Contributor

I am unable to set boot order for virtual machine created by vcsim,

from pyVim.connect import SmartConnect, Disconnect
import ssl
import atexit
from pyVmomi import vim

def connect():
    context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
    context.verify_mode = ssl.CERT_NONE

    si = SmartConnect(host='0.0.0.0', user='user', pwd='pass', port=443, sslContext=context)
    atexit.register(Disconnect, si)
    content = si.RetrieveContent()
    return content

def get_obj(content, vimtype, name):
    """
    Return an object by name, if name is None the
    first found object is returned
    """
    obj = None
    container = content.viewManager.CreateContainerView(
        content.rootFolder, vimtype, True)
    for c in container.view:
        if name:
            if c.name == name:
                obj = c
                break
        else:
            obj = c
            break

    container.Destroy()
    return obj

content = connect()
configSpec = vim.vm.ConfigSpec()
configSpec.bootOptions = vim.vm.BootOptions(bootOrder=[vim.vm.BootOptions.BootableDiskDevice(deviceKey=0)])
vm = get_obj(content, [vim.VirtualMachine], 'DC0_H0_VM0')
print("Boot Order before : %s" % vm.config.bootOptions)
vm.Reconfigure(configSpec)
print("Boot Order after : %s " % vm.config.bootOptions)

Expected Result:

vcsim should honour the bootOrder provided by bootOptions Config parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants