Пример #1
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 = VolumeManagerLVM(self.device_provider,
                                            'root_dir', self.volumes)
Пример #2
0
 def setup(self, mock_path):
     self.volume_type = namedtuple('volume_type', [
         'name', 'size', 'realpath', 'mountpoint', 'fullsize', 'label',
         'attributes', 'is_root_volume'
     ])
     self.volumes = [
         self.volume_type(name='LVRoot',
                          size='freespace:100',
                          realpath='/',
                          mountpoint=None,
                          fullsize=False,
                          label=None,
                          attributes=[],
                          is_root_volume=True),
         self.volume_type(name='LVSwap',
                          size='size:100',
                          realpath='swap',
                          mountpoint=None,
                          fullsize=False,
                          label='SWAP',
                          attributes=[],
                          is_root_volume=False),
         self.volume_type(name='LVetc',
                          size='freespace:200',
                          realpath='/etc',
                          mountpoint='/etc',
                          fullsize=False,
                          label='etc',
                          attributes=[],
                          is_root_volume=False),
         self.volume_type(name='myvol',
                          size='size:500',
                          realpath='/data',
                          mountpoint='LVdata',
                          fullsize=False,
                          label=None,
                          attributes=[],
                          is_root_volume=False),
         self.volume_type(name='LVhome',
                          size=None,
                          realpath='/home',
                          mountpoint='/home',
                          fullsize=True,
                          label=None,
                          attributes=[],
                          is_root_volume=False),
     ]
     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 = VolumeManagerLVM(
         self.device_map, 'root_dir', self.volumes, {
             'some-arg': 'some-val',
             'fs_mount_options': ['a,b,c']
         })
     assert self.volume_manager.mount_options == 'a,b,c'
Пример #3
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
         )