GNS3 / gns3-gui

GNS3 Graphical Network Simulator
http://www.gns3.com
GNU General Public License v3.0
2.17k stars 436 forks source link

Impossible to create a Qemu disk on remote server #558

Closed grossmj closed 9 years ago

grossmj commented 9 years ago

Looks like the "Create" button is hidden when the server is not local in the Qemu VM wizard.

julien-duponchelle commented 9 years ago

It's "normal" the code contributed code run the qemu-img directly on the GUI . If we want to support that we need to move all the code on server and create api calls.

grossmj commented 9 years ago

We have 2 options: create the disk image locally and then push it or do it on the remote server via API calls. Right now the Qemy VM Wizard provides no options when using GNS3 VM or any remote server, which is a problem.

julien-duponchelle commented 9 years ago

I just take a look on the problem and it's deeper than expected.

If we move image creation on server side which is better we can't allow user to choose the file location. The file location should be inside the VM. But for creating something in the VM you need the vm id, but in order to get the VM id you need the image....

Even if we choose to upload we have the same issue, we need the image to create the vm and we need the vm in order to to get the file path.

julien-duponchelle commented 9 years ago

I will start to move the code in the Qemu module on server because we are sure it's what we want.

julien-duponchelle commented 9 years ago

A possibility is in qemu image creation and update adding a field for creation image with a dictionnary of options:

Example:

POST /v1/projects/a1e920ca-338a-4e9f-b363-aa607b09dd80/qemu/vms HTTP/1.1
{
    "hda_disk_image_creation": {
        "type": "qcow2",
        "preallocation":  false,
       "metadata":  "...."
      "cluster_size": 454564564
    }
    "name": "PC TEST 1",
    "qemu_path": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmpyasp9636/qemu_x42",
    "ram": 1024
}

Or creating a disk image if the type passed to hda_disk_image is a dictionary:

POST /v1/projects/a1e920ca-338a-4e9f-b363-aa607b09dd80/qemu/vms HTTP/1.1
{
    "hda_disk_image": {
        "type": "qcow2",
        "preallocation":  false,
       "metadata":  "...."
      "cluster_size": 454564564
    }
    "name": "PC TEST 1",
    "qemu_path": "/var/folders/3s/r2wbv07n7wg4vrsn874lmxxh0000gn/T/tmpyasp9636/qemu_x42",
    "ram": 1024
}
julien-duponchelle commented 9 years ago

And we need to think about how to integrate it in the VM registry.

julien-duponchelle commented 9 years ago

My proposal is stupid, the image is not linked to the VM ID but to the VM template. You just need to provide an image absolute or relative path at the VM creation.

grossmj commented 9 years ago

Regarding disks I like the idea of nested configuration entries like:

    "hda_disk_image": {
        "file": "/opt/image.img",
        "type": "qcow2",
        "interface": "ide",
    }

This is going to be useful to support more options on disk, for instance https://github.com/GNS3/gns3-server/issues/278

julien-duponchelle commented 9 years ago

Yeah I agree. The only downside is nested mean to have a converter between 1.3 and 1.4 topologies.