|
@@ -9,6 +9,7 @@ import (
|
|
"runtime"
|
|
"runtime"
|
|
|
|
|
|
"imuslab.com/arozos/mod/filesystem/hybridBackup"
|
|
"imuslab.com/arozos/mod/filesystem/hybridBackup"
|
|
|
|
+
|
|
"imuslab.com/arozos/mod/permission"
|
|
"imuslab.com/arozos/mod/permission"
|
|
|
|
|
|
fs "imuslab.com/arozos/mod/filesystem"
|
|
fs "imuslab.com/arozos/mod/filesystem"
|
|
@@ -112,9 +113,19 @@ func LoadBaseStoragePool() error {
|
|
func FilesystemDaemonInit() {
|
|
func FilesystemDaemonInit() {
|
|
for _, thisHandler := range fsHandlers {
|
|
for _, thisHandler := range fsHandlers {
|
|
if thisHandler.Hierarchy == "backup" {
|
|
if thisHandler.Hierarchy == "backup" {
|
|
-
|
|
|
|
//This is a backup drive. Generate it handler
|
|
//This is a backup drive. Generate it handler
|
|
backupConfig := thisHandler.HierarchyConfig.(hybridBackup.BackupConfig)
|
|
backupConfig := thisHandler.HierarchyConfig.(hybridBackup.BackupConfig)
|
|
|
|
+
|
|
|
|
+ //Get its parent mount point for backup
|
|
|
|
+ parentFileSystemHandler, err := GetFsHandlerByUUID(backupConfig.ParentUID)
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("Virtual Root with UUID: " + backupConfig.ParentUID + " not loaded. Unable to start backup process.")
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ backupConfig.ParentPath = parentFileSystemHandler.Path
|
|
|
|
+
|
|
|
|
+ //Create a scheudler for this disk
|
|
systemScheduler.CreateNewScheduledFunctionJob("backup-daemon ["+thisHandler.UUID+"]",
|
|
systemScheduler.CreateNewScheduledFunctionJob("backup-daemon ["+thisHandler.UUID+"]",
|
|
"Backup daemon from "+backupConfig.ParentUID+":/ to "+backupConfig.DiskUID+":/",
|
|
"Backup daemon from "+backupConfig.ParentUID+":/ to "+backupConfig.DiskUID+":/",
|
|
60,
|
|
60,
|
|
@@ -188,6 +199,16 @@ func LoadStoragePoolForGroup(pg *permission.PermissionGroup) error {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func GetFsHandlerByUUID(uuid string) (*fs.FileSystemHandler, error) {
|
|
|
|
+ for _, fsh := range fsHandlers {
|
|
|
|
+ if fsh.UUID == uuid {
|
|
|
|
+ return fsh, nil
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return nil, errors.New("Filesystem handler with given UUID not found")
|
|
|
|
+}
|
|
|
|
+
|
|
func RegisterStorageSettings() {
|
|
func RegisterStorageSettings() {
|
|
//Storage Pool Configuration
|
|
//Storage Pool Configuration
|
|
registerSetting(settingModule{
|
|
registerSetting(settingModule{
|