def test_ensure_block_device_loopback(self):
        '''It ensures loopback device when checking block device'''
        cinder_utils.ensure_block_device('/tmp/cinder.img')
        ex_size = cinder_utils.DEFAULT_LOOPBACK_SIZE
        self.ensure_loopback_device.assert_called_with('/tmp/cinder.img',
                                                       ex_size)

        cinder_utils.ensure_block_device('/tmp/cinder-2.img|15G')
        self.ensure_loopback_device.assert_called_with('/tmp/cinder-2.img',
                                                       '15G')
Esempio n. 2
0
def install():
    execd_preinstall()
    conf = config()
    src = conf['openstack-origin']
    if (lsb_release()['DISTRIB_CODENAME'] == 'precise' and
       src == 'distro'):
        src = 'cloud:precise-folsom'
    configure_installation_source(src)
    apt_update()
    apt_install(determine_packages(), fatal=True)

    if (service_enabled('volume') and
       conf['block-device'] not in [None, 'None', 'none']):
        bdev = ensure_block_device(conf['block-device'])
        juju_log('Located valid block device: %s' % bdev)
        if conf['overwrite'] in ['true', 'True', True]:
            juju_log('Ensuring block device is clean: %s' % bdev)
            clean_storage(bdev)
        prepare_lvm_storage(bdev, conf['volume-group'])
 def test_ensure_standard_block_device(self):
     '''It looks for storage at both relative and full device path'''
     for dev in ['vdb', '/dev/vdb']:
         cinder_utils.ensure_block_device(dev)
         self.is_block_device.assert_called_with('/dev/vdb')