summaryrefslogtreecommitdiffstats
path: root/config-db/OpenSLX
diff options
context:
space:
mode:
authorOliver Tappe2007-03-15 22:41:10 +0100
committerOliver Tappe2007-03-15 22:41:10 +0100
commit03db5fcadee81bd5ce66665f18b611e106783c27 (patch)
tree1071ff956228157c52fbd5b5087ca8928b37d0f9 /config-db/OpenSLX
parent* removed 'nbd' from supported export types as I have learned from Dirk yeste... (diff)
downloadcore-03db5fcadee81bd5ce66665f18b611e106783c27.tar.gz
core-03db5fcadee81bd5ce66665f18b611e106783c27.tar.xz
core-03db5fcadee81bd5ce66665f18b611e106783c27.zip
* largish overhaul, changed ConfigDB to be object-oriented (could be improved, though!)
* slxos-setup, slxos-export, slxconfig and slxconfig-demuxer can now be run one after the other in order to get a complete setup * still problems when trying to boot that system here, need to investigate... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@774 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/OpenSLX')
-rw-r--r--config-db/OpenSLX/ConfigDB.pm514
-rw-r--r--config-db/OpenSLX/DBSchema.pm77
-rw-r--r--config-db/OpenSLX/MetaDB/Base.pm256
-rw-r--r--config-db/OpenSLX/MetaDB/CSV.pm2
-rw-r--r--config-db/OpenSLX/MetaDB/DBI.pm136
-rw-r--r--config-db/OpenSLX/MetaDB/SQLite.pm2
-rw-r--r--config-db/OpenSLX/MetaDB/mysql.pm2
7 files changed, 473 insertions, 516 deletions
diff --git a/config-db/OpenSLX/ConfigDB.pm b/config-db/OpenSLX/ConfigDB.pm
index fce953b6..b3606e9d 100644
--- a/config-db/OpenSLX/ConfigDB.pm
+++ b/config-db/OpenSLX/ConfigDB.pm
@@ -23,60 +23,20 @@ $VERSION = 1.01; # API-version . implementation-version
### - data aggregation methods (combining data in ways useful for apps)
### - support methods
################################################################################
+
use Exporter;
@ISA = qw(Exporter);
-my @accessExports = qw(
- connectConfigDB disconnectConfigDB
- fetchVendorOSesByFilter fetchVendorOSesByID fetchVendorOSIDsOfSystem
- fetchSystemsByFilter fetchSystemsByID fetchSystemIDsOfClient
- fetchSystemIDsOfGroup
- fetchSystemsVariantByFilter fetchSystemVariantsByID
- fetchSystemVariantIDsOfSystem
- fetchClientsByFilter fetchClientsByID fetchClientIDsOfSystem
- fetchClientIDsOfGroup
- fetchGroupsByFilter fetchGroupsByID fetchGroupIDsOfClient
- fetchGroupIDsOfSystem
- fetchSettings
-);
-
-my @manipulationExports = qw(
- addVendorOS removeVendorOS changeVendorOS
- addSystem removeSystem changeSystem
- setClientIDsOfSystem addClientIDsToSystem removeClientIDsFromSystem
- setGroupIDsOfSystem addGroupIDsToSystem removeGroupIDsFromSystem
- addSystemVariant removeSystemVariant changeSystemVariant
- removeSystemVariantIDsFromSystem
- addClient removeClient changeClient
- setSystemIDsOfClient addSystemIDsToClient removeSystemIDsFromClient
- setGroupIDsOfClient addGroupIDsToClient removeGroupIDsFromClient
- addGroup removeGroup changeGroup
- setClientIDsOfGroup addClientIDsToGroup removeClientIDsFromGroup
- setSystemIDsOfGroup addSystemIDsToGroup removeSystemIDsFromGroup
- changeSettings
- emptyDatabase
-);
-
-my @aggregationExports = qw(
- mergeDefaultAttributesIntoSystem
- mergeDefaultAndGroupAttributesIntoClient
- aggregatedSystemIDsOfClient aggregatedClientIDsOfSystem
- aggregatedSystemFileInfosOfSystem
-);
-
my @supportExports = qw(
- isAttribute mergeAttributes
- externalIDForSystem externalIDForClient
- externalAttrName generatePlaceholderFor
+ isAttribute mergeAttributes
+ externalIDForSystem externalIDForClient
+ externalAttrName generatePlaceholderFor
);
-@EXPORT = @accessExports;
-@EXPORT_OK = (@manipulationExports, @aggregationExports, @supportExports);
+@EXPORT = ();
+@EXPORT_OK = (@supportExports);
%EXPORT_TAGS = (
- 'access' => [ @accessExports ],
- 'manipulation' => [ @manipulationExports ],
- 'aggregation' => [ @aggregationExports ],
- 'support' => [ @supportExports ],
+ 'support' => [ @supportExports ],
);
################################################################################
@@ -167,8 +127,16 @@ sub _uniqueByKey
################################################################################
### data access interface
################################################################################
-sub connectConfigDB
+sub new
{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub connect
+{
+ my $self = shift;
my $dbParams = shift;
# hash-ref with any additional info that might be required by
# specific metadb-module (not used yet)
@@ -189,204 +157,198 @@ sub connectConfigDB
confess _tr('Could not load module <%s> (Version <%s> required, but <%s> found)',
$dbModule, $VERSION, $modVersion);
}
- $dbModule->import;
-
my $metaDB = $dbModule->new();
- $metaDB->connectConfigDB($dbParams);
- my $confDB = {
- 'db-type' => $dbType,
- 'meta-db' => $metaDB,
- };
+ $metaDB->connect($dbParams);
+ $self->{'db-type'} = $dbType;
+ $self->{'meta-db'} = $metaDB;
foreach my $tk (keys %{$DbSchema->{tables}}) {
$metaDB->schemaDeclareTable($tk, $DbSchema->{tables}->{$tk});
}
_checkAndUpgradeDBSchemaIfNecessary($metaDB);
-
- return $confDB;
}
-sub disconnectConfigDB
+sub disconnect
{
- my $confDB = shift;
+ my $self = shift;
- $confDB->{'meta-db'}->disconnectConfigDB();
+ $self->{'meta-db'}->disconnect();
}
-sub fetchVendorOSesByFilter
+sub fetchVendorOSByFilter
{
- my $confDB = shift;
+ my $self = shift;
my $filter = shift;
my $resultCols = shift;
- my @vendorOSes
- = $confDB->{'meta-db'}->fetchVendorOSesByFilter($filter, $resultCols);
- return wantarray() ? @vendorOSes : shift @vendorOSes;
+ my @vendorOS
+ = $self->{'meta-db'}->fetchVendorOSByFilter($filter, $resultCols);
+ return wantarray() ? @vendorOS : shift @vendorOS;
}
-sub fetchVendorOSesByID
+sub fetchVendorOSByID
{
- my $confDB = shift;
+ my $self = shift;
my $ids = _aref(shift);
my $resultCols = shift;
- my @vendorOSes
- = $confDB->{'meta-db'}->fetchVendorOSesByID($ids, $resultCols);
- return wantarray() ? @vendorOSes : shift @vendorOSes;
+ my @vendorOS
+ = $self->{'meta-db'}->fetchVendorOSByID($ids, $resultCols);
+ return wantarray() ? @vendorOS : shift @vendorOS;
}
-sub fetchSystemsByFilter
+sub fetchExportByFilter
{
- my $confDB = shift;
+ my $self = shift;
my $filter = shift;
my $resultCols = shift;
- my @systems
- = $confDB->{'meta-db'}->fetchSystemsByFilter($filter, $resultCols);
- return wantarray() ? @systems : shift @systems;
+ my @exports
+ = $self->{'meta-db'}->fetchExportByFilter($filter, $resultCols);
+ return wantarray() ? @exports : shift @exports;
}
-sub fetchSystemsByID
+sub fetchExportByID
{
- my $confDB = shift;
+ my $self = shift;
my $ids = _aref(shift);
my $resultCols = shift;
- my @systems = $confDB->{'meta-db'}->fetchSystemsByID($ids, $resultCols);
- return wantarray() ? @systems : shift @systems;
+ my @exports
+ = $self->{'meta-db'}->fetchExportByID($ids, $resultCols);
+ return wantarray() ? @exports : shift @exports;
}
-sub fetchSystemIDsOfVendorOS
+sub fetchExportIDsOfVendorOS
{
- my $confDB = shift;
+ my $self = shift;
my $vendorOSID = shift;
- return $confDB->{'meta-db'}->fetchSystemIDsOfVendorOS($vendorOSID);
+ return $self->{'meta-db'}->fetchExportIDsOfVendorOS($vendorOSID);
}
-sub fetchSystemIDsOfClient
+sub fetchSystemByFilter
{
- my $confDB = shift;
- my $clientID = shift;
+ my $self = shift;
+ my $filter = shift;
+ my $resultCols = shift;
- return $confDB->{'meta-db'}->fetchSystemIDsOfClient($clientID);
+ my @systems
+ = $self->{'meta-db'}->fetchSystemByFilter($filter, $resultCols);
+ return wantarray() ? @systems : shift @systems;
}
-sub fetchSystemIDsOfGroup
+sub fetchSystemByID
{
- my $confDB = shift;
- my $groupID = shift;
+ my $self = shift;
+ my $ids = _aref(shift);
+ my $resultCols = shift;
- return $confDB->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
+ my @systems = $self->{'meta-db'}->fetchSystemByID($ids, $resultCols);
+ return wantarray() ? @systems : shift @systems;
}
-sub fetchSystemVariantsByFilter
+sub fetchSystemIDsOfExport
{
- my $confDB = shift;
- my $filter = shift;
- my $resultCols = shift;
+ my $self = shift;
+ my $exportID = shift;
- my @systemVariants
- = $confDB->{'meta-db'}->fetchSystemVariantsByFilter($filter, $resultCols);
- return wantarray() ? @systemVariants : shift @systemVariants;
+ return $self->{'meta-db'}->fetchSystemIDsOfExport($exportID);
}
-sub fetchSystemVariantsByID
+sub fetchSystemIDsOfClient
{
- my $confDB = shift;
- my $ids = _aref(shift);
- my $resultCols = shift;
+ my $self = shift;
+ my $clientID = shift;
- my @systemVariants
- = $confDB->{'meta-db'}->fetchSystemVariantsByID($ids, $resultCols);
- return wantarray() ? @systemVariants : shift @systemVariants;
+ return $self->{'meta-db'}->fetchSystemIDsOfClient($clientID);
}
-sub fetchSystemVariantIDsOfSystem
+sub fetchSystemIDsOfGroup
{
- my $confDB = shift;
- my $systemID = shift;
+ my $self = shift;
+ my $groupID = shift;
- return $confDB->{'meta-db'}->fetchSystemVariantIDsOfSystem($systemID);
+ return $self->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
}
-sub fetchClientsByFilter
+sub fetchClientByFilter
{
- my $confDB = shift;
+ my $self = shift;
my $filter = shift;
- my @clients = $confDB->{'meta-db'}->fetchClientsByFilter($filter);
+ my @clients = $self->{'meta-db'}->fetchClientByFilter($filter);
return wantarray() ? @clients : shift @clients;
}
-sub fetchClientsByID
+sub fetchClientByID
{
- my $confDB = shift;
+ my $self = shift;
my $ids = _aref(shift);
my $resultCols = shift;
- my @clients = $confDB->{'meta-db'}->fetchClientsByID($ids, $resultCols);
+ my @clients = $self->{'meta-db'}->fetchClientByID($ids, $resultCols);
return wantarray() ? @clients : shift @clients;
}
sub fetchClientIDsOfSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
- return $confDB->{'meta-db'}->fetchClientIDsOfSystem($systemID);
+ return $self->{'meta-db'}->fetchClientIDsOfSystem($systemID);
}
sub fetchClientIDsOfGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
- return $confDB->{'meta-db'}->fetchClientIDsOfGroup($groupID);
+ return $self->{'meta-db'}->fetchClientIDsOfGroup($groupID);
}
-sub fetchGroupsByFilter
+sub fetchGroupByFilter
{
- my $confDB = shift;
+ my $self = shift;
my $filter = shift;
my $resultCols = shift;
my @groups
- = $confDB->{'meta-db'}->fetchGroupsByFilter($filter, $resultCols);
+ = $self->{'meta-db'}->fetchGroupByFilter($filter, $resultCols);
return wantarray() ? @groups : shift @groups;
}
-sub fetchGroupsByID
+sub fetchGroupByID
{
- my $confDB = shift;
+ my $self = shift;
my $ids = _aref(shift);
my $resultCols = shift;
- my @groups = $confDB->{'meta-db'}->fetchGroupsByID($ids, $resultCols);
+ my @groups = $self->{'meta-db'}->fetchGroupByID($ids, $resultCols);
return wantarray() ? @groups : shift @groups;
}
sub fetchGroupIDsOfSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
- return $confDB->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
+ return $self->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
}
sub fetchGroupIDsOfClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
- return $confDB->{'meta-db'}->fetchGroupIDsOfClient($clientID);
+ return $self->{'meta-db'}->fetchGroupIDsOfClient($clientID);
}
sub fetchSettings
{
- my $confDB = shift;
+ my $self = shift;
- my @rows = $confDB->{'meta-db'}->fetchSettings();
+ my @rows = $self->{'meta-db'}->fetchSettings();
return shift @rows;
}
@@ -395,84 +357,109 @@ sub fetchSettings
################################################################################
sub addVendorOS
{
- my $confDB = shift;
+ my $self = shift;
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->addVendorOS($valRows);
+ return $self->{'meta-db'}->addVendorOS($valRows);
}
sub removeVendorOS
{
- my $confDB = shift;
+ my $self = shift;
my $vendorOSIDs = _aref(shift);
- return $confDB->{'meta-db'}->removeVendorOS($vendorOSIDs);
+ return $self->{'meta-db'}->removeVendorOS($vendorOSIDs);
}
sub changeVendorOS
{
- my $confDB = shift;
+ my $self = shift;
my $vendorOSIDs = _aref(shift);
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->changeVendorOS($vendorOSIDs, $valRows);
+ return $self->{'meta-db'}->changeVendorOS($vendorOSIDs, $valRows);
+}
+
+sub addExport
+{
+ my $self = shift;
+ my $valRows = _aref(shift);
+
+ return $self->{'meta-db'}->addExport($valRows);
+}
+
+sub removeExport
+{
+ my $self = shift;
+ my $exportIDs = _aref(shift);
+
+ return $self->{'meta-db'}->removeExport($exportIDs);
+}
+
+sub changeExport
+{
+ my $self = shift;
+ my $exportIDs = _aref(shift);
+ my $valRows = _aref(shift);
+
+ return $self->{'meta-db'}->changeExport($exportIDs, $valRows);
}
sub addSystem
{
- my $confDB = shift;
+ my $self = shift;
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->addSystem($valRows);
+ return $self->{'meta-db'}->addSystem($valRows);
}
sub removeSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemIDs = _aref(shift);
foreach my $system (@$systemIDs) {
- setGroupIDsOfSystem($confDB, $system);
- setClientIDsOfSystem($confDB, $system);
+ $self->setGroupIDsOfSystem($system);
+ $self->setClientIDsOfSystem($system);
}
- return $confDB->{'meta-db'}->removeSystem($systemIDs);
+ return $self->{'meta-db'}->removeSystem($systemIDs);
}
sub changeSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemIDs = _aref(shift);
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->changeSystem($systemIDs, $valRows);
+ return $self->{'meta-db'}->changeSystem($systemIDs, $valRows);
}
sub setClientIDsOfSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $clientIDs = _aref(shift);
my @uniqueClientIDs = _unique(@$clientIDs);
- return $confDB->{'meta-db'}->setClientIDsOfSystem($systemID,
+ return $self->{'meta-db'}->setClientIDsOfSystem($systemID,
\@uniqueClientIDs);
}
sub addClientIDsToSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $newClientIDs = _aref(shift);
- my @clientIDs = $confDB->{'meta-db'}->fetchClientIDsOfSystem($systemID);
+ my @clientIDs = $self->{'meta-db'}->fetchClientIDsOfSystem($systemID);
push @clientIDs, @$newClientIDs;
- return setClientIDsOfSystem($confDB, $systemID, \@clientIDs);
+ return $self->setClientIDsOfSystem($systemID, \@clientIDs);
}
sub removeClientIDsFromSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $removedClientIDs = _aref(shift);
@@ -480,35 +467,35 @@ sub removeClientIDsFromSystem
@toBeRemoved{@$removedClientIDs} = ();
my @clientIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchClientIDsOfSystem($systemID);
- return setClientIDsOfSystem($confDB, $systemID, \@clientIDs);
+ $self->{'meta-db'}->fetchClientIDsOfSystem($systemID);
+ return $self->setClientIDsOfSystem($systemID, \@clientIDs);
}
sub setGroupIDsOfSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $groupIDs = _aref(shift);
my @uniqueGroupIDs = _unique(@$groupIDs);
- return $confDB->{'meta-db'}->setGroupIDsOfSystem($systemID,
+ return $self->{'meta-db'}->setGroupIDsOfSystem($systemID,
\@uniqueGroupIDs);
}
sub addGroupIDsToSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $newGroupIDs = _aref(shift);
- my @groupIDs = $confDB->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
+ my @groupIDs = $self->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
push @groupIDs, @$newGroupIDs;
- return setGroupIDsOfSystem($confDB, $systemID, \@groupIDs);
+ return $self->setGroupIDsOfSystem($systemID, \@groupIDs);
}
sub removeGroupIDsFromSystem
{
- my $confDB = shift;
+ my $self = shift;
my $systemID = shift;
my $toBeRemovedGroupIDs = _aref(shift);
@@ -516,90 +503,65 @@ sub removeGroupIDsFromSystem
@toBeRemoved{@$toBeRemovedGroupIDs} = ();
my @groupIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
- return setGroupIDsOfSystem($confDB, $systemID, \@groupIDs);
-}
-
-sub addSystemVariant
-{
- my $confDB = shift;
- my $valRows = _aref(shift);
-
- return $confDB->{'meta-db'}->addSystemVariant($valRows);
-}
-
-sub removeSystemVariant
-{
- my $confDB = shift;
- my $systemVariantIDs = _aref(shift);
-
- return $confDB->{'meta-db'}->removeSystemVariant($systemVariantIDs);
-}
-
-sub changeSystemVariant
-{
- my $confDB = shift;
- my $systemVariantIDs = _aref(shift);
- my $valRows = _aref(shift);
-
- return $confDB->{'meta-db'}->changeSystemVariant($systemVariantIDs, $valRows);
+ $self->{'meta-db'}->fetchGroupIDsOfSystem($systemID);
+ return $self->setGroupIDsOfSystem($systemID, \@groupIDs);
}
sub addClient
{
- my $confDB = shift;
+ my $self = shift;
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->addClient($valRows);
+ return $self->{'meta-db'}->addClient($valRows);
}
sub removeClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientIDs = _aref(shift);
foreach my $client (@$clientIDs) {
- setGroupIDsOfClient($confDB, $client);
- setSystemIDsOfClient($confDB, $client);
+ $self->setGroupIDsOfClient($client);
+ $self->setSystemIDsOfClient($client);
}
- return $confDB->{'meta-db'}->removeClient($clientIDs);
+ return $self->{'meta-db'}->removeClient($clientIDs);
}
sub changeClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientIDs = _aref(shift);
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->changeClient($clientIDs, $valRows);
+ return $self->{'meta-db'}->changeClient($clientIDs, $valRows);
}
sub setSystemIDsOfClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $systemIDs = _aref(shift);
my @uniqueSystemIDs = _unique(@$systemIDs);
- return $confDB->{'meta-db'}->setSystemIDsOfClient($clientID,
+ return $self->{'meta-db'}->setSystemIDsOfClient($clientID,
\@uniqueSystemIDs);
}
sub addSystemIDsToClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $newSystemIDs = _aref(shift);
- my @systemIDs = $confDB->{'meta-db'}->fetchSystemIDsOfClient($clientID);
+ my @systemIDs = $self->{'meta-db'}->fetchSystemIDsOfClient($clientID);
push @systemIDs, @$newSystemIDs;
- return setSystemIDsOfClient($confDB, $clientID, \@systemIDs);
+ return $self->setSystemIDsOfClient($clientID, \@systemIDs);
}
sub removeSystemIDsFromClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $removedSystemIDs = _aref(shift);
@@ -607,35 +569,35 @@ sub removeSystemIDsFromClient
@toBeRemoved{@$removedSystemIDs} = ();
my @systemIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchSystemIDsOfClient($clientID);
- return setSystemIDsOfClient($confDB, $clientID, \@systemIDs);
+ $self->{'meta-db'}->fetchSystemIDsOfClient($clientID);
+ return $self->setSystemIDsOfClient($clientID, \@systemIDs);
}
sub setGroupIDsOfClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $groupIDs = _aref(shift);
my @uniqueGroupIDs = _unique(@$groupIDs);
- return $confDB->{'meta-db'}->setGroupIDsOfClient($clientID,
+ return $self->{'meta-db'}->setGroupIDsOfClient($clientID,
\@uniqueGroupIDs);
}
sub addGroupIDsToClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $newGroupIDs = _aref(shift);
- my @groupIDs = $confDB->{'meta-db'}->fetchGroupIDsOfClient($clientID);
+ my @groupIDs = $self->{'meta-db'}->fetchGroupIDsOfClient($clientID);
push @groupIDs, @$newGroupIDs;
- return setGroupIDsOfClient($confDB, $clientID, \@groupIDs);
+ return $self->setGroupIDsOfClient($clientID, \@groupIDs);
}
sub removeGroupIDsFromClient
{
- my $confDB = shift;
+ my $self = shift;
my $clientID = shift;
my $toBeRemovedGroupIDs = _aref(shift);
@@ -643,65 +605,65 @@ sub removeGroupIDsFromClient
@toBeRemoved{@$toBeRemovedGroupIDs} = ();
my @groupIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchGroupIDsOfClient($clientID);
- return setGroupIDsOfClient($confDB, $clientID, \@groupIDs);
+ $self->{'meta-db'}->fetchGroupIDsOfClient($clientID);
+ return $self->setGroupIDsOfClient($clientID, \@groupIDs);
}
sub addGroup
{
- my $confDB = shift;
+ my $self = shift;
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->addGroup($valRows);
+ return $self->{'meta-db'}->addGroup($valRows);
}
sub removeGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupIDs = _aref(shift);
foreach my $group (@$groupIDs) {
- setSystemIDsOfGroup($confDB, $group, []);
- setClientIDsOfGroup($confDB, $group, []);
+ $self->setSystemIDsOfGroup($group, []);
+ $self->setClientIDsOfGroup($group, []);
}
- return $confDB->{'meta-db'}->removeGroup($groupIDs);
+ return $self->{'meta-db'}->removeGroup($groupIDs);
}
sub changeGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupIDs = _aref(shift);
my $valRows = _aref(shift);
- return $confDB->{'meta-db'}->changeGroup($groupIDs, $valRows);
+ return $self->{'meta-db'}->changeGroup($groupIDs, $valRows);
}
sub setClientIDsOfGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $clientIDs = _aref(shift);
my @uniqueClientIDs = _unique(@$clientIDs);
- return $confDB->{'meta-db'}->setClientIDsOfGroup($groupID,
+ return $self->{'meta-db'}->setClientIDsOfGroup($groupID,
\@uniqueClientIDs);
}
sub addClientIDsToGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $newClientIDs = _aref(shift);
- my @clientIDs = $confDB->{'meta-db'}->fetchClientIDsOfGroup($groupID);
+ my @clientIDs = $self->{'meta-db'}->fetchClientIDsOfGroup($groupID);
push @clientIDs, @$newClientIDs;
- return setClientIDsOfGroup($confDB, $groupID, \@clientIDs);
+ return $self->setClientIDsOfGroup($groupID, \@clientIDs);
}
sub removeClientIDsFromGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $removedClientIDs = _aref(shift);
@@ -709,35 +671,35 @@ sub removeClientIDsFromGroup
@toBeRemoved{@$removedClientIDs} = ();
my @clientIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchClientIDsOfGroup($groupID);
- return setClientIDsOfGroup($confDB, $groupID, \@clientIDs);
+ $self->{'meta-db'}->fetchClientIDsOfGroup($groupID);
+ return $self->setClientIDsOfGroup($groupID, \@clientIDs);
}
sub setSystemIDsOfGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $systemIDs = _aref(shift);
my @uniqueSystemIDs = _unique(@$systemIDs);
- return $confDB->{'meta-db'}->setSystemIDsOfGroup($groupID,
+ return $self->{'meta-db'}->setSystemIDsOfGroup($groupID,
\@uniqueSystemIDs);
}
sub addSystemIDsToGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $newSystemIDs = _aref(shift);
- my @systemIDs = $confDB->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
+ my @systemIDs = $self->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
push @systemIDs, @$newSystemIDs;
- return setSystemIDsOfGroup($confDB, $groupID, \@systemIDs);
+ return $self->setSystemIDsOfGroup($groupID, \@systemIDs);
}
sub removeSystemIDsFromGroup
{
- my $confDB = shift;
+ my $self = shift;
my $groupID = shift;
my $removedSystemIDs = _aref(shift);
@@ -745,50 +707,50 @@ sub removeSystemIDsFromGroup
@toBeRemoved{@$removedSystemIDs} = ();
my @systemIDs
= grep { !exists $toBeRemoved{$_} }
- $confDB->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
- return setSystemIDsOfGroup($confDB, $groupID, \@systemIDs);
+ $self->{'meta-db'}->fetchSystemIDsOfGroup($groupID);
+ return $self->setSystemIDsOfGroup($groupID, \@systemIDs);
}
sub emptyDatabase
{ # clears all user-data from the database
- my $confDB = shift;
+ my $self = shift;
my @groupIDs
= map { $_->{id} }
- fetchGroupsByFilter($confDB);
- removeGroup($confDB, \@groupIDs);
+ $self->fetchGroupByFilter();
+ $self->removeGroup(\@groupIDs);
my @clientIDs
= map { $_->{id} }
grep { $_->{id} > 0 }
- fetchClientsByFilter($confDB);
- removeClient($confDB, \@clientIDs);
+ $self->fetchClientByFilter();
+ $self->removeClient(\@clientIDs);
- my @sysVarIDs
+ my @sysIDs
= map { $_->{id} }
grep { $_->{id} > 0 }
- fetchSystemVariantsByFilter($confDB);
- removeSystemVariant($confDB, \@sysVarIDs);
+ $self->fetchSystemByFilter();
+ $self->removeSystem(\@sysIDs);
- my @sysIDs
+ my @exportIDs
= map { $_->{id} }
grep { $_->{id} > 0 }
- fetchSystemsByFilter($confDB);
- removeSystem($confDB, \@sysIDs);
+ $self->fetchExportByFilter();
+ $self->removeExport(\@exportIDs);
my @vendorOSIDs
= map { $_->{id} }
grep { $_->{id} > 0 }
- fetchVendorOSesByFilter($confDB);
- removeVendorOS($confDB, \@vendorOSIDs);
+ $self->fetchVendorOSByFilter();
+ $self->removeVendorOS(\@vendorOSIDs);
}
sub changeSettings
{
- my $confDB = shift;
+ my $self = shift;
my $settings = shift;
- return $confDB->{'meta-db'}->changeSettings($settings);
+ return $self->{'meta-db'}->changeSettings($settings);
}
################################################################################
@@ -796,11 +758,11 @@ sub changeSettings
################################################################################
sub mergeDefaultAttributesIntoSystem
{ # merge default system configuration into given system
- my $confDB = shift;
+ my $self = shift;
my $system = shift;
my $defaultSystem = shift;
- $defaultSystem = fetchSystemsByID($confDB, 0)
+ $defaultSystem = $self->fetchSystemByID(0)
unless defined $defaultSystem;
mergeAttributes($system, $defaultSystem);
@@ -808,14 +770,14 @@ sub mergeDefaultAttributesIntoSystem
sub mergeDefaultAndGroupAttributesIntoClient
{ # merge default and group configurations into given client
- my $confDB = shift;
+ my $self = shift;
my $client = shift;
# step over all groups this client belongs to
# (ordered by priority from highest to lowest):
- my @groupIDs = fetchGroupIDsOfClient($confDB, $client->{id});
+ my @groupIDs = $self->fetchGroupIDsOfClient($client->{id});
my @groups = sort { $b->{priority} <=> $a->{priority} }
- fetchGroupsByID($confDB, \@groupIDs);
+ $self->fetchGroupByID(\@groupIDs);
foreach my $group (@groups) {
# merge configuration from this group into the current client:
vlog 3, _tr('merging from group %d:%s...', $group->{id}, $group->{name});
@@ -824,29 +786,29 @@ sub mergeDefaultAndGroupAttributesIntoClient
# merge configuration from default client:
vlog 3, _tr('merging from default client...');
- my $defaultClient = fetchClientsByID($confDB, 0);
+ my $defaultClient = $self->fetchClientByID(0);
mergeAttributes($client, $defaultClient);
}
sub aggregatedSystemIDsOfClient
{ # return aggregated list of system-IDs this client should offer
# (as indicated by itself, the default client and the client's groups)
- my $confDB = shift;
+ my $self = shift;
my $client = shift;
# add all systems directly linked to client:
- my @systemIDs = fetchSystemIDsOfClient($confDB, $client->{id});
+ my @systemIDs = $self->fetchSystemIDsOfClient($client->{id});
# step over all groups this client belongs to:
- my @groupIDs = fetchGroupIDsOfClient($confDB, $client->{id});
- my @groups = fetchGroupsByID($confDB, \@groupIDs);
+ my @groupIDs = $self->fetchGroupIDsOfClient($client->{id});
+ my @groups = $self->fetchGroupByID(\@groupIDs);
foreach my $group (@groups) {
# add all systems that the client inherits from the current group:
- push @systemIDs, fetchSystemIDsOfGroup($confDB, $group->{id});
+ push @systemIDs, $self->fetchSystemIDsOfGroup($group->{id});
}
# add all systems inherited from default client
- push @systemIDs, fetchSystemIDsOfClient($confDB, 0);
+ push @systemIDs, $self->fetchSystemIDsOfClient(0);
return _unique(@systemIDs);
}
@@ -854,22 +816,22 @@ sub aggregatedSystemIDsOfClient
sub aggregatedClientIDsOfSystem
{ # return aggregated list of client-IDs this system is linked to
# (as indicated by itself, the default system and the system's groups)
- my $confDB = shift;
+ my $self = shift;
my $system = shift;
# add all clients directly linked to system:
- my @clientIDs = fetchClientIDsOfSystem($confDB, $system->{id});
+ my @clientIDs = $self->fetchClientIDsOfSystem($system->{id});
# step over all groups this system belongs to:
- my @groupIDs = fetchGroupIDsOfSystem($confDB, $system->{id});
- my @groups = fetchGroupsByID($confDB, \@groupIDs);
+ my @groupIDs = $self->fetchGroupIDsOfSystem($system->{id});
+ my @groups = $self->fetchGroupByID(\@groupIDs);
foreach my $group (@groups) {
# add all clients that the system inherits from the current group:
- push @clientIDs, fetchClientIDsOfGroup($confDB, $group->{id});
+ push @clientIDs, $self->fetchClientIDsOfGroup($group->{id});
}
# add all clients inherited from default system
- push @clientIDs, fetchClientIDsOfSystem($confDB, 0);
+ push @clientIDs, $self->fetchClientIDsOfSystem(0);
return _unique(@clientIDs);
}
@@ -877,14 +839,15 @@ sub aggregatedClientIDsOfSystem
sub aggregatedSystemFileInfosOfSystem
{ # return aggregated list of hash-refs that contain information about
# the kernel- and initialramfs-files this system is using
- # (as indicated by itself and the system's variants)
- my $confDB = shift;
+ my $self = shift;
my $system = shift;
- my $vendorOS = fetchVendorOSesByID($confDB, $system->{vendor_os_id});
- return () if !$vendorOS || !length($vendorOS->{path});
+ my $export = $self->fetchExportByID($system->{export_id});
+ return () if !$export || !length($export->{name});
+ my $vendorOS = $self->fetchVendorOSByID($export->{vendor_os_id});
+ return () if !$vendorOS || !length($vendorOS->{name});
my $kernelPath
- = "$openslxConfig{'private-path'}/stage1/$vendorOS->{path}";
+ = "$openslxConfig{'private-path'}/stage1/$vendorOS->{name}/boot";
my $exportURI = $system->{'export_uri'};
if ($exportURI !~ m[\w]) {
@@ -892,14 +855,11 @@ sub aggregatedSystemFileInfosOfSystem
my $type = $system->{'export_type'};
my $serverIpToken = generatePlaceholderFor('serverip');
$exportURI
- = "$type://$serverIpToken$openslxConfig{'export-path'}/$type/$vendorOS->{path}";
+ = "$type://$serverIpToken$openslxConfig{'export-path'}/$type/$vendorOS->{name}";
}
- my @variantIDs = fetchSystemVariantIDsOfSystem($confDB, $system->{id});
- my @variants = fetchSystemVariantsByID($confDB, \@variantIDs);
-
my @infos;
- foreach my $sys ($system, @variants) {
+ foreach my $sys ($system) {
next if !length($sys->{kernel});
my %info = %$sys;
$info{'kernel-file'} = "$kernelPath/$sys->{kernel}";
@@ -921,7 +881,7 @@ sub isAttribute
{ # returns whether or not the given key is an exportable attribute
my $key = shift;
- return $key =~ m[^attr];
+ return $key =~ m[^attr_];
}
sub mergeAttributes
diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm
index 6d5400ad..0a141137 100644
--- a/config-db/OpenSLX/DBSchema.pm
+++ b/config-db/OpenSLX/DBSchema.pm
@@ -59,50 +59,47 @@ $DbSchema = {
'schema_version:s.5', # schema-version currently implemented by DB
],
'vendor_os' => [
- # a vendor os describes a folder containing an operating system as
+ # a vendor-OS describes a folder containing an operating system as
# provided by the vendor (a.k.a. unchanged and thus updatable)
- 'id:pk', # primary key
- 'name:s.48', # structured name of OS installation
- # (e.g. suse-9.3-minimal, suse-9.3-kde,
- # debian-3.1-ppc)
- 'comment:s.1024', # internal comment (optional, for admins)
- 'path:s.256', # path to os filesystem root
+ 'id:pk', # primary key
+ 'name:s.48', # structured name of OS installation
+ # (e.g. suse-9.3-kde, debian-3.1-ppc,
+ # suse-10.2-cloned-from-kiwi).
+ # This is used as the folder name for the
+ # corresponding stage1, too.
+ 'comment:s.1024', # internal comment (optional, for admins)
+ 'clone_source:s.256', # if vendor-OS was cloned, this contains
+ # the rsync-URI pointing to the original
],
- 'system' => [
- # a system describes one bootable instance of a vendor os
+ 'export' => [
+ # an export describes a vendor-OS "wrapped" in some kind of exporting
+ # format (NFS or NBD-squash). This represents the rootfs that the
+ # clients will see.
'id:pk', # primary key
+ 'name:s.64', # unique name of export, is automatically
+ # constructed like this:
+ # <vendor-os-name>-<export-type>
'vendor_os_id:fk', # foreign key
- 'name:s.48', # name used in filesystem and passed to
- # kernel via cmdline arg (e.g.:
- # suse-9.3-minimal, suse-9.3-minimal-nbd...)
- 'label:s.128', # name visible to user (pxe-label)
'comment:s.1024', # internal comment (optional, for admins)
- 'export_type:s.10', # 'nbd', 'nbd-squash', 'nfs', ...
- 'export_uri:s.256', # path to export (NDB-image or NFS-path), if
+ 'export_type:s.10', # 'nbd-squash', 'nfs', ...
+ 'export_uri:s.256', # path to export (squashfs or NFS-path), if
# empty it will be auto-generated by
# config-demuxer
- 'kernel:s.128', # path to kernel file, relative to OS root
- 'kernel_params:s.512', # kernel-param string for pxe
- 'ramfs_debug_level:i', # debug level for initramfs-generator-script
- 'ramfs_use_glibc:b', # use glibc in ramfs
- 'ramfs_use_busybox:b', # use busybox in ramfs
- 'ramfs_nicmods:s.128', # list of network interface card modules
- 'ramfs_fsmods:s.128', # list of filesystem modules
- 'ramfs_screen:s.10', # screen size for splash
- 'hidden:b', # hidden systems won't be offered for booting
- @sharedAttributes,
],
- 'system_variant' => [
- # a system_variant describes an alternative boot setup for a system
- # which will always be offered if the systems itself is offered by
- # a client
+ 'system' => [
+ # a system describes one bootable instance of an export, it
+ # represents a selectable line in the PXE boot menu of all the
+ # clients associated with this system
'id:pk', # primary key
- 'name_addition:s.48', # string added to system name in order to
- # get a unique system name
- 'system_id:fk', # foreign key
- 'label_addition:s.64', # visible name part (added to pxe-label)
+ 'export_id:fk', # foreign key
+ 'name:s.64', # unique name of system, is automatically
+ # constructed like this:
+ # <vendor-os-name>-<export-type>-<kernel>
+ 'label:s.64', # name visible to user (pxe-label)
+ # if empty, this will be autocreated from
+ # the name
'comment:s.1024', # internal comment (optional, for admins)
- 'kernel:s.128', # name of kernel file
+ 'kernel:s.128', # path to kernel file, relative to /boot
'kernel_params:s.512', # kernel-param string for pxe
'ramfs_debug_level:i', # debug level for initramfs-generator-script
'ramfs_use_glibc:b', # use glibc in ramfs
@@ -110,6 +107,8 @@ $DbSchema = {
'ramfs_nicmods:s.128', # list of network interface card modules
'ramfs_fsmods:s.128', # list of filesystem modules
'ramfs_screen:s.10', # screen size for splash
+ 'hidden:b', # hidden systems won't be offered for booting
+ @sharedAttributes,
],
'client' => [
# a client is a PC booting via network
@@ -211,6 +210,11 @@ $DbSchema = {
},
{
'cmd' => 'add-table',
+ 'table' => 'export',
+ 'cols' => $DbSchema->{'tables'}->{'export'},
+ },
+ {
+ 'cmd' => 'add-table',
'table' => 'system',
'cols' => $DbSchema->{'tables'}->{'system'},
'vals' => [
@@ -223,11 +227,6 @@ $DbSchema = {
},
{
'cmd' => 'add-table',
- 'table' => 'system_variant',
- 'cols' => $DbSchema->{'tables'}->{'system_variant'},
- },
- {
- 'cmd' => 'add-table',
'table' => 'client',
'cols' => $DbSchema->{'tables'}->{'client'},
'vals' => [
diff --git a/config-db/OpenSLX/MetaDB/Base.pm b/config-db/OpenSLX/MetaDB/Base.pm
index f42b5412..41d35d9f 100644
--- a/config-db/OpenSLX/MetaDB/Base.pm
+++ b/config-db/OpenSLX/MetaDB/Base.pm
@@ -21,11 +21,11 @@ sub new
confess "Don't create OpenSLX::MetaDB::Base - objects directly!";
}
-sub connectConfigDB
+sub connect
{
}
-sub disconnectConfigDB
+sub disconnect
{
}
@@ -36,51 +36,51 @@ sub quote
################################################################################
### data access interface
################################################################################
-sub fetchVendorOSesByFilter
+sub fetchVendorOSByFilter
{
}
-sub fetchVendorOSesByID
+sub fetchVendorOSByID
{
}
-sub fetchSystemsByFilter
+sub fetchExportByFilter
{
}
-sub fetchSystemsByID
+sub fetchExportByID
{
}
-sub fetchSystemIDsOfVendorOS
+sub fetchExportIDsOfVendorOS
{
}
-sub fetchSystemIDsOfClient
+sub fetchSystemByFilter
{
}
-sub fetchSystemIDsOfGroup
+sub fetchSystemByID
{
}
-sub fetchSystemVariantsByFilter
+sub fetchSystemIDsOfExport
{
}
-sub fetchSystemVariantsByID
+sub fetchSystemIDsOfClient
{
}
-sub fetchSystemVariantIDsOfSystem
+sub fetchSystemIDsOfGroup
{
}
-sub fetchClientsByFilter
+sub fetchClientByFilter
{
}
-sub fetchClientsByID
+sub fetchClientByID
{
}
@@ -92,11 +92,11 @@ sub fetchClientIDsOfGroup
{
}
-sub fetchGroupsByFilter
+sub fetchGroupByFilter
{
}
-sub fetchGroupsByID
+sub fetchGroupByID
{
}
@@ -136,27 +136,27 @@ sub changeVendorOS
{
}
-sub addSystem
+sub addExport
{
}
-sub removeSystem
+sub removeExport
{
}
-sub changeSystem
+sub changeExport
{
}
-sub addSystemVariant
+sub addSystem
{
}
-sub removeSystemVariant
+sub removeSystem
{
}
-sub changeSystemVariant
+sub changeSystem
{
}
@@ -425,7 +425,7 @@ allow the user to access data:
=over
-=item C<fetchVendorOSesByFilter([%$filter], [$resultCols])>
+=item C<fetchVendorOSByFilter([%$filter], [$resultCols])>
Fetches and returns information about all vendor-OSes that match the given
filter.
@@ -447,7 +447,7 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchVendorOSesByID(@$ids, [$resultCols])>
+=item C<fetchVendorOSByID(@$ids, [$resultCols])>
Fetches and returns information the vendor-OSes with the given IDs.
@@ -467,21 +467,21 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemsByFilter([%$filter], [$resultCols])>
+=item C<fetchExportByFilter([%$filter], [$resultCols])>
-Fetches and returns information about all systems that match the given filter.
+Fetches and returns information about all exports that match the given
+filter.
=over
-=item Param C<$filter>
+=item Param C<filter>
A hash-ref containing the filter criteria that shall be applied - default
is no filtering. See L</"Filters"> for more info.
-=item Param C<$resultCols> [Optional]
+=item Param C<resultCols>
-A comma-separated list of colunm names that shall be returned. If not defined,
-all available data must be returned.
+A string listing the columns that shall be returned - default is all columns.
=item Return Value
@@ -489,15 +489,15 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemsByID(@$ids, [$resultCols])>
+=item C<fetchExportByID(@$ids, [$resultCols])>
-Fetches and returns information the systems with the given IDs.
+Fetches and returns information the exports with the given IDs.
=over
=item Param C<ids>
-An array of the system-IDs you are interested in.
+An array of the export-IDs you are interested in.
=item Param C<resultCols>
@@ -509,15 +509,15 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemIDsOfVendorOS($id)>
+=item C<fetchExportIDsOfVendorOS($id)>
-Fetches the IDs of all systems that make use of the vendor-OS with the given ID.
+Fetches the IDs of all exports that make use of the vendor-OS with the given ID.
=over
=item Param C<id>
-ID of the vendor-OS whose systems shall be returned.
+ID of the vendor-OS whose exports shall be returned.
=item Return Value
@@ -525,101 +525,99 @@ An array of system-IDs.
=back
-=item C<fetchSystemIDsOfClient($id)>
+=item C<fetchSystemByFilter([%$filter], [$resultCols])>
-Fetches the IDs of all systems that are used by the client with the given
-ID.
+Fetches and returns information about all systems that match the given filter.
=over
-=item Param C<id>
+=item Param C<$filter>
-ID of the client whose systems shall be returned.
+A hash-ref containing the filter criteria that shall be applied - default
+is no filtering. See L</"Filters"> for more info.
+
+=item Param C<$resultCols> [Optional]
+
+A comma-separated list of colunm names that shall be returned. If not defined,
+all available data must be returned.
=item Return Value
-An array of system-IDs.
+An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemIDsOfGroup($id)>
+=item C<fetchSystemByID(@$ids, [$resultCols])>
-Fetches the IDs of all systems that are part of the group with the given
-ID.
+Fetches and returns information the systems with the given IDs.
=over
-=item Param C<id>
+=item Param C<ids>
-ID of the group whose systems shall be returned.
+An array of the system-IDs you are interested in.
+
+=item Param C<resultCols>
+
+A string listing the columns that shall be returned - default is all columns.
=item Return Value
-An array of system-IDs.
+An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchSystemVariantsByFilter([%$filter], [$resultCols])>
+=item C<fetchSystemIDsOfExport($id)>
-Fetches and returns information about all system variants that match the given
-filter.
+Fetches the IDs of all systems that make use of the export with the given ID.
=over
-=item Param C<$filter>
-
-A hash-ref containing the filter criteria that shall be applied - default
-is no filtering. See L</"Filters"> for more info.
-
-=item Param C<$resultCols> [Optional]
+=item Param C<id>
-A comma-separated list of colunm names that shall be returned. If not defined,
-all available data must be returned.
+ID of the export whose systems shall be returned.
=item Return Value
-An array of hash-refs containing the resulting data rows.
+An array of system-IDs.
=back
-=item C<fetchSystemVariantsByID(@$ids, [$resultCols])>
+=item C<fetchSystemIDsOfClient($id)>
-Fetches and returns information the systems variants with the given IDs.
+Fetches the IDs of all systems that are used by the client with the given
+ID.
=over
-=item Param C<ids>
-
-An array of the system-variant-IDs you are interested in.
-
-=item Param C<resultCols>
+=item Param C<id>
-A string listing the columns that shall be returned - default is all columns.
+ID of the client whose systems shall be returned.
=item Return Value
-An array of hash-refs containing the resulting data rows.
+An array of system-IDs.
=back
-=item C<fetchSystemVariantIDsOfSystem($id)>
+=item C<fetchSystemIDsOfGroup($id)>
-Fetches the IDs of all system variants that belong to the system with the given
+Fetches the IDs of all systems that are part of the group with the given
ID.
=over
=item Param C<id>
-ID of the system whose variants shall be returned.
+ID of the group whose systems shall be returned.
=item Return Value
-An array of system-variant-IDs.
+An array of system-IDs.
=back
-=item C<fetchClientsByFilter([%$filter], [$resultCols])>
+=item C<fetchClientByFilter([%$filter], [$resultCols])>
Fetches and returns information about all clients that match the given filter.
@@ -641,7 +639,7 @@ An array of hash-refs containing the resulting data rows.
=back
-=item C<fetchClientsByID(@$ids, [$resultCols])>
+=item C<fetchClientByID(@$ids, [$resultCols])>
Fetches and returns information the clients with the given IDs.
@@ -697,7 +695,7 @@ An array of client-IDs.
-=item C<fetchGroupsByFilter([%$filter], [$resultCols])>
+=item C<fetchGroupByFilter([%$filter], [$resultCols])>
Fetches and returns information about all groups that match the given filter.
@@ -721,7 +719,7 @@ An array of hash-refs containing the resulting data rows.
-=item C<fetchGroupsByID(@$ids, [$resultCols])>
+=item C<fetchGroupByID(@$ids, [$resultCols])>
Fetches and returns information the groups with the given IDs.
@@ -861,163 +859,163 @@ C<1> if the vendorOS(es) could be changed, C<undef> if not.
-=item C<addSystem(@$valRows)>
+=item C<addExport(@$valRows)>
-Adds one or more systems to the database.
+Adds one or more export to the database.
=over
=item Param C<valRows>
-An array-ref containing hash-refs with the data of the new system(s).
+An array-ref containing hash-refs with the data of the new export(s).
=item Return Value
-The IDs of the new system(s), C<undef> if the creation failed.
+The IDs of the new export(s), C<undef> if the creation failed.
=back
-=item C<removeSystem(@$systemIDs)>
+=item C<removeExport(@$exportIDs)>
-Removes one or more systems from the database.
+Removes one or more export from the database.
=over
-=item Param C<systemIDs>
+=item Param C<exportIDs>
-An array-ref containing the IDs of the systems that shall be removed.
+An array-ref containing the IDs of the exports that shall be removed.
=item Return Value
-C<1> if the system(s) could be removed, C<undef> if not.
+C<1> if the export(s) could be removed, C<undef> if not.
=back
-=item C<changeSystem(@$systemIDs, @$valRows)>
+=item C<changeExport(@$exportIDs, @$valRows)>
-Changes the data of one or more systems.
+Changes the data of one or more export.
=over
-=item Param C<systemIDs>
+=item Param C<vendorOSIDs>
-An array-ref containing the IDs of the systems that shall be changed.
+An array-ref containing the IDs of the exports that shall be changed.
=item Param C<valRows>
-An array-ref containing hash-refs with the new data for the system(s).
+An array-ref containing hash-refs with the new data for the export(s).
=item Return Value
-C<1> if the system(s) could be changed, C<undef> if not.
+C<1> if the export(s) could be changed, C<undef> if not.
=back
-=item C<setClientIDsOfSystem($systemID, @$clientIDs)>
+=item C<addSystem(@$valRows)>
-Specifies all clients that should offer the given system for booting.
+Adds one or more systems to the database.
=over
-=item Param C<systemID>
-
-The ID of the system whose clients you'd like to specify.
-
-=item Param C<clientIDs>
+=item Param C<valRows>
-An array-ref containing the IDs of the clients that shall be connected to the
-system.
+An array-ref containing hash-refs with the data of the new system(s).
=item Return Value
-C<1> if the system/client references could be set, C<undef> if not.
+The IDs of the new system(s), C<undef> if the creation failed.
=back
-=item C<setGroupIDsOfSystem($systemID, @$groupIDs)>
+=item C<removeSystem(@$systemIDs)>
-Specifies all groups that should offer the given system for booting.
+Removes one or more systems from the database.
=over
-=item Param C<systemID>
-
-The ID of the system whose groups you'd like to specify.
-
-=item Param C<clientIDs>
+=item Param C<systemIDs>
-An array-ref containing the IDs of the groups that shall be connected to the
-system.
+An array-ref containing the IDs of the systems that shall be removed.
=item Return Value
-C<1> if the system/group references could be set, C<undef> if not.
+C<1> if the system(s) could be removed, C<undef> if not.
=back
-=item C<addSystemVariant(@$valRows)>
+=item C<changeSystem(@$systemIDs, @$valRows)>
-Adds one or more system-variants to the database.
+Changes the data of one or more systems.
=over
+=item Param C<systemIDs>
+
+An array-ref containing the IDs of the systems that shall be changed.
+
=item Param C<valRows>
-An array-ref containing hash-refs with the data of the new system-variant(s).
+An array-ref containing hash-refs with the new data for the system(s).
=item Return Value
-The IDs of the new system-variant(s), C<undef> if the creation failed.
+C<1> if the system(s) could be changed, C<undef> if not.
=back
-=item C<removeSystemVariant(@$systemVariantIDs)>
+=item C<setClientIDsOfSystem($systemID, @$clientIDs)>
-Removes one or more system-variants from the database.
+Specifies all clients that should offer the given system for booting.
=over
-=item Param C<systemIDs>
+=item Param C<systemID>
+
+The ID of the system whose clients you'd like to specify.
-An array-ref containing the IDs of the system-variants that shall be removed.
+=item Param C<clientIDs>
+
+An array-ref containing the IDs of the clients that shall be connected to the
+system.
=item Return Value
-C<1> if the system-variant(s) could be removed, C<undef> if not.
+C<1> if the system/client references could be set, C<undef> if not.
=back
-=item C<changeSystemVariant(@$systemVariantIDs, @$valRows)>
+=item C<setGroupIDsOfSystem($systemID, @$groupIDs)>
-Changes the data of one or more system-variants.
+Specifies all groups that should offer the given system for booting.
=over
-=item Param C<systemVariantIDs>
+=item Param C<systemID>
-An array-ref containing the IDs of the system-variants that shall be changed.
+The ID of the system whose groups you'd like to specify.
-=item Param C<valRows>
+=item Param C<clientIDs>
-An array-ref containing hash-refs with the new data for the system-variant(s).
+An array-ref containing the IDs of the groups that shall be connected to the
+system.
=item Return Value
-C<1> if the system-variant(s) could be changed, C<undef> if not.
+C<1> if the system/group references could be set, C<undef> if not.
=back
@@ -1255,6 +1253,6 @@ C<1> if the settings could be changed, C<undef> if not.
The following methods need to be implemented in a MetaDB driver in order to
be able to automatically adjust to new database schema versions (by adding
-and/or removing tables and table-columns).
+and/or removing tables and table-columns).
=cut
diff --git a/config-db/OpenSLX/MetaDB/CSV.pm b/config-db/OpenSLX/MetaDB/CSV.pm
index bed7bbd9..55da0beb 100644
--- a/config-db/OpenSLX/MetaDB/CSV.pm
+++ b/config-db/OpenSLX/MetaDB/CSV.pm
@@ -37,7 +37,7 @@ sub new
return bless $self, $class;
}
-sub connectConfigDB
+sub connect
{
my $self = shift;
diff --git a/config-db/OpenSLX/MetaDB/DBI.pm b/config-db/OpenSLX/MetaDB/DBI.pm
index ad4c12b5..4479ed84 100644
--- a/config-db/OpenSLX/MetaDB/DBI.pm
+++ b/config-db/OpenSLX/MetaDB/DBI.pm
@@ -30,7 +30,7 @@ sub new
confess "Don't call OpenSLX::MetaDB::DBI::new directly!";
}
-sub disconnectConfigDB
+sub disconnect
{
my $self = shift;
@@ -83,7 +83,7 @@ sub _doSelect
return @vals;
}
-sub fetchVendorOSesByFilter
+sub fetchVendorOSByFilter
{
my $self = shift;
my $filter = shift;
@@ -99,7 +99,7 @@ sub fetchVendorOSesByFilter
return $self->_doSelect($sql);
}
-sub fetchVendorOSesByID
+sub fetchVendorOSByID
{
my $self = shift;
my $ids = shift;
@@ -112,14 +112,14 @@ sub fetchVendorOSesByID
return $self->_doSelect($sql);
}
-sub fetchSystemsByFilter
+sub fetchExportByFilter
{
my $self = shift;
my $filter = shift;
my $resultCols = shift;
- $resultCols = '*' unless (defined $resultCols);
- my $sql = "SELECT $resultCols FROM system";
+ $resultCols = '*' unless (defined $resultCols);
+ my $sql = "SELECT $resultCols FROM export";
my $connector;
foreach my $col (keys %$filter) {
$connector = !defined $connector ? 'WHERE' : 'AND';
@@ -128,7 +128,7 @@ sub fetchSystemsByFilter
return $self->_doSelect($sql);
}
-sub fetchSystemsByID
+sub fetchExportByID
{
my $self = shift;
my $ids = shift;
@@ -137,51 +137,29 @@ sub fetchSystemsByID
$resultCols = '*' unless (defined $resultCols);
my $idStr = join ',', @$ids;
return if !length($idStr);
- my $sql = "SELECT $resultCols FROM system WHERE id IN ($idStr)";
+ my $sql = "SELECT $resultCols FROM export WHERE id IN ($idStr)";
return $self->_doSelect($sql);
}
-sub fetchSystemIDsOfVendorOS
+sub fetchExportIDsOfVendorOS
{
my $self = shift;
my $vendorOSID = shift;
my $sql = qq[
- SELECT id FROM system WHERE vendor_os_id = '$vendorOSID'
+ SELECT id FROM export WHERE vendor_os_id = '$vendorOSID'
];
return $self->_doSelect($sql, 'id');
}
-sub fetchSystemIDsOfClient
-{
- my $self = shift;
- my $clientID = shift;
-
- my $sql = qq[
- SELECT system_id FROM client_system_ref WHERE client_id = '$clientID'
- ];
- return $self->_doSelect($sql, 'system_id');
-}
-
-sub fetchSystemIDsOfGroup
-{
- my $self = shift;
- my $groupID = shift;
-
- my $sql = qq[
- SELECT system_id FROM group_system_ref WHERE group_id = '$groupID'
- ];
- return $self->_doSelect($sql, 'system_id');
-}
-
-sub fetchSystemVariantsByFilter
+sub fetchSystemByFilter
{
my $self = shift;
my $filter = shift;
my $resultCols = shift;
$resultCols = '*' unless (defined $resultCols);
- my $sql = "SELECT $resultCols FROM system_variant";
+ my $sql = "SELECT $resultCols FROM system";
my $connector;
foreach my $col (keys %$filter) {
$connector = !defined $connector ? 'WHERE' : 'AND';
@@ -190,7 +168,7 @@ sub fetchSystemVariantsByFilter
return $self->_doSelect($sql);
}
-sub fetchSystemVariantsByID
+sub fetchSystemByID
{
my $self = shift;
my $ids = shift;
@@ -199,22 +177,44 @@ sub fetchSystemVariantsByID
$resultCols = '*' unless (defined $resultCols);
my $idStr = join ',', @$ids;
return if !length($idStr);
- my $sql = "SELECT $resultCols FROM system_variant WHERE id IN ($idStr)";
+ my $sql = "SELECT $resultCols FROM system WHERE id IN ($idStr)";
return $self->_doSelect($sql);
}
-sub fetchSystemVariantIDsOfSystem
+sub fetchSystemIDsOfExport
{
my $self = shift;
- my $systemID = shift;
+ my $exportID = shift;
my $sql = qq[
- SELECT id FROM system_variant WHERE system_id = '$systemID'
+ SELECT id FROM system WHERE export_id = '$exportID'
];
return $self->_doSelect($sql, 'id');
}
-sub fetchClientsByFilter
+sub fetchSystemIDsOfClient
+{
+ my $self = shift;
+ my $clientID = shift;
+
+ my $sql = qq[
+ SELECT system_id FROM client_system_ref WHERE client_id = '$clientID'
+ ];
+ return $self->_doSelect($sql, 'system_id');
+}
+
+sub fetchSystemIDsOfGroup
+{
+ my $self = shift;
+ my $groupID = shift;
+
+ my $sql = qq[
+ SELECT system_id FROM group_system_ref WHERE group_id = '$groupID'
+ ];
+ return $self->_doSelect($sql, 'system_id');
+}
+
+sub fetchClientByFilter
{
my $self = shift;
my $filter = shift;
@@ -230,7 +230,7 @@ sub fetchClientsByFilter
return $self->_doSelect($sql);
}
-sub fetchClientsByID
+sub fetchClientByID
{
my $self = shift;
my $ids = shift;
@@ -265,7 +265,7 @@ sub fetchClientIDsOfGroup
return $self->_doSelect($sql, 'client_id');
}
-sub fetchGroupsByFilter
+sub fetchGroupByFilter
{
my $self = shift;
my $filter = shift;
@@ -281,7 +281,7 @@ sub fetchGroupsByFilter
return $self->_doSelect($sql);
}
-sub fetchGroupsByID
+sub fetchGroupByID
{
my $self = shift;
my $ids = shift;
@@ -526,6 +526,31 @@ sub changeVendorOS
return $self->_doUpdate('vendor_os', $vendorOSIDs, $valRows);
}
+sub addExport
+{
+ my $self = shift;
+ my $valRows = shift;
+
+ return $self->_doInsert('export', $valRows);
+}
+
+sub removeExport
+{
+ my $self = shift;
+ my $exportIDs = shift;
+
+ return $self->_doDelete('export', $exportIDs);
+}
+
+sub changeExport
+{
+ my $self = shift;
+ my $exportIDs = shift;
+ my $valRows = shift;
+
+ return $self->_doUpdate('export', $exportIDs, $valRows);
+}
+
sub addSystem
{
my $self = shift;
@@ -573,31 +598,6 @@ sub setGroupIDsOfSystem
'system_id', 'group_id', \@currGroups);
}
-sub addSystemVariant
-{
- my $self = shift;
- my $valRows = shift;
-
- return $self->_doInsert('system_variant', $valRows);
-}
-
-sub removeSystemVariant
-{
- my $self = shift;
- my $systemVariantIDs = shift;
-
- return $self->_doDelete('system_variant', $systemVariantIDs);
-}
-
-sub changeSystemVariant
-{
- my $self = shift;
- my $systemVariantIDs = shift;
- my $valRows = shift;
-
- return $self->_doUpdate('system_variant', $systemVariantIDs, $valRows);
-}
-
sub addClient
{
my $self = shift;
diff --git a/config-db/OpenSLX/MetaDB/SQLite.pm b/config-db/OpenSLX/MetaDB/SQLite.pm
index 059467d8..d7d0a2b6 100644
--- a/config-db/OpenSLX/MetaDB/SQLite.pm
+++ b/config-db/OpenSLX/MetaDB/SQLite.pm
@@ -35,7 +35,7 @@ sub new
return bless $self, $class;
}
-sub connectConfigDB
+sub connect
{
my $self = shift;
diff --git a/config-db/OpenSLX/MetaDB/mysql.pm b/config-db/OpenSLX/MetaDB/mysql.pm
index 3f42b966..1e0d01c3 100644
--- a/config-db/OpenSLX/MetaDB/mysql.pm
+++ b/config-db/OpenSLX/MetaDB/mysql.pm
@@ -35,7 +35,7 @@ sub new
return bless $self, $class;
}
-sub connectConfigDB
+sub connect
{
my $self = shift;