def delete_backstore(plugin, diskname):

	try:
		if plugin == 1:
			fio = FileIOStorageObject(name = diskname)

			fio.delete()

			print ("the fileio %s has been deleted" %(diskname))


		elif plugin == 2:

			io = BlockStorageObject(name = diskname)

			io.delete()

			print ("the blockio %s has been deleted" %(diskname))

		else:
			return -1
		
		return 0

	except Exception,e:

		print e

		return -1
def modify_block_size(block_diskname,set_block_size):

	fio = BlockStorageObject(name = block_diskname)

	fio.set_attribute('block_size','set_block_size')

	return fio.get_attribute('block_size')
Esempio n. 3
0
    def ui_command_create(self, name, dev, readonly=None):
        '''
        Creates an Block Storage object. I{dev} is the path to the TYPE_DISK
        block device to use.
        '''
        self.assert_root()

        readonly = self.ui_eval_param(readonly, 'bool', False)

        so = BlockStorageObject(name, dev, readonly=readonly)
        ui_so = UIBlockStorageObject(so, self)
        self.setup_model_alias(so)
        self.shell.log.info("Created block storage object %s using %s."
                            % (name, dev))
        return self.new_node(ui_so)