]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/system/st_rados_delete_pool.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2011 New Dream Network
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #include "cross_process_sem.h"
16 #include "include/rados/librados.h"
17 #include "st_rados_delete_pool.h"
18 #include "systest_runnable.h"
19 #include "systest_settings.h"
23 StRadosDeletePool::StRadosDeletePool(int argc
, const char **argv
,
24 CrossProcessSem
*pool_setup_sem
,
25 CrossProcessSem
*delete_pool_sem
,
26 const std::string
&pool_name
)
27 : SysTestRunnable(argc
, argv
),
28 m_pool_setup_sem(pool_setup_sem
),
29 m_delete_pool_sem(delete_pool_sem
),
30 m_pool_name(pool_name
)
34 StRadosDeletePool::~StRadosDeletePool()
38 int StRadosDeletePool::run()
41 RETURN1_IF_NONZERO(rados_create(&cl
, NULL
));
42 rados_conf_parse_argv(cl
, m_argc
, m_argv
);
43 RETURN1_IF_NONZERO(rados_conf_read_file(cl
, NULL
));
44 rados_conf_parse_env(cl
, NULL
);
45 RETURN1_IF_NONZERO(rados_connect(cl
));
46 m_pool_setup_sem
->wait();
47 m_pool_setup_sem
->post();
50 rados_pool_create(cl
, m_pool_name
.c_str());
51 RETURN1_IF_NONZERO(rados_ioctx_create(cl
, m_pool_name
.c_str(), &io_ctx
));
52 rados_ioctx_destroy(io_ctx
);
53 printf("%s: deleting pool %s\n", get_id_str(), m_pool_name
.c_str());
54 RETURN1_IF_NONZERO(rados_pool_delete(cl
, m_pool_name
.c_str()));
55 if (m_delete_pool_sem
)
56 m_delete_pool_sem
->post();