return (result);
}
- ConstElementPtr lease_database = dhcp4->get("lease-database");
- if (lease_database) {
- db::DbAccessParser parser;
- std::string access_string;
- parser.parse(access_string, lease_database);
- auto params = parser.getDbAccessParameters();
- if (params["type"] == "memfile") {
- string file_name = params["name"];
- if (!file_name.empty() &&
- (file_name.find_first_of('/') == string::npos)) {
- // Prepend the current datadir to the name.
- file_name = CfgMgr::instance().getDataDir() + "/" + file_name;
- }
- if (Memfile_LeaseMgr::isLFCProcessRunning(file_name, Memfile_LeaseMgr::V4)) {
- return (isc::config::createAnswer(CONTROL_RESULT_ERROR,
- "Can not update configuration while lease file cleanup process is running."));
- }
+ if (LeaseMgrFactory::haveInstance() &&
+ (LeaseMgrFactory::instance().getType() == "memfile")) {
+ Memfile_LeaseMgr& mgr = dynamic_cast<Memfile_LeaseMgr&>(LeaseMgrFactory::instance());
+ auto file_name = mgr.getLeaseFilePath(Memfile_LeaseMgr::V4);
+ if (Memfile_LeaseMgr::isLFCProcessRunning(file_name, Memfile_LeaseMgr::V4)) {
+ return (isc::config::createAnswer(CONTROL_RESULT_ERROR,
+ "Can not update configuration while lease file cleanup process is running."));
}
}
return (result);
}
- ConstElementPtr lease_database = dhcp6->get("lease-database");
- if (lease_database) {
- db::DbAccessParser parser;
- std::string access_string;
- parser.parse(access_string, lease_database);
- auto params = parser.getDbAccessParameters();
- if (params["type"] == "memfile") {
- string file_name = params["name"];
- if (!file_name.empty() &&
- (file_name.find_first_of('/') == string::npos)) {
- // Prepend the current datadir to the name.
- file_name = CfgMgr::instance().getDataDir() + "/" + file_name;
- }
- if (Memfile_LeaseMgr::isLFCProcessRunning(file_name, Memfile_LeaseMgr::V6)) {
- return (isc::config::createAnswer(CONTROL_RESULT_ERROR,
- "Can not update configuration while lease file cleanup process is running."));
- }
+ if (LeaseMgrFactory::haveInstance() &&
+ (LeaseMgrFactory::instance().getType() == "memfile")) {
+ Memfile_LeaseMgr& mgr = dynamic_cast<Memfile_LeaseMgr&>(LeaseMgrFactory::instance());
+ auto file_name = mgr.getLeaseFilePath(Memfile_LeaseMgr::V6);
+ if (Memfile_LeaseMgr::isLFCProcessRunning(file_name, Memfile_LeaseMgr::V6)) {
+ return (isc::config::createAnswer(CONTROL_RESULT_ERROR,
+ "Can not update configuration while lease file cleanup process is running."));
}
}