Beispiel #1
0
def vmedia_enable(handle, encryption_state=None, low_power_usb=None,
                  server_id=1):
    """
    This method will enable vmedia and setup the properties

    Args:
        handle (ImcHandle)
        encrypt (bool): Encrypt virtual media communications
        low_power_usb (bool): Enable low power usb
        server_id (int): Server Id to be specified for C3260 platforms

    Returns:
        CommVMedia object

    Examples:
        vmedia_enable(handle, True, True)
    """

    if encryption_state: encryption_state = 'enabled'
    else: encryption_state = 'disabled'

    if low_power_usb: low_power_usb = 'enabled'
    else: low_power_usb = 'disabled'

    mo = CommVMedia(parent_mo_or_dn=_get_comm_mo_dn(handle, server_id))
    params = {
        "admin_state": "enabled",
        "encryption_state": encryption_state,
        "low_power_usb_state": low_power_usb,
        "low_power_usb": low_power_usb,
    }

    mo.set_prop_multiple(**params)
    handle.set_mo(mo)
    return mo
Beispiel #2
0
def vmedia_enable(handle, encryption_state=None, low_power_usb=None,
                  server_id=1):
    """
    This method will enable vmedia and setup the properties

    Args:
        handle (ImcHandle)
        encrypt (bool): Encrypt virtual media communications
        low_power_usb (bool): Enable low power usb
        server_id (int): Server Id to be specified for C3260 platforms

    Returns:
        CommVMedia object

    Examples:
        vmedia_enable(handle, True, True)
    """

    mo = CommVMedia(parent_mo_or_dn=_get_comm_mo_dn(handle, server_id))
    params = {
        "admin_state": "enabled",
        "encryption_state": encryption_state,
        "low_power_usb_state": low_power_usb,
        "low_power_usb": low_power_usb,
    }

    mo.set_prop_multiple(**params)
    handle.set_mo(mo)
    return mo
Beispiel #3
0
def vmedia_setup(handle, encrypt=False, low_power_usb=False, server_id=1):
    """
    This method will enable vmedia and setup the properties

    Args:
        handle (ImcHandle)
        encrypt (bool): Encrypt virtual media communications
        low_power_usb (bool): Enable low power usb
        server_id (int): Server Id to be specified for C3260 platforms

    Returns:
        CommVMedia object

    Examples:
        vmedia_setup(handle, True, True)
    """

    vmedia_mo = CommVMedia(parent_mo_or_dn=_get_comm_mo_dn(handle, server_id))
    params = {
        "admin_state": "enabled",
        "encryption_state": ("disabled", "enabled")[encrypt],
        "low_power_usb_state": ("disabled", "enabled")[low_power_usb],
        "low_power_usb": ("disabled", "enabled")[low_power_usb],
    }

    vmedia_mo.set_prop_multiple(**params)
    handle.set_mo(vmedia_mo)
    return vmedia_mo
Beispiel #4
0
def _vmedia_setup(handle, admin_state, encryption_state, low_power_usb,
                  server_id):
    dn = _get_comm_mo_dn(handle, server_id)
    mo = CommVMedia(parent_mo_or_dn=dn)
    params = {
        "admin_state": admin_state,
        "encryption_state": encryption_state,
        "low_power_usb_state": low_power_usb,
        "low_power_usb": low_power_usb,
    }

    mo.set_prop_multiple(**params)
    handle.set_mo(mo)
    return mo
Beispiel #5
0
def _vmedia_setup(handle, admin_state, encryption_state, low_power_usb,
                  server_id):
    dn = _get_comm_mo_dn(handle, server_id)
    mo = CommVMedia(parent_mo_or_dn=dn)
    params = {
        "admin_state": admin_state,
        "encryption_state": encryption_state,
        "low_power_usb_state": low_power_usb,
        "low_power_usb": low_power_usb,
    }

    mo.set_prop_multiple(**params)
    handle.set_mo(mo)
    return mo
Beispiel #6
0
def vmedia_disable(handle, server_id=1):
    """
    This method will disable vmedia on the server and unmount any virtual media
        already mounted

    Args:
        handle: ImcHandle
        server_id (int): Server Id to be specified for C3260 platforms

    Returns:
        None
    """

    mo = CommVMedia(parent_mo_or_dn=_get_comm_mo_dn(handle, server_id))
    mo.admin_state = "disabled"

    handle.set_mo(mo)
Beispiel #7
0
def vmedia_disable(handle, server_id=1):
    """
    This method will disable vmedia on the server and unmount any virtual media
        already mounted

    Args:
        handle: ImcHandle
        server_id (int): Server Id to be specified for C3260 platforms

    Returns:
        None
    """

    mo = CommVMedia(parent_mo_or_dn=_get_comm_mo_dn(handle, server_id))
    mo.admin_state = "disabled"

    handle.set_mo(mo)
def MountVmedia(handle, ip, fileuri, volume_name):
    log.info("Preparing to mount virtual media on <%s>.", ip)
    print "Preparing to mount virtual media on <"+ ip +">.\n"
    # First make sure we enable vMedia
    mo = CommVMedia(parent_mo_or_dn=_get_comm_mo_dn(handle, server_id=1))
    params = {
        "admin_state": "enabled",
        "encryption_state": "Disabled",
        "low_power_usb_state": "Disabled",
        "low_power_usb": "Disabled",
    }
    mo.set_prop_multiple(**params)
    handle.set_mo(mo)
    # Now mount the vMedia
    vmedia_mount_uri(
            handle,
            volume_name=volume_name,
            uri=fileuri
        )