예제 #1
0
    def GetFileEntryByPathSpec(self, path_spec):
        """Retrieves a file entry for a path specification.

    Args:
      path_spec (PathSpec): path specification.

    Returns:
      LVMFileEntry: a file entry or None if not available.
    """
        volume_index = lvm.LVMPathSpecGetVolumeIndex(path_spec)

        # The virtual root file has no corresponding volume index but
        # should have a location.
        if volume_index is None:
            location = getattr(path_spec, 'location', None)
            if location is None or location != self.LOCATION_ROOT:
                return None

            return lvm_file_entry.LVMFileEntry(self._resolver_context,
                                               self,
                                               path_spec,
                                               is_root=True,
                                               is_virtual=True)

        if (volume_index < 0 or volume_index >=
                self._vslvm_volume_group.number_of_logical_volumes):
            return None

        return lvm_file_entry.LVMFileEntry(self._resolver_context, self,
                                           path_spec)
예제 #2
0
    def testIntialize(self):
        """Test the initialize functionality."""
        file_entry = lvm_file_entry.LVMFileEntry(self._resolver_context,
                                                 self._file_system,
                                                 self._lvm_path_spec)

        self.assertIsNotNone(file_entry)
예제 #3
0
    def testIntialize(self):
        """Test the __init__ function."""
        file_entry = lvm_file_entry.LVMFileEntry(self._resolver_context,
                                                 self._file_system,
                                                 self._lvm_path_spec,
                                                 is_virtual=True)

        self.assertIsNotNone(file_entry)