Fix migrate: use datastore.ZFSDataset for replication to dest
This commit is contained in:
parent
e84c43c759
commit
2151034a02
@ -6,8 +6,6 @@ import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -20,6 +18,7 @@ const (
|
||||
*******************************************************************************/
|
||||
func MigrateJail(args []string) {
|
||||
var jailNames []string
|
||||
var destDS Datastore
|
||||
|
||||
if len(args) > 0 {
|
||||
for _, a := range args {
|
||||
@ -29,16 +28,12 @@ func MigrateJail(args []string) {
|
||||
|
||||
for _, jn := range jailNames {
|
||||
// Check if destination datastore exist
|
||||
/*cmd := fmt.Sprintf("zfs list %s/iocage/jails", gMigrateDestDatastore)
|
||||
out, err := executeCommand(cmd)
|
||||
if err != nil {
|
||||
fmt.Printf("Error executing command %s: %v; command returned: %s\n", cmd, err, out)
|
||||
return
|
||||
}*/
|
||||
found := false
|
||||
for _, ds := range viper.GetStringSlice("datastore") {
|
||||
if strings.EqualFold(gMigrateDestDatastore, ds) {
|
||||
for _, ds := range gDatastores {
|
||||
if strings.EqualFold(gMigrateDestDatastore, ds.Name) {
|
||||
found = true
|
||||
destDS = ds
|
||||
break
|
||||
}
|
||||
}
|
||||
if false == found {
|
||||
@ -96,16 +91,14 @@ func MigrateJail(args []string) {
|
||||
}
|
||||
fmt.Printf("Done\n")
|
||||
|
||||
// FIXME: Must use zfs dataset, not mountpoint stored in gMigrateDestDatastore
|
||||
dsconfdest := strings.Join([]string{gMigrateDestDatastore, "iocage", "jails", jn}, "/")
|
||||
dsconfdest := strings.Join([]string{destDS.ZFSDataset, "jails", jn}, "/")
|
||||
fmt.Printf("Migrate jail config dataset to %s: ", dsconfdest)
|
||||
if err := zfsCopy(fmt.Sprintf("%s@gocage_mig_init", dsconf), dsconfdest); err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
}
|
||||
fmt.Printf("Done\n")
|
||||
|
||||
// FIXME: Must use zfs dataset, not mountpoint stored in gMigrateDestDatastore
|
||||
dsdatadest := strings.Join([]string{gMigrateDestDatastore, "iocage", "jails", jn, "root"}, "/")
|
||||
dsdatadest := strings.Join([]string{destDS.ZFSDataset, "jails", jn, "root"}, "/")
|
||||
fmt.Printf("Migrate jail filesystem dataset to %s: ", dsdatadest)
|
||||
if err := zfsCopy(fmt.Sprintf("%s@gocage_mig_init", dsdata), dsdatadest); err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
|
Loading…
Reference in New Issue
Block a user