Exemple #1
0
def delete_pool(pool_name):
    """Delete a storage pool"""
    try:
        execute("virsh 'pool-destroy %s'" %pool_name)
        execute("virsh 'pool-undefine %s'" %pool_name)
        del_folder(os.path.join(c('general', 'storage-endpoint'), pool_name))
        if pool_name == c('general', 'default-storage-pool'):
            set_default_pool('')
    except Exception, e:
        print "Failed to delete pool %s: %s" % (pool_name, e)
Exemple #2
0
def delete_pool(pool_name):
    """Delete a storage pool"""
    try:
        config = get_config()
        if get_pool_path(pool_name) == '/storage/local':
            raise Exception('/storage/local can not be deleted')
        execute("virsh 'pool-destroy %s'" % pool_name)
        execute("virsh 'pool-undefine %s'" % pool_name)
        del_folder(get_pool_path(pool_name))
        if pool_name == config.getstring('general', 'default-storage-pool'):
            set_default_pool('')
    except Exception, e:
        raise Exception("Failed to delete pool %s: %s" % (pool_name, e))
Exemple #3
0
def delete_pool(pool_name):
    """Delete a storage pool"""
    try:
        config = get_config()
        if get_pool_path(pool_name) == '/storage/local':
            raise Exception('/storage/local can not be deleted')
        execute("virsh 'pool-destroy %s'" % pool_name)
        execute("virsh 'pool-undefine %s'" % pool_name)
        del_folder(get_pool_path(pool_name))
        if pool_name == config.getstring('general', 'default-storage-pool'):
            set_default_pool('')
    except Exception, e:
        raise Exception("Failed to delete pool %s: %s" % (pool_name, e))