File indexing completed on 2024-04-28 05:45:54

0001 /*
0002     SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
0003     SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
0004 
0005     SPDX-License-Identifier: GPL-3.0-or-later
0006 */
0007 
0008 #include "jobs/removevolumegroupjob.h"
0009 
0010 #include "core/lvmdevice.h"
0011 
0012 #include "util/report.h"
0013 
0014 #include <KLocalizedString>
0015 
0016 /** Creates a new RemoveVolumeGroupJob
0017 */
0018 RemoveVolumeGroupJob::RemoveVolumeGroupJob(VolumeManagerDevice& d) :
0019     Job(),
0020     m_Device(d)
0021 {
0022 }
0023 
0024 bool RemoveVolumeGroupJob::run(Report& parent)
0025 {
0026     bool rval = false;
0027 
0028     Report* report = jobStarted(parent);
0029 
0030     if (device().type() == Device::Type::LVM_Device) {
0031         rval = LvmDevice::removeVG(*report, dynamic_cast<LvmDevice&>(device()));
0032     }
0033 
0034     jobFinished(*report, rval);
0035 
0036     return rval;
0037 }
0038 
0039 QString RemoveVolumeGroupJob::description() const
0040 {
0041     return xi18nc("@info/plain", "Remove Volume Group: <filename>%1</filename>", device().name());
0042 }