コード例 #1
0
def get_vm_name_by_uuid(vm_uuid):
    """ Returns vm_name for given vm_uuid, or None """
    si = vmdk_ops.get_si()
    try:
        return vmdk_ops.vm_uuid2name(vm_uuid)
    except:
        return None
コード例 #2
0
def get_vm_name_by_uuid(vm_uuid):
    """
    Returns vm_name for given vm_uuid, or None
    TODO: Need to refactor further (can be a redundant method)
    """
    si = vmdk_ops.get_si()
    try:
        return vmdk_ops.vm_uuid2name(vm_uuid)
    except:
        return None
コード例 #3
0
def get_vm_name_by_uuid(vm_uuid):
    """
    Returns vm_name for given vm_uuid, or None
    TODO: Need to refactor further (can be a redundant method)
    """
    si = vmdk_ops.get_si()
    try:
        return vmdk_ops.vm_uuid2name(vm_uuid)
    except:
        return None
コード例 #4
0
def get_attached_to(metadata):
    """ Return which VM a volume is attached to based on its metadata. """
    try:
        vm_name = vmdk_ops.vm_uuid2name(metadata[kv.ATTACHED_VM_UUID])
        if not vm_name:
            if metadata[kv.ATTACHED_VM_UUID]:
                return metadata[kv.ATTACHED_VM_UUID]
            return kv.DETACHED

        return vm_name
    except:
        return kv.DETACHED
コード例 #5
0
def get_attached_to(metadata):
    """ Return which VM a volume is attached to based on its metadata. """
    try:
        if kv.ATTACHED_VM_UUID in metadata:
            vm_name = vmdk_ops.vm_uuid2name(metadata[kv.ATTACHED_VM_UUID])
            if vm_name:
                return vm_name
            # If vm name couldn't be retrieved through uuid, use name from KV
            elif kv.ATTACHED_VM_NAME in metadata:
                return metadata[kv.ATTACHED_VM_NAME]
            else:
                return metadata[kv.ATTACHED_VM_UUID]
        else:
            return kv.DETACHED
    except:
        return kv.DETACHED