File tree 2 files changed +23
-3
lines changed
2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ All Notable changes to `php-lxd` will be documented in this file.
4
4
5
5
Updates should follow the [ Keep a CHANGELOG] ( http://keepachangelog.com/ ) principles.
6
6
7
+ ## [ 0.12.2]
8
+
9
+ ## Added
10
+ - Support for using container snapshot as source for migration
11
+
7
12
## [ 0.12.1]
8
13
9
14
### Added
Original file line number Diff line number Diff line change @@ -367,11 +367,26 @@ public function migrate(
367
367
*/
368
368
public function initMigration ($ name )
369
369
{
370
- $ migration = $ this ->post ($ this ->getEndpoint ().$ name , ['migration ' => true ]);
370
+ $ containerName = "" ;
371
+
372
+ if (strpos ($ name , "/ " ) !== false ) {
373
+ $ parts = explode ("/ " , $ name );
374
+ $ partsLength = count ($ parts );
375
+ if ($ partsLength == 0 || $ partsLength > 2 ) {
376
+ throw new \Exception ("Snapshot name format not correct " , 1 );
377
+ }
378
+ $ containerName = $ parts [0 ];
379
+ $ container = $ this ->snapshots ->info ($ containerName , $ parts [1 ]);
380
+ } else {
381
+ $ containerName = $ name ;
382
+ $ container = $ this ->info ($ name );
383
+ }
384
+
385
+ $ migration = $ this ->post ($ this ->getEndpoint ().$ containerName , ['migration ' => true ]);
386
+
371
387
$ host = $ this ->client ->host ->info ();
372
- $ container = $ this ->info ($ name );
373
- $ url = $ this ->client ->getUrl ().'/ ' .$ this ->client ->getApiVersion ().'/operations/ ' .$ migration ['id ' ];
374
388
389
+ $ url = $ this ->client ->getUrl ().'/ ' .$ this ->client ->getApiVersion ().'/operations/ ' .$ migration ['id ' ];
375
390
376
391
$ settings = [
377
392
'name ' => $ name ,
You can’t perform that action at this time.
0 commit comments