def getOSCustomizationSpec(filename):
    customOSSpec = getSpecFromXML(filename, "OS-Spec")
    customNetworkSpecList = getSpecFromXML(filename, "Network-Spec")       # REMINDER: this is a list

    if customNetworkSpecList and customOSSpec:
        customization_spec = vim.CustomizationSpec(identity=customSystemPreparation(customOSSpec),
                                                    globalIPSettings=customGlobalIPSettings(customNetworkSpecList),
                                                    nicSettingMap=customNICSettingMap(customNetworkSpecList))
        return customization_spec
Esempio n. 2
0
def getVMConfigSpec(content, filename, template, vmname):
    customVMSpec = getSpecFromXML(filename, "VM-Spec")
    customNetworkSpecList = getSpecFromXML(filename, "Network-Spec")

    networkDeviceSpec_List = getVirtualNWDeviceSpec(content, customNetworkSpecList, template)

    # append here other specifications *multiple network specs, disk, floppy, cd, etc*
    device_config_spec = []
    for network_spec in networkDeviceSpec_List:
        device_config_spec.append(network_spec)

    # New object which encapsulates configuration settings when creating or reconfiguring a virtual machine
    vm_config_spec = vim.VirtualMachineConfigSpec(name=vmname,
                                                    memoryMB=long(customVMSpec['memoryMB']),
                                                    numCPUs=int(customVMSpec['numCPUs']),
                                                    deviceChange=device_config_spec)
    return vm_config_spec;
Esempio n. 3
0
def getVMConfigSpec(content, filename, template, vmname):
    customVMSpec = getSpecFromXML(filename, "VM-Spec")
    customNetworkSpecList = getSpecFromXML(filename, "Network-Spec")

    networkDeviceSpec_List = getVirtualNWDeviceSpec(content,
                                                    customNetworkSpecList,
                                                    template)

    # append here other specifications *multiple network specs, disk, floppy, cd, etc*
    device_config_spec = []
    for network_spec in networkDeviceSpec_List:
        device_config_spec.append(network_spec)

    # New object which encapsulates configuration settings when creating or reconfiguring a virtual machine
    vm_config_spec = vim.VirtualMachineConfigSpec(
        name=vmname,
        memoryMB=long(customVMSpec['memoryMB']),
        numCPUs=int(customVMSpec['numCPUs']),
        deviceChange=device_config_spec)
    return vm_config_spec