@@ -165,12 +165,13 @@ func (b *backend) Driver() drivers.Driver {
165
165
return b .driver
166
166
}
167
167
168
- // MigrationTypes returns the migration transport method preferred when sending a migration,
169
- // based on the migration method requested by the driver's ability. The snapshots argument
170
- // indicates whether snapshots are migrated as well. It is used to determine whether to use
171
- // optimized migration.
172
- func (b * backend ) MigrationTypes (contentType drivers.ContentType , refresh bool , copySnapshots bool ) []localMigration.Type {
173
- return b .driver .MigrationTypes (contentType , refresh , copySnapshots )
168
+ // MigrationTypes returns the migration transport method preferred when sending a migration, based
169
+ // on the migration method requested by the driver's ability. The copySnapshots argument indicates
170
+ // whether snapshots are migrated as well. clusterMove determines whether the migration is done
171
+ // within a cluster and storageMove determines whether the storage pool is changed by the migration.
172
+ // This method is used to determine whether to use optimized migration.
173
+ func (b * backend ) MigrationTypes (contentType drivers.ContentType , refresh bool , copySnapshots bool , clusterMove bool , storageMove bool ) []localMigration.Type {
174
+ return b .driver .MigrationTypes (contentType , refresh , copySnapshots , clusterMove , storageMove )
174
175
}
175
176
176
177
// Create creates the storage pool layout on the storage device.
@@ -1150,9 +1151,9 @@ func (b *backend) CreateInstanceFromCopy(inst instance.Instance, src instance.In
1150
1151
l .Debug ("CreateInstanceFromCopy cross-pool mode detected" )
1151
1152
1152
1153
// Negotiate the migration type to use.
1153
- offeredTypes := srcPool .MigrationTypes (contentType , false , snapshots )
1154
+ offeredTypes := srcPool .MigrationTypes (contentType , false , snapshots , false , true )
1154
1155
offerHeader := localMigration .TypesToHeader (offeredTypes ... )
1155
- migrationTypes , err := localMigration .MatchTypes (offerHeader , FallbackMigrationType (contentType ), b .MigrationTypes (contentType , false , snapshots ))
1156
+ migrationTypes , err := localMigration .MatchTypes (offerHeader , FallbackMigrationType (contentType ), b .MigrationTypes (contentType , false , snapshots , false , true ))
1156
1157
if err != nil {
1157
1158
return fmt .Errorf ("Failed to negotiate copy migration type: %w" , err )
1158
1159
}
@@ -1196,6 +1197,7 @@ func (b *backend) CreateInstanceFromCopy(inst instance.Instance, src instance.In
1196
1197
AllowInconsistent : allowInconsistent ,
1197
1198
VolumeOnly : ! snapshots ,
1198
1199
Info : & localMigration.Info {Config : srcConfig },
1200
+ StorageMove : true ,
1199
1201
}, op )
1200
1202
})
1201
1203
@@ -1208,6 +1210,7 @@ func (b *backend) CreateInstanceFromCopy(inst instance.Instance, src instance.In
1208
1210
VolumeSize : srcVolumeSize , // Block size setting override.
1209
1211
TrackProgress : false , // Do not use a progress tracker on receiver.
1210
1212
VolumeOnly : ! snapshots ,
1213
+ StoragePool : srcPool .Name (),
1211
1214
}, op )
1212
1215
})
1213
1216
@@ -1398,9 +1401,9 @@ func (b *backend) RefreshCustomVolume(projectName string, srcProjectName string,
1398
1401
l .Debug ("RefreshCustomVolume cross-pool mode detected" )
1399
1402
1400
1403
// Negotiate the migration type to use.
1401
- offeredTypes := srcPool .MigrationTypes (contentType , true , snapshots )
1404
+ offeredTypes := srcPool .MigrationTypes (contentType , true , snapshots , false , true )
1402
1405
offerHeader := localMigration .TypesToHeader (offeredTypes ... )
1403
- migrationTypes , err := localMigration .MatchTypes (offerHeader , FallbackMigrationType (contentType ), b .MigrationTypes (contentType , true , snapshots ))
1406
+ migrationTypes , err := localMigration .MatchTypes (offerHeader , FallbackMigrationType (contentType ), b .MigrationTypes (contentType , true , snapshots , false , true ))
1404
1407
if err != nil {
1405
1408
return fmt .Errorf ("Failed to negotiate copy migration type: %w" , err )
1406
1409
}
@@ -1456,6 +1459,7 @@ func (b *backend) RefreshCustomVolume(projectName string, srcProjectName string,
1456
1459
TrackProgress : true , // Do use a progress tracker on sender.
1457
1460
ContentType : string (contentType ),
1458
1461
Info : & localMigration.Info {Config : srcConfig },
1462
+ StorageMove : true ,
1459
1463
}, op )
1460
1464
if err != nil {
1461
1465
cancel ()
@@ -1476,6 +1480,7 @@ func (b *backend) RefreshCustomVolume(projectName string, srcProjectName string,
1476
1480
ContentType : string (contentType ),
1477
1481
VolumeSize : volSize , // Block size setting override.
1478
1482
Refresh : true ,
1483
+ StoragePool : srcPoolName ,
1479
1484
}, op )
1480
1485
if err != nil {
1481
1486
cancel ()
@@ -1643,9 +1648,9 @@ func (b *backend) RefreshInstance(inst instance.Instance, src instance.Instance,
1643
1648
l .Debug ("RefreshInstance cross-pool mode detected" )
1644
1649
1645
1650
// Negotiate the migration type to use.
1646
- offeredTypes := srcPool .MigrationTypes (contentType , true , snapshots )
1651
+ offeredTypes := srcPool .MigrationTypes (contentType , true , snapshots , false , true )
1647
1652
offerHeader := localMigration .TypesToHeader (offeredTypes ... )
1648
- migrationTypes , err := localMigration .MatchTypes (offerHeader , FallbackMigrationType (contentType ), b .MigrationTypes (contentType , true , snapshots ))
1653
+ migrationTypes , err := localMigration .MatchTypes (offerHeader , FallbackMigrationType (contentType ), b .MigrationTypes (contentType , true , snapshots , false , true ))
1649
1654
if err != nil {
1650
1655
return fmt .Errorf ("Failed to negotiate copy migration type: %w" , err )
1651
1656
}
@@ -1686,6 +1691,7 @@ func (b *backend) RefreshInstance(inst instance.Instance, src instance.Instance,
1686
1691
Refresh : true , // Indicate to sender to use incremental streams.
1687
1692
Info : & localMigration.Info {Config : srcConfig },
1688
1693
VolumeOnly : ! snapshots ,
1694
+ StorageMove : true ,
1689
1695
}, op )
1690
1696
})
1691
1697
@@ -1699,6 +1705,7 @@ func (b *backend) RefreshInstance(inst instance.Instance, src instance.Instance,
1699
1705
VolumeSize : srcVolumeSize ,
1700
1706
TrackProgress : false , // Do not use a progress tracker on receiver.
1701
1707
VolumeOnly : ! snapshots ,
1708
+ StoragePool : srcPool .Name (),
1702
1709
}, op )
1703
1710
})
1704
1711
@@ -4812,9 +4819,9 @@ func (b *backend) CreateCustomVolumeFromCopy(projectName string, srcProjectName
4812
4819
l .Debug ("CreateCustomVolumeFromCopy cross-pool mode detected" )
4813
4820
4814
4821
// Negotiate the migration type to use.
4815
- offeredTypes := srcPool .MigrationTypes (contentType , false , snapshots )
4822
+ offeredTypes := srcPool .MigrationTypes (contentType , false , snapshots , false , true )
4816
4823
offerHeader := localMigration .TypesToHeader (offeredTypes ... )
4817
- migrationTypes , err := localMigration .MatchTypes (offerHeader , FallbackMigrationType (contentType ), b .MigrationTypes (contentType , false , snapshots ))
4824
+ migrationTypes , err := localMigration .MatchTypes (offerHeader , FallbackMigrationType (contentType ), b .MigrationTypes (contentType , false , snapshots , false , true ))
4818
4825
if err != nil {
4819
4826
return fmt .Errorf ("Failed to negotiate copy migration type: %w" , err )
4820
4827
}
@@ -4874,6 +4881,7 @@ func (b *backend) CreateCustomVolumeFromCopy(projectName string, srcProjectName
4874
4881
ContentType : string (contentType ),
4875
4882
Info : & localMigration.Info {Config : srcConfig },
4876
4883
VolumeOnly : ! snapshots ,
4884
+ StorageMove : true ,
4877
4885
}, op )
4878
4886
if err != nil {
4879
4887
cancel ()
@@ -4894,6 +4902,7 @@ func (b *backend) CreateCustomVolumeFromCopy(projectName string, srcProjectName
4894
4902
ContentType : string (contentType ),
4895
4903
VolumeSize : volSize , // Block size setting override.
4896
4904
VolumeOnly : ! snapshots ,
4905
+ StoragePool : srcPool .Name (),
4897
4906
}, op )
4898
4907
if err != nil {
4899
4908
cancel ()
0 commit comments