MCPcopy
hub / github.com/lxc/incus / askDisk

Method askDisk

cmd/incus-migrate/migrate_instance.go:508–543  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

506}
507
508func (m *InstanceMigration) askDisk() error {
509 volMigrator, ok := newVolumeMigration(m.ctx, m.server, m.asker, m.flagRsyncArgs).(*VolumeMigration)
510 if !ok {
511 return errors.New("Migrator should be of type VolumeMigration")
512 }
513
514 volMigrator.project = m.project
515
516 err := volMigrator.gatherInfo()
517 if err != nil {
518 return err
519 }
520
521 if m.migrationType == MigrationTypeContainer && volMigrator.migrationType == MigrationTypeVolumeBlock {
522 return errors.New("Block disk is not supported by the container")
523 }
524
525 m.instanceArgs.Devices[volMigrator.customVolumeArgs.Name] = map[string]string{
526 "type": "disk",
527 "pool": volMigrator.pool,
528 "source": volMigrator.customVolumeArgs.Name,
529 }
530
531 if volMigrator.migrationType == MigrationTypeVolumeFilesystem {
532 mountPath, err := m.asker.AskString("Provide mount path for this disk: ", "", nil)
533 if err != nil {
534 return err
535 }
536
537 m.instanceArgs.Devices[volMigrator.customVolumeArgs.Name]["path"] = mountPath
538 }
539
540 m.volumes = append(m.volumes, volMigrator)
541
542 return nil
543}
544
545func (m *InstanceMigration) askUEFISupport() error {
546 if m.instanceArgs.Type == api.InstanceTypeVM {

Callers 1

renderObjectMethod · 0.95

Calls 3

newVolumeMigrationFunction · 0.85
AskStringMethod · 0.80
gatherInfoMethod · 0.65

Tested by

no test coverage detected