Public bug reported:

The option "--swapsize 0" currently throws an exception -- I guess
vmbuilder tries to add a 0-sized partition to the virtual disk.

In the cli module, in its CLI class, in its set_disk_layout method, the
code says:

            if vm.hypervisor.preferred_storage == 
VMBuilder.hypervisor.STORAGE_FS_IMAGE:
                vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', 
mntpnt='/')
                vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', 
mntpnt=None)
                if vm.optsize > 0:
                    vm.add_filesystem(size='%dM' % optsize, type='ext3', 
mntpnt='/opt')
            else:
                if vm.raw:
                    disk = vm.add_disk(filename=vm.raw, preallocated=True)
                else:
                    size = vm.rootsize + vm.swapsize + vm.optsize
                    disk = vm.add_disk(size='%dM' % size)
                offset = 0
                disk.add_part(offset, vm.rootsize, 'ext3', '/')
                offset += vm.rootsize
                disk.add_part(offset, vm.swapsize, 'swap', 'swap')
                offset += vm.swapsize
                if vm.optsize > 0:
                    disk.add_part(offset, vm.optsize, 'ext3', '/opt')

and it could allow for skipping swapfiles with:

            if vm.hypervisor.preferred_storage == 
VMBuilder.hypervisor.STORAGE_FS_IMAGE:
                vm.add_filesystem(size='%dM' % vm.rootsize, type='ext3', 
mntpnt='/')
                if vm.swapsize > 0:
                    vm.add_filesystem(size='%dM' % vm.swapsize, type='swap', 
mntpnt=None)
                if vm.optsize > 0:
                    vm.add_filesystem(size='%dM' % optsize, type='ext3', 
mntpnt='/opt')
            else:
                if vm.raw:
                    disk = vm.add_disk(filename=vm.raw, preallocated=True)
                else:
                    size = vm.rootsize + vm.swapsize + vm.optsize
                    disk = vm.add_disk(size='%dM' % size)
                offset = 0
                disk.add_part(offset, vm.rootsize, 'ext3', '/')
                offset += vm.rootsize
                if vm.swapsize > 0:
                    disk.add_part(offset, vm.swapsize, 'swap', 'swap')
                    offset += vm.swapsize
                if vm.optsize > 0:
                    disk.add_part(offset, vm.optsize, 'ext3', '/opt')

** Affects: vm-builder (Ubuntu)
     Importance: Undecided
         Status: New

-- 
vmbuilder should allow for no swapfile
https://bugs.launchpad.net/bugs/403149
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to