Beispiel #1
0
 def setup(self, mock_path):
     self.context_manager_mock = mock.Mock()
     self.file_mock = mock.Mock()
     self.enter_mock = mock.Mock()
     self.exit_mock = mock.Mock()
     self.enter_mock.return_value = self.file_mock
     setattr(self.context_manager_mock, '__enter__', self.enter_mock)
     setattr(self.context_manager_mock, '__exit__', self.exit_mock)
     self.volume_type = namedtuple(
         'volume_type', [
             'name',
             'size',
             'realpath',
             'mountpoint',
             'fullsize',
             'attributes'
         ]
     )
     self.volumes = [
         self.volume_type(
             name='LVRoot', size='freespace:100', realpath='/',
             mountpoint=None, fullsize=False,
             attributes=[]
         ),
         self.volume_type(
             name='LVetc', size='freespace:200', realpath='/etc',
             mountpoint='/etc', fullsize=False,
             attributes=[]
         ),
         self.volume_type(
             name='myvol', size='size:500', realpath='/data',
             mountpoint='LVdata', fullsize=False,
             attributes=[]
         ),
         self.volume_type(
             name='LVhome', size=None, realpath='/home',
             mountpoint='/home', fullsize=True,
             attributes=[]
         )
     ]
     mock_path.return_value = True
     self.device_provider = mock.Mock()
     self.device_provider.is_loop = mock.Mock(
         return_value=True
     )
     self.device_provider.get_device = mock.Mock(
         return_value='/dev/storage'
     )
     self.volume_manager = VolumeManagerBtrfs(
         self.device_provider, 'root_dir', self.volumes
     )
Beispiel #2
0
 def __new__(
     self, name, device_provider, root_dir, volumes, custom_args=None
 ):
     if name == 'lvm':
         return VolumeManagerLVM(
             device_provider, root_dir, volumes, custom_args
         )
     elif name == 'btrfs':
         return VolumeManagerBtrfs(
             device_provider, root_dir, volumes, custom_args
         )
     else:
         raise KiwiVolumeManagerSetupError(
             'Support for %s volume manager not implemented' % name
         )
Beispiel #3
0
 def setup(self, mock_path):
     self.volume_type = namedtuple(
         'volume_type', [
             'name',
             'size',
             'realpath',
             'mountpoint',
             'fullsize',
             'attributes'
         ]
     )
     self.volumes = [
         self.volume_type(
             name='LVRoot', size='freespace:100', realpath='/',
             mountpoint=None, fullsize=False,
             attributes=[]
         ),
         self.volume_type(
             name='LVetc', size='freespace:200', realpath='/etc',
             mountpoint='/etc', fullsize=False,
             attributes=[]
         ),
         self.volume_type(
             name='myvol', size='size:500', realpath='/data',
             mountpoint='LVdata', fullsize=False,
             attributes=[]
         ),
         self.volume_type(
             name='LVhome', size=None, realpath='/home',
             mountpoint='/home', fullsize=True,
             attributes=[]
         )
     ]
     mock_path.return_value = True
     self.device_map = {
         'root': Mock()
     }
     self.device_map['root'].is_loop = Mock(
         return_value=True
     )
     self.device_map['root'].get_device = Mock(
         return_value='/dev/storage'
     )
     self.volume_manager = VolumeManagerBtrfs(
         self.device_map, 'root_dir', self.volumes
     )
Beispiel #4
0
 def setup(self, mock_path):
     self.volume_type = namedtuple(
         'volume_type', [
             'name',
             'size',
             'realpath',
             'mountpoint',
             'fullsize'
         ]
     )
     self.volumes = [
         self.volume_type(
             name='LVRoot', size='freespace:100', realpath='/',
             mountpoint=None, fullsize=False
         ),
         self.volume_type(
             name='LVetc', size='freespace:200', realpath='/etc',
             mountpoint='/etc', fullsize=False
         ),
         self.volume_type(
             name='myvol', size='size:500', realpath='/data',
             mountpoint='LVdata', fullsize=False
         ),
         self.volume_type(
             name='LVhome', size=None, realpath='/home',
             mountpoint='/home', fullsize=True
         ),
     ]
     mock_path.return_value = True
     self.device_provider = mock.Mock()
     self.device_provider.is_loop = mock.Mock(
         return_value=True
     )
     self.device_provider.get_device = mock.Mock(
         return_value='/dev/storage'
     )
     self.volume_manager = VolumeManagerBtrfs(
         self.device_provider, 'root_dir', self.volumes
     )