~lool/vmbuilder/grub2

« back to all changes in this revision

Viewing changes to VMBuilder/disk.py

  • Committer: Loïc Minier
  • Author(s): Colin Watson
  • Date: 2010-01-22 00:08:12 UTC
  • Revision ID: lool@dooz.org-20100122000812-n5ec1v9kpkyk98mt
Use GRUB 2 for >= karmic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
219
219
            """
220
220
            return { TYPE_EXT2: 'ext2', TYPE_EXT3: 'ext2', TYPE_XFS: 'ext2', TYPE_SWAP: 'linux-swap(new)' }[self.type]
221
221
 
 
222
        def grub2_fstype(self):
 
223
            """
 
224
            @rtype: string
 
225
            @return: the grub2 module capable of reading this filesystem
 
226
            """
 
227
            return { TYPE_EXT2: 'ext2', TYPE_EXT3: 'ext2', TYPE_XFS: 'xfs', TYPE_SWAP: '' }[self.type]
 
228
 
222
229
        def create(self, disk):
223
230
            """Adds partition to the disk image (does not mkfs or anything like that)"""
224
231
            logging.info('Adding type %d partition to disk image: %s' % (self.type, disk.filename))
235
242
            """The name of the partition as known by grub"""
236
243
            return '(hd%d,%d)' % (self.disk.get_index(), self.get_index())
237
244
 
 
245
        def get_grub2_id(self):
 
246
            """The name of the partition as known by grub2"""
 
247
            return '(hd%d,%d)' % (self.disk.get_index(), self.get_index() + 1)
 
248
 
238
249
        def get_suffix(self):
239
250
            """Returns 'a4' for a device that would be called /dev/sda4 in the guest. 
240
251
               This allows other parts of VMBuilder to set the prefix to something suitable."""