Add initial support for LVM2 Physical Volumes.
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1327775
This commit is contained in:
parent
c0274efae9
commit
c2900760a1
|
@ -60,7 +60,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="fileSystemColorCode$(colorNumber)" type="Color">
|
<entry key="fileSystemColorCode$(colorNumber)" type="Color">
|
||||||
<label context="@label">File system colors</label>
|
<label context="@label">File system colors</label>
|
||||||
<parameter name="colorNumber" type="UInt" max="23"/>
|
<parameter name="colorNumber" type="UInt" max="24"/>
|
||||||
<!-- numbers correspond to the enum in fs/filesystem.h -->
|
<!-- numbers correspond to the enum in fs/filesystem.h -->
|
||||||
<default param="0">220,205,175</default> <!-- unknown -->
|
<default param="0">220,205,175</default> <!-- unknown -->
|
||||||
<default param="1">187,249,207</default> <!-- extended -->
|
<default param="1">187,249,207</default> <!-- extended -->
|
||||||
|
@ -86,6 +86,7 @@
|
||||||
<default param="21">33,137,108</default> <!-- zfs -->
|
<default param="21">33,137,108</default> <!-- zfs -->
|
||||||
<default param="22">250,230,255</default> <!-- exfat -->
|
<default param="22">250,230,255</default> <!-- exfat -->
|
||||||
<default param="23">242,155,104</default> <!-- nilfs2 -->
|
<default param="23">242,155,104</default> <!-- nilfs2 -->
|
||||||
|
<default param="24">160,210,180</default> <!-- lvm2 pv -->
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="showMenuBar" type="Bool">
|
<entry key="showMenuBar" type="Bool">
|
||||||
<label context="@label">Show the application's menu bar</label>
|
<label context="@label">Show the application's menu bar</label>
|
||||||
|
|
|
@ -483,7 +483,7 @@
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode21"/>
|
<widget class="KColorButton" name="kcfg_fileSystemColorCode21"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="textLabel_13">
|
<widget class="QLabel" name="textLabel_13">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>extended:</string>
|
<string>extended:</string>
|
||||||
|
@ -496,10 +496,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="9" column="1">
|
||||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode1"/>
|
<widget class="KColorButton" name="kcfg_fileSystemColorCode1"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="2">
|
<item row="9" column="2">
|
||||||
<spacer name="horizontalSpacer_12">
|
<spacer name="horizontalSpacer_12">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -512,7 +512,7 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="3">
|
<item row="9" column="3">
|
||||||
<widget class="QLabel" name="textLabel_17">
|
<widget class="QLabel" name="textLabel_17">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>unformatted:</string>
|
<string>unformatted:</string>
|
||||||
|
@ -525,10 +525,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="4">
|
<item row="9" column="4">
|
||||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode16"/>
|
<widget class="KColorButton" name="kcfg_fileSystemColorCode16"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="5">
|
<item row="9" column="5">
|
||||||
<spacer name="horizontalSpacer_11">
|
<spacer name="horizontalSpacer_11">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -541,7 +541,7 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="6">
|
<item row="9" column="6">
|
||||||
<widget class="QLabel" name="textLabel_16">
|
<widget class="QLabel" name="textLabel_16">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>unknown:</string>
|
<string>unknown:</string>
|
||||||
|
@ -554,10 +554,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="7">
|
<item row="9" column="7">
|
||||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode0"/>
|
<widget class="KColorButton" name="kcfg_fileSystemColorCode0"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="8">
|
<item row="8" column="0" colspan="8">
|
||||||
<widget class="Line" name="line">
|
<widget class="Line" name="line">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
@ -590,6 +590,48 @@
|
||||||
<item row="6" column="7">
|
<item row="6" column="7">
|
||||||
<widget class="KColorButton" name="kcfg_fileSystemColorCode23"/>
|
<widget class="KColorButton" name="kcfg_fileSystemColorCode23"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="2">
|
||||||
|
<spacer name="horizontalSpacer_13">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="5">
|
||||||
|
<spacer name="horizontalSpacer_14">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="textLabel_28">
|
||||||
|
<property name="text">
|
||||||
|
<string>lvm2 pv:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="KColorButton" name="kcfg_fileSystemColorCode24"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
@ -178,6 +178,19 @@ bool FileSystem::backup(Report& report, const Device& sourceDevice, const QStrin
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Removes a FileSystem
|
||||||
|
@param report Report to write status information to
|
||||||
|
@param deviceNode the device node for the Partition the FileSystem is on
|
||||||
|
@return true if FileSystem is removed
|
||||||
|
*/
|
||||||
|
bool FileSystem::remove(Report& report, const QString& deviceNode) const
|
||||||
|
{
|
||||||
|
Q_UNUSED(report);
|
||||||
|
Q_UNUSED(deviceNode);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/** Checks a FileSystem for errors
|
/** Checks a FileSystem for errors
|
||||||
@param report Report to write status information to
|
@param report Report to write status information to
|
||||||
@param deviceNode the device node for the Partition the FileSystem is on
|
@param deviceNode the device node for the Partition the FileSystem is on
|
||||||
|
@ -275,6 +288,7 @@ static const QString* typeNames()
|
||||||
i18nc("@item/plain filesystem name", "zfs"),
|
i18nc("@item/plain filesystem name", "zfs"),
|
||||||
i18nc("@item/plain filesystem name", "exfat"),
|
i18nc("@item/plain filesystem name", "exfat"),
|
||||||
i18nc("@item/plain filesystem name", "nilfs2"),
|
i18nc("@item/plain filesystem name", "nilfs2"),
|
||||||
|
i18nc("@item/plain filesystem name", "lvm2 pv"),
|
||||||
};
|
};
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
@ -80,8 +80,9 @@ class FileSystem
|
||||||
Zfs = 21,
|
Zfs = 21,
|
||||||
Exfat = 22,
|
Exfat = 22,
|
||||||
Nilfs2 = 23,
|
Nilfs2 = 23,
|
||||||
|
Lvm2_PV = 24,
|
||||||
|
|
||||||
__lastType = 24
|
__lastType = 25
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The type of support for a given FileSystem action */
|
/** The type of support for a given FileSystem action */
|
||||||
|
@ -110,6 +111,7 @@ class FileSystem
|
||||||
virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel);
|
virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel);
|
||||||
virtual bool copy(Report& report, const QString& targetDeviceNode, const QString& sourceDeviceNode) const;
|
virtual bool copy(Report& report, const QString& targetDeviceNode, const QString& sourceDeviceNode) const;
|
||||||
virtual bool backup(Report& report, const Device& sourceDevice, const QString& deviceNode, const QString& filename) const;
|
virtual bool backup(Report& report, const Device& sourceDevice, const QString& deviceNode, const QString& filename) const;
|
||||||
|
virtual bool remove(Report& report, const QString& deviceNode) const;
|
||||||
virtual bool check(Report& report, const QString& deviceNode) const;
|
virtual bool check(Report& report, const QString& deviceNode) const;
|
||||||
virtual bool updateUUID(Report& report, const QString& deviceNode) const;
|
virtual bool updateUUID(Report& report, const QString& deviceNode) const;
|
||||||
virtual QString readUUID(const QString& deviceNode) const;
|
virtual QString readUUID(const QString& deviceNode) const;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
#include "fs/jfs.h"
|
#include "fs/jfs.h"
|
||||||
#include "fs/linuxswap.h"
|
#include "fs/linuxswap.h"
|
||||||
#include "fs/luks.h"
|
#include "fs/luks.h"
|
||||||
|
#include "fs/lvm2_pv.h"
|
||||||
#include "fs/nilfs2.h"
|
#include "fs/nilfs2.h"
|
||||||
#include "fs/ntfs.h"
|
#include "fs/ntfs.h"
|
||||||
#include "fs/ocfs2.h"
|
#include "fs/ocfs2.h"
|
||||||
|
@ -70,6 +71,7 @@ void FileSystemFactory::init()
|
||||||
m_FileSystems.insert(FileSystem::Jfs, new FS::jfs(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Jfs, new FS::jfs(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::LinuxSwap, new FS::linuxswap(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::LinuxSwap, new FS::linuxswap(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Luks, new FS::luks(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Luks, new FS::luks(-1, -1, -1, QString()));
|
||||||
|
m_FileSystems.insert(FileSystem::Lvm2_PV, new FS::lvm2_pv(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Nilfs2, new FS::nilfs2(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Nilfs2, new FS::nilfs2(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Ntfs, new FS::ntfs(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Ntfs, new FS::ntfs(-1, -1, -1, QString()));
|
||||||
m_FileSystems.insert(FileSystem::Ocfs2, new FS::ocfs2(-1, -1, -1, QString()));
|
m_FileSystems.insert(FileSystem::Ocfs2, new FS::ocfs2(-1, -1, -1, QString()));
|
||||||
|
@ -95,6 +97,7 @@ void FileSystemFactory::init()
|
||||||
FS::jfs::init();
|
FS::jfs::init();
|
||||||
FS::linuxswap::init();
|
FS::linuxswap::init();
|
||||||
FS::luks::init();
|
FS::luks::init();
|
||||||
|
FS::lvm2_pv::init();
|
||||||
FS::nilfs2::init();
|
FS::nilfs2::init();
|
||||||
FS::ntfs::init();
|
FS::ntfs::init();
|
||||||
FS::ocfs2::init();
|
FS::ocfs2::init();
|
||||||
|
@ -137,6 +140,7 @@ FileSystem* FileSystemFactory::create(FileSystem::Type t, qint64 firstsector, qi
|
||||||
case FileSystem::Jfs: fs = new FS::jfs(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Jfs: fs = new FS::jfs(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::LinuxSwap: fs = new FS::linuxswap(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Luks: fs = new FS::luks(firstsector, lastsector, sectorsused, label); break;
|
||||||
|
case FileSystem::Lvm2_PV: fs = new FS::lvm2_pv(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::Nilfs2: fs = new FS::nilfs2(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Nilfs2: fs = new FS::nilfs2(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::Ntfs: fs = new FS::ntfs(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Ntfs: fs = new FS::ntfs(firstsector, lastsector, sectorsused, label); break;
|
||||||
case FileSystem::Ocfs2: fs = new FS::ocfs2(firstsector, lastsector, sectorsused, label); break;
|
case FileSystem::Ocfs2: fs = new FS::ocfs2(firstsector, lastsector, sectorsused, label); break;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "fs/lvm2_pv.h"
|
||||||
|
|
||||||
|
#include "util/externalcommand.h"
|
||||||
|
#include "util/capacity.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace FS
|
||||||
|
{
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_GetUsed = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_GetLabel = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_Create = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_Grow = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_Shrink = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_Move = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_Check = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_Copy = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_Backup = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_SetLabel = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_UpdateUUID = FileSystem::cmdSupportNone;
|
||||||
|
FileSystem::CommandSupportType lvm2_pv::m_GetUUID = FileSystem::cmdSupportNone;
|
||||||
|
|
||||||
|
lvm2_pv::lvm2_pv(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label) :
|
||||||
|
FileSystem(firstsector, lastsector, sectorsused, label, FileSystem::Lvm2_PV)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void lvm2_pv::init()
|
||||||
|
{
|
||||||
|
m_Create = findExternal("lvm") ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
|
m_Check = findExternal("lvm") ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
|
|
||||||
|
m_GetLabel = cmdSupportCore;
|
||||||
|
m_UpdateUUID = findExternal("lvm") ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
|
|
||||||
|
m_Copy = cmdSupportNone; // Copying PV can confuse LVM
|
||||||
|
m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
|
||||||
|
|
||||||
|
m_GetLabel = cmdSupportNone;
|
||||||
|
m_Backup = cmdSupportCore;
|
||||||
|
m_GetUUID = cmdSupportCore;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool lvm2_pv::supportToolFound() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
// m_GetUsed != cmdSupportNone &&
|
||||||
|
// m_GetLabel != cmdSupportNone &&
|
||||||
|
// m_SetLabel != cmdSupportNone &&
|
||||||
|
m_Create != cmdSupportNone &&
|
||||||
|
m_Check != cmdSupportNone &&
|
||||||
|
m_UpdateUUID != cmdSupportNone &&
|
||||||
|
// m_Grow != cmdSupportNone &&
|
||||||
|
// m_Shrink != cmdSupportNone &&
|
||||||
|
// m_Copy != cmdSupportNone &&
|
||||||
|
m_Move != cmdSupportNone &&
|
||||||
|
m_Backup != cmdSupportNone &&
|
||||||
|
m_GetUUID != cmdSupportNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystem::SupportTool lvm2_pv::supportToolName() const
|
||||||
|
{
|
||||||
|
return SupportTool("lvm2", KUrl("http://sourceware.org/lvm2/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 lvm2_pv::maxCapacity() const
|
||||||
|
{
|
||||||
|
return Capacity::unitFactor(Capacity::Byte, Capacity::EiB);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool lvm2_pv::check(Report& report, const QString& deviceNode) const
|
||||||
|
{
|
||||||
|
ExternalCommand cmd(report, "lvm", QStringList() << "pvck" << "-v" << deviceNode);
|
||||||
|
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool lvm2_pv::create(Report& report, const QString& deviceNode) const
|
||||||
|
{
|
||||||
|
ExternalCommand cmd(report, "lvm", QStringList() << "pvcreate" << deviceNode);
|
||||||
|
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool lvm2_pv::remove(Report& report, const QString& deviceNode) const
|
||||||
|
{
|
||||||
|
// TODO: check if PV is a member of an exported VG
|
||||||
|
ExternalCommand cmd(report, "lvm", QStringList() << "pvremove" << "-ffy" << deviceNode);
|
||||||
|
cmd.run(-1);
|
||||||
|
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool lvm2_pv::updateUUID(Report& report, const QString& deviceNode) const
|
||||||
|
{
|
||||||
|
ExternalCommand cmd(report, "lvm", QStringList() << "pvchange" << "-u" << deviceNode);
|
||||||
|
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(LVM2_PV__H)
|
||||||
|
|
||||||
|
#define LVM2_PV__H
|
||||||
|
|
||||||
|
#include "util/libpartitionmanagerexport.h"
|
||||||
|
|
||||||
|
#include "fs/filesystem.h"
|
||||||
|
|
||||||
|
#include <qglobal.h>
|
||||||
|
|
||||||
|
class Report;
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
|
||||||
|
namespace FS
|
||||||
|
{
|
||||||
|
/** LVM2 physical volume.
|
||||||
|
@author Andrius Štikonas <stikonas@gmail.com>
|
||||||
|
*/
|
||||||
|
class LIBPARTITIONMANAGERPRIVATE_EXPORT lvm2_pv : public FileSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
lvm2_pv(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QString& label);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void init();
|
||||||
|
|
||||||
|
// virtual qint64 readUsedCapacity(const QString& deviceNode) const;
|
||||||
|
virtual bool check(Report& report, const QString& deviceNode) const;
|
||||||
|
virtual bool create(Report& report, const QString& deviceNode) const;
|
||||||
|
virtual bool remove(Report& report, const QString& deviceNode) const;
|
||||||
|
// virtual bool resize(Report& report, const QString& deviceNode, qint64 length) const;
|
||||||
|
// virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel);
|
||||||
|
virtual bool updateUUID(Report& report, const QString& deviceNode) const;
|
||||||
|
|
||||||
|
virtual CommandSupportType supportGetUsed() const { return m_GetUsed; }
|
||||||
|
virtual CommandSupportType supportGetLabel() const { return m_GetLabel; }
|
||||||
|
virtual CommandSupportType supportCreate() const { return m_Create; }
|
||||||
|
virtual CommandSupportType supportGrow() const { return m_Grow; }
|
||||||
|
virtual CommandSupportType supportShrink() const { return m_Shrink; }
|
||||||
|
virtual CommandSupportType supportMove() const { return m_Move; }
|
||||||
|
virtual CommandSupportType supportCheck() const { return m_Check; }
|
||||||
|
virtual CommandSupportType supportCopy() const { return m_Copy; }
|
||||||
|
virtual CommandSupportType supportBackup() const { return m_Backup; }
|
||||||
|
virtual CommandSupportType supportSetLabel() const { return m_SetLabel; }
|
||||||
|
virtual CommandSupportType supportUpdateUUID() const { return m_UpdateUUID; }
|
||||||
|
virtual CommandSupportType supportGetUUID() const { return m_GetUUID; }
|
||||||
|
|
||||||
|
// virtual qint64 minCapacity() const;
|
||||||
|
virtual qint64 maxCapacity() const;
|
||||||
|
virtual SupportTool supportToolName() const;
|
||||||
|
virtual bool supportToolFound() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static CommandSupportType m_GetUsed;
|
||||||
|
static CommandSupportType m_GetLabel;
|
||||||
|
static CommandSupportType m_Create;
|
||||||
|
static CommandSupportType m_Grow;
|
||||||
|
static CommandSupportType m_Shrink;
|
||||||
|
static CommandSupportType m_Move;
|
||||||
|
static CommandSupportType m_Check;
|
||||||
|
static CommandSupportType m_Copy;
|
||||||
|
static CommandSupportType m_Backup;
|
||||||
|
static CommandSupportType m_SetLabel;
|
||||||
|
static CommandSupportType m_UpdateUUID;
|
||||||
|
static CommandSupportType m_GetUUID;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2010 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
|
* Copyright (C) 2012 by Volker Lanz <vl@fidra.de> *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
@ -61,6 +61,12 @@ bool DeleteFileSystemJob::run(Report& parent)
|
||||||
rval = true;
|
rval = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!partition().fileSystem().remove(*report, partition().deviceNode()))
|
||||||
|
{
|
||||||
|
jobFinished(*report, rval);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
CoreBackendDevice* backendDevice = CoreBackendManager::self()->backend()->openDevice(device().deviceNode());
|
CoreBackendDevice* backendDevice = CoreBackendManager::self()->backend()->openDevice(device().deviceNode());
|
||||||
|
|
||||||
if (backendDevice)
|
if (backendDevice)
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "jobs/createpartitionjob.h"
|
#include "jobs/createpartitionjob.h"
|
||||||
#include "jobs/createfilesystemjob.h"
|
#include "jobs/createfilesystemjob.h"
|
||||||
#include "jobs/setfilesystemlabeljob.h"
|
#include "jobs/setfilesystemlabeljob.h"
|
||||||
|
#include "jobs/setpartflagsjob.h"
|
||||||
#include "jobs/checkfilesystemjob.h"
|
#include "jobs/checkfilesystemjob.h"
|
||||||
|
|
||||||
#include "fs/filesystem.h"
|
#include "fs/filesystem.h"
|
||||||
|
@ -48,6 +49,7 @@ NewOperation::NewOperation(Device& d, Partition* p) :
|
||||||
m_NewPartition(p),
|
m_NewPartition(p),
|
||||||
m_CreatePartitionJob(new CreatePartitionJob(targetDevice(), newPartition())),
|
m_CreatePartitionJob(new CreatePartitionJob(targetDevice(), newPartition())),
|
||||||
m_CreateFileSystemJob(NULL),
|
m_CreateFileSystemJob(NULL),
|
||||||
|
m_SetPartFlagsJob(NULL),
|
||||||
m_SetFileSystemLabelJob(NULL),
|
m_SetFileSystemLabelJob(NULL),
|
||||||
m_CheckFileSystemJob(NULL)
|
m_CheckFileSystemJob(NULL)
|
||||||
{
|
{
|
||||||
|
@ -66,6 +68,12 @@ NewOperation::NewOperation(Device& d, Partition* p) :
|
||||||
m_CreateFileSystemJob = new CreateFileSystemJob(targetDevice(), newPartition());
|
m_CreateFileSystemJob = new CreateFileSystemJob(targetDevice(), newPartition());
|
||||||
addJob(createFileSystemJob());
|
addJob(createFileSystemJob());
|
||||||
|
|
||||||
|
if (fs.type() == FileSystem::Lvm2_PV)
|
||||||
|
{
|
||||||
|
m_SetPartFlagsJob = new SetPartFlagsJob(targetDevice(), newPartition(), PartitionTable::FlagLvm);
|
||||||
|
addJob(setPartFlagsJob());
|
||||||
|
}
|
||||||
|
|
||||||
m_SetFileSystemLabelJob = new SetFileSystemLabelJob(newPartition(), fs.label());
|
m_SetFileSystemLabelJob = new SetFileSystemLabelJob(newPartition(), fs.label());
|
||||||
addJob(setLabelJob());
|
addJob(setLabelJob());
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ class OperationStack;
|
||||||
class CreatePartitionJob;
|
class CreatePartitionJob;
|
||||||
class CreateFileSystemJob;
|
class CreateFileSystemJob;
|
||||||
class SetFileSystemLabelJob;
|
class SetFileSystemLabelJob;
|
||||||
|
class SetPartFlagsJob;
|
||||||
class CheckFileSystemJob;
|
class CheckFileSystemJob;
|
||||||
|
|
||||||
/** Create a Partition.
|
/** Create a Partition.
|
||||||
|
@ -71,6 +72,7 @@ class NewOperation : public Operation
|
||||||
|
|
||||||
CreatePartitionJob* createPartitionJob() { return m_CreatePartitionJob; }
|
CreatePartitionJob* createPartitionJob() { return m_CreatePartitionJob; }
|
||||||
CreateFileSystemJob* createFileSystemJob() { return m_CreateFileSystemJob; }
|
CreateFileSystemJob* createFileSystemJob() { return m_CreateFileSystemJob; }
|
||||||
|
SetPartFlagsJob* setPartFlagsJob() { return m_SetPartFlagsJob; }
|
||||||
SetFileSystemLabelJob* setLabelJob() { return m_SetFileSystemLabelJob; }
|
SetFileSystemLabelJob* setLabelJob() { return m_SetFileSystemLabelJob; }
|
||||||
CheckFileSystemJob* checkJob() { return m_CheckFileSystemJob; }
|
CheckFileSystemJob* checkJob() { return m_CheckFileSystemJob; }
|
||||||
|
|
||||||
|
@ -79,6 +81,7 @@ class NewOperation : public Operation
|
||||||
Partition* m_NewPartition;
|
Partition* m_NewPartition;
|
||||||
CreatePartitionJob* m_CreatePartitionJob;
|
CreatePartitionJob* m_CreatePartitionJob;
|
||||||
CreateFileSystemJob* m_CreateFileSystemJob;
|
CreateFileSystemJob* m_CreateFileSystemJob;
|
||||||
|
SetPartFlagsJob* m_SetPartFlagsJob;
|
||||||
SetFileSystemLabelJob* m_SetFileSystemLabelJob;
|
SetFileSystemLabelJob* m_SetFileSystemLabelJob;
|
||||||
CheckFileSystemJob* m_CheckFileSystemJob;
|
CheckFileSystemJob* m_CheckFileSystemJob;
|
||||||
};
|
};
|
||||||
|
|
|
@ -554,6 +554,7 @@ FileSystem::Type LibPartedBackend::detectFileSystem(PedPartition* pedPartition)
|
||||||
else if (s == "crypto_LUKS") rval = FileSystem::Luks;
|
else if (s == "crypto_LUKS") rval = FileSystem::Luks;
|
||||||
else if (s == "exfat") rval = FileSystem::Exfat;
|
else if (s == "exfat") rval = FileSystem::Exfat;
|
||||||
else if (s == "nilfs2") rval = FileSystem::Nilfs2;
|
else if (s == "nilfs2") rval = FileSystem::Nilfs2;
|
||||||
|
else if (s == "LVM2_member") rval = FileSystem::Lvm2_PV;
|
||||||
else
|
else
|
||||||
kWarning() << "blkid: unknown file system type " << s << " on " << pedPath;
|
kWarning() << "blkid: unknown file system type " << s << " on " << pedPath;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue