@@ -346,9 +346,17 @@ public function copy($name, $copyName, array $options = [], $wait = false)
346
346
* @param bool $wait Wait for operation to finish
347
347
* @return object
348
348
*/
349
- public function migrate (\Opensaucesystems \Lxd \Client $ destination , $ name , $ wait = false )
350
- {
351
- return $ destination ->containers ->create ($ name , $ this ->initMigration ($ name ), $ wait );
349
+ public function migrate (
350
+ \Opensaucesystems \Lxd \Client $ destination ,
351
+ $ name ,
352
+ string $ newName = "" ,
353
+ $ wait = false
354
+ ) {
355
+ if (empty ($ newName )) {
356
+ $ newName = $ name ;
357
+ }
358
+
359
+ return $ destination ->containers ->create ($ newName , $ this ->initMigration ($ name ), $ wait );
352
360
}
353
361
354
362
/**
@@ -364,11 +372,11 @@ public function initMigration($name)
364
372
$ container = $ this ->info ($ name );
365
373
$ url = $ this ->client ->getUrl ().'/ ' .$ this ->client ->getApiVersion ().'/operations/ ' .$ migration ['id ' ];
366
374
367
- return [
375
+
376
+ $ settings = [
368
377
'name ' => $ name ,
369
378
'architecture ' => $ container ['architecture ' ],
370
379
'config ' => $ container ['config ' ],
371
- 'devices ' => $ container ['devices ' ],
372
380
'epehemeral ' => $ container ['ephemeral ' ],
373
381
'profiles ' => $ container ['profiles ' ],
374
382
'source ' => [
@@ -379,6 +387,12 @@ public function initMigration($name)
379
387
'secrets ' => $ migration ['metadata ' ],
380
388
]
381
389
];
390
+
391
+ if (!empty ($ container ["devices " ])) {
392
+ $ settings ["devices " ] = $ container ["devices " ];
393
+ }
394
+
395
+ return $ settings ;
382
396
}
383
397
384
398
/**
0 commit comments