gocage migrate now synchronize destination dataset after stoppoing jail
This commit is contained in:
@ -6,9 +6,6 @@ import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"strings"
|
||||
/* "regexp"
|
||||
"time"
|
||||
*/
|
||||
)
|
||||
|
||||
const (
|
||||
@ -43,7 +40,7 @@ func MigrateJail(args []string) {
|
||||
return
|
||||
}
|
||||
|
||||
if cj.Running == true {
|
||||
if cj.Running == true && gYesToAll == false {
|
||||
fmt.Printf("WARNING: Jail %s is running\n", cj.Name)
|
||||
fmt.Printf("Migration will stop it for data sync before starting on the new pool. You will be prompted for shutdown.\n")
|
||||
fmt.Printf("Continue? (y/n) ")
|
||||
@ -104,17 +101,19 @@ func MigrateJail(args []string) {
|
||||
// Running jail needs a last snapshot for an incremental send/recv after shutting down.
|
||||
if cj.Running == true {
|
||||
fmt.Printf("Shutdown jail %s for last data sync, this could take some time.\n", cj.Name)
|
||||
fmt.Printf("Continue? (y/n) ")
|
||||
scanr := bufio.NewScanner(os.Stdin)
|
||||
scanr.Scan()
|
||||
if false == strings.EqualFold(scanr.Text(), "y") {
|
||||
fmt.Printf("Migration aborted. Now cleaning destination pool.\n")
|
||||
if err := CleanMigrateMess([]string{cj.Name}); err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
if gYesToAll == false {
|
||||
fmt.Printf("Continue? (y/n) ")
|
||||
scanr := bufio.NewScanner(os.Stdin)
|
||||
scanr.Scan()
|
||||
if false == strings.EqualFold(scanr.Text(), "y") {
|
||||
fmt.Printf("Migration aborted. Now cleaning destination pool.\n")
|
||||
if err := CleanMigrateMess([]string{cj.Name}); err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
}
|
||||
// TODO : Remove destination datasets, or handle the cas at the beginning of current function
|
||||
// (when snapshot already exist on source and dest)
|
||||
return
|
||||
}
|
||||
// TODO : Remove destination datasets, or handle the cas at the beginning of current function
|
||||
// (when snapshot already exist on source and dest)
|
||||
return
|
||||
}
|
||||
|
||||
StopJail([]string{cj.Name})
|
||||
@ -132,22 +131,32 @@ func MigrateJail(args []string) {
|
||||
}
|
||||
fmt.Printf("Done\n")
|
||||
|
||||
// FIXME : config DS sync fails with :
|
||||
/* cannot receive incremental stream: destination qstore/iocage/jails/kibana has been modified
|
||||
* since most recent snapshot
|
||||
*/
|
||||
// It needs a "zfs rollback destconf@gocage_mig_init" to be able to sync.
|
||||
// UPDATE 06/06/2022 : Should be fixed using "-Fu" zfs recv flag
|
||||
|
||||
fmt.Printf("Synchronize jail config to %s: ", dsconfdest)
|
||||
if err := zfsCopyIncremental(fmt.Sprintf("%s@gocage_mig_init", dsconf),
|
||||
fmt.Sprintf("%s@gocage_mig_last_sync", dsconf),
|
||||
dsconfdest); err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
}
|
||||
fmt.Printf("Done\n")
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("Done\n")
|
||||
|
||||
fmt.Printf("Synchronize jail filesystem dataset to %s: ", dsdatadest)
|
||||
if err := zfsCopyIncremental(fmt.Sprintf("%s@gocage_mig_init", dsdata),
|
||||
fmt.Sprintf("%s@gocage_mig_last_sync", dsdata),
|
||||
dsdatadest); err != nil {
|
||||
return
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
}
|
||||
fmt.Printf("Done\n")
|
||||
|
||||
// TODO : Start jail on new datastore (! Currently ListJails won't support the double with same name !)
|
||||
// TODO : Start jail on new datastore (! Currently ListJails won't support 2 jails with same name !)
|
||||
|
||||
// TODO : zfs destroy destpool/jails/jail_name@gocage_mig_first_snap
|
||||
// TODO : zfs destroy destpool/jails/jail_name/root@gocage_mig_first_snap
|
||||
|
Reference in New Issue
Block a user