[pve-devel] qemu-server : add new qm import_disk feature

Alexandre DERUMIER aderumier at odiso.com
Thu Jan 19 10:24:17 CET 2017

The problem with 1),

it's that users don't have always local file storage space. 
(for example, they have only small local disk and disks are on a san, or they have big lvmthin storage but no space for files)

My students/customers generaly export image on usb drive or network share,

and don't known nothing about directory structure (/images/vmid/vm-ID-whatever)
and don't want to define a storage for this in proxmox configuration.

I'm more to implement root permission only and add some regex for paths. (CLI only is enough)

----- Mail original -----
De: "Fabian Grünbichler" <f.gruenbichler at proxmox.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Jeudi 19 Janvier 2017 10:08:34
Objet: Re: [pve-devel] qemu-server : add new qm import_disk feature

On Thu, Jan 19, 2017 at 07:17:29AM +0100, Alexandre Derumier wrote: 
> We had discuted last year about a method to import external image (vmware,xen,hyperv) to a proxmox vm 
> http://pve.proxmox.com/pipermail/pve-devel/2016-January/018757.html 
> This mostly the feature that all my training students wants each time. (because they don't known how to create target volume manually and qemu-img syntax) 
> This patches serie add a new method "qm import_disk $vmid $image $targetstorage" 

definite NACK in this form. passing arbitrary paths via the API without 
limiting to root at pam is a grave security risk, even when just passing 
them to qemu-img for reading. so such functionality should be limited to 
the CLI, where what you want to achieve is already possible: 

1.) put disk in place on dir storage 

put disk image on directory storage with a name like "vm-ID-whatever": 
# pvesm alloc local 105 vm-105-disk-import-test.raw 1G 

(or with cp, scp, rsync, ... for an actual existing image) 

but now it is not yet in the VM config: 
# qm config 105 | grep -c disk-import-test 

2.) rescan disks 

so tell PVE to add matching non-referenced disks as unused: 
# qm rescan -vmid 105 

now it is added as unused: 
# qm config 105 | grep disk-import-test 
unused0: local:105/vm-105-disk-import-test.raw 

3.) use disk 

and you can re-add it as used disk and move disk (this part is possible 
for regular users on the GUI as well): 

# qm set 105 -scsi0 local:105/vm-105-disk-import-test.raw 
update VM 105: -scsi0 local:105/vm-105-disk-import-test.raw 

# qm move_disk 105 scsi0 bigpool 
create full clone of drive scsi0 (local:105/vm-105-disk-import-test.raw) 
transferred: 0 bytes remaining: 1073741824 bytes total: 1073741824 bytes progression: 0.00 % 
transferred: 1073741824 bytes remaining: 0 bytes total: 1073741824 bytes progression: 100.00 % 

pve-devel mailing list 
pve-devel at pve.proxmox.com 

More information about the pve-devel mailing list