|
|
@ -21,8 +21,7 @@ void Quotas_sys::format_cmd_quotas_system(struct struct_quotas& _struct_quota) {
|
|
|
|
(*map_gui_cfg)[key] = value;
|
|
|
|
(*map_gui_cfg)[key] = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Quotas_sys::off_quota_ubconfig(Gtk::ComboBoxText* combo_box, string quota_type) {
|
|
|
|
void Quotas_sys::off_quota_ubconfig(string partition, string quota_type) {
|
|
|
|
string partition = combo_box->get_active_text();
|
|
|
|
|
|
|
|
string key = "DISK_QUOTA[" + quota_type + ":" + partition + "]";
|
|
|
|
string key = "DISK_QUOTA[" + quota_type + ":" + partition + "]";
|
|
|
|
string value = "disable";
|
|
|
|
string value = "disable";
|
|
|
|
(*map_gui_cfg)[key] = value;
|
|
|
|
(*map_gui_cfg)[key] = value;
|
|
|
@ -87,6 +86,7 @@ struct status_quotas Quotas_sys::check_on_quotas_system_2_hw(string params) {
|
|
|
|
return status;
|
|
|
|
return status;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Quotas_sys::on_quota_hw(string partition, string cmd_hw, string cmd_sw) {
|
|
|
|
bool Quotas_sys::on_quota_hw(string partition, string cmd_hw, string cmd_sw) {
|
|
|
|
if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) {
|
|
|
|
if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) {
|
|
|
|
if (map_hw_or_sw[partition] == "hw") {
|
|
|
|
if (map_hw_or_sw[partition] == "hw") {
|
|
|
@ -103,57 +103,59 @@ bool Quotas_sys::on_quota_hw(string partition, string cmd_hw, string cmd_sw) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Quotas_sys::on_quota_sw(string partition, int mode) {
|
|
|
|
bool Quotas_sys::on_quota_sw(string partition, int mode) {
|
|
|
|
if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) {
|
|
|
|
if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) {
|
|
|
|
string cmd = "";
|
|
|
|
string cmd = "";
|
|
|
|
if (mode == 0) {
|
|
|
|
if (mode == 0) {
|
|
|
|
cmd += "mount -vo remount,usrquota " + partition;
|
|
|
|
cmd += "mount -vo remount,usrquota " + partition;
|
|
|
|
cmd += "quotacheck -ucm " + partition;
|
|
|
|
cmd += "; quotacheck -ucm " + partition;
|
|
|
|
cmd += "quotaon -uv " + partition;
|
|
|
|
cmd += "; quotaon -uv " + partition;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mode == 1) {
|
|
|
|
else if (mode == 1) {
|
|
|
|
cmd += "mount -vo remount,grpquota " + partition;
|
|
|
|
cmd += "; mount -vo remount,grpquota " + partition;
|
|
|
|
cmd += "quotacheck -gcm " + partition;
|
|
|
|
cmd += "; quotacheck -gcm " + partition;
|
|
|
|
cmd += "quotaon -gv " + partition;
|
|
|
|
cmd += "; quotaon -gv " + partition;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mode == 2) {
|
|
|
|
else if (mode == 2) {
|
|
|
|
cmd += "quotaon -ugPv " + partition;
|
|
|
|
cmd += "; quotaon -ugPv " + partition;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (mode == 3) {
|
|
|
|
else if (mode == 3) {
|
|
|
|
cmd += "quotaon -augPv";
|
|
|
|
cmd += "; quotaon -augPv";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cmd += "ubconfig set config SERVICESSTART+=,quotaon.service";
|
|
|
|
cmd += "; ubconfig set config SERVICESSTART+=,quotaon.service";
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Quotas_sys::off_quota_system(Gtk::ComboBoxText* combo_box, string quota_type) {
|
|
|
|
bool Quotas_sys::off_quota_system(string partition, string quota_hw, string quota_sw) {
|
|
|
|
string partition = combo_box->get_active_text();
|
|
|
|
|
|
|
|
string cmd = "";
|
|
|
|
string cmd = "";
|
|
|
|
if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) {
|
|
|
|
if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) {
|
|
|
|
if (map_hw_or_sw[partition] == "hw") {
|
|
|
|
if (map_hw_or_sw[partition] == "hw") {
|
|
|
|
cmd = "tune2fs -Q ^" + quota_type + " " + partition;
|
|
|
|
cmd = quota_hw + " " + partition;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (map_hw_or_sw[partition] == "sw") {
|
|
|
|
else if (map_hw_or_sw[partition] == "sw") {
|
|
|
|
cmd = "quotaoff -u " + quota_type.substr(0,1) + " " + partition;
|
|
|
|
cmd = quota_sw + " " + partition;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// TODO:
|
|
|
|
// TODO:
|
|
|
|
// Убрать после тестирования
|
|
|
|
// Убрать после тестирования
|
|
|
|
throw "Опа цэ!";
|
|
|
|
throw "Опа цэ!";
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
obj_process_system.call(cmd, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|