How do you create a new vm from an imported disk



  • Hi Guys,

    I'm trying to migrate my lab setup from kvm to xcp-ng.

    I am trying to migrate my first test machine and have hit a bit of a road block.

    I have converted and imported the old disk (qcow2 image to vhd conversion and import) and can see the disk in the sr OK.

    What I can't figure out is how to create a new vm based on this disk.

    I have seen some things suggesting that its the template type which dictates whether I can attach an existing disk, but so far I haven't managed to find one that lets me. So far, I only seem to be able to create a new disk and use that.

    Is this possible? If so how is it done?

    Ta.
    P.



  • I would do it like this --

    • Create the VM using the desired template
    • Delete the "default" disk from the VM
    • Attach the imported disk

  • XCP-ng Team

    I would do the same: create a VM without disk with the closest template possible (eg Ubuntu for an Ubuntu imported VM), don't boot it. Then, attach an existing disk, and boot it 🙂



  • Close... but it can't find a boot disk by the looks of things.

    I'll have to play further.

    P.


  • XCP-ng Team

    What do you mean? Can you be more explicit?



  • The VM tries to boot to the newly added .vhd disk, but is unable to find anything to boot from.

    P.


  • XCP-ng Team

    Try to boot with a live CD (eg Ubuntu) and access the disk content from there. Maybe you need to chroot and reinstall grub, and reload initrd if Xen drivers aren't there.



  • I found the instructions here https://github.com/xcp-ng/xcp/wiki/Migrating-from-other-hypervisors and it talks about using dracut on the vm before the export, do you think this is worth a try?


  • XCP-ng Team

    That might do the trick, yes 🙂 Worth trying!



  • Groan... maybe testing with a machine what actually boots in kvm to start with would be a good idea... trust me to pick a broken machine to test with... now.. lets try that again shall we? Sorry for wasting your time all... will report back how I go with a working machine.

    P.


  • XCP-ng Team

    hahaha 😄 no worries, it happens 😛



  • So very very close.

    I have migrated a ubuntu 19.04 machine from KVM to my lab, and managed to get it to boot, until!! I tried to attach the guest-tools cd to install them.

    I got an error that said the cd is not fully installed, restart the vm.

    I tried that, and now the machine refuses to boot at all with the old "unknown error".

    vm.start
    {
      "id": "3ffe9f7e-cf37-3003-348f-766c7059ff49"
    }
    {
      "code": "VDI_MISSING",
      "params": [
        "OpaqueRef:a70e1e33-4a17-4d6b-961f-6e4044aed54d",
        "OpaqueRef:0aa6eb4a-1c93-4227-952c-ec47fb3b29fe"
      ],
      "call": {
        "method": "VM.start",
        "params": [
          "OpaqueRef:72c1f833-98d9-41b8-80b4-f531cdd77861",
          false,
          false
        ]
      },
      "message": "VDI_MISSING(OpaqueRef:a70e1e33-4a17-4d6b-961f-6e4044aed54d, OpaqueRef:0aa6eb4a-1c93-4227-952c-ec47fb3b29fe)",
      "name": "XapiError",
      "stack": "XapiError: VDI_MISSING(OpaqueRef:a70e1e33-4a17-4d6b-961f-6e4044aed54d, OpaqueRef:0aa6eb4a-1c93-4227-952c-ec47fb3b29fe)
        at Function.wrap (/home/pnunn/xen-orchestra/packages/xen-api/src/_XapiError.js:16:12)
        at _httpRequestPlus.default.post.readAll.then.text (/home/pnunn/xen-orchestra/packages/xen-api/src/transports/json-rpc.js:35:27)
        at tryCatcher (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/util.js:16:23)
        at Promise._settlePromiseFromHandler (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/promise.js:547:31)
        at Promise._settlePromise (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/promise.js:604:18)
        at Promise._settlePromise0 (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/promise.js:649:10)
        at Promise._settlePromises (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/promise.js:729:18)
        at _drainQueueStep (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/async.js:93:12)
        at _drainQueue (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/async.js:86:9)
        at Async._drainQueues (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/async.js:102:5)
        at Immediate.Async.drainQueues [as _onImmediate] (/home/pnunn/xen-orchestra/node_modules/bluebird/js/release/async.js:15:14)
        at runCallback (timers.js:705:18)
        at tryOnImmediate (timers.js:676:5)
        at processImmediate (timers.js:658:5)"
    } 
    
    
    

  • XCP-ng Team

    Eject the CD and try to boot.



  • Ughh. thought I tried that. Just did it with the machine off and its now booting again, thank you, however, that doesn't get the tools installed.

    After some mucking around, it seems I can mount pretty much any other .iso from the iso store but note the guest-tools.iso for some reason. It just does nothing now (as in, the pulldown list is just showing "select disk(s)".



  • OK, seems I wasn't trying hard enough.

    I was trying to mount the tools under the iso list, but when I look further down the list to xc-ng Tools it turns out I can mount the tools from there as long as I do it manually (mount /dev/sr0 /media/blahblah).

    Installed now, all good.


Log in to reply
 

XCP-ng Pro Support

XCP-ng Pro Support