[pve-devel] qemu2.7: cpu hotplug && hot-unplug v1

Alexandre DERUMIER aderumier at odiso.com
Tue Sep 13 02:52:48 CEST 2016


I also wonder if we could add block job transactions.

As qmp_backup start a loop of jobs for each drive, 
maybe manage them in transaction could be easier

----- Mail original -----
De: "aderumier" <aderumier at odiso.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Lundi 12 Septembre 2016 19:02:48
Objet: Re: [pve-devel] qemu2.7: cpu hotplug && hot-unplug v1

Also, 
qemu implement coroutines in backup_start(). 
(It's not a thread, just async, but could help) 




----- Mail original ----- 
De: "aderumier" <aderumier at odiso.com> 
À: "dietmar" <dietmar at proxmox.com> 
Cc: "pve-devel" <pve-devel at pve.proxmox.com> 
Envoyé: Lundi 12 Septembre 2016 18:56:16 
Objet: Re: [pve-devel] qemu2.7: cpu hotplug && hot-unplug v1 

>>No idea (and no docs/examples available?) 

I think using aiocontext is enough. 
(But I think that iothread still need to be enable on block device to use a different aiocontext than the main qemu context) 

look at the simple qmp_block_resize 


void qmp_block_resize(bool has_device, const char *device, 
bool has_node_name, const char *node_name, 
int64_t size, Error **errp) 
{ 
Error *local_err = NULL; 
BlockDriverState *bs; 
AioContext *aio_context; 
int ret; 

bs = bdrv_lookup_bs(has_device ? device : NULL, 
has_node_name ? node_name : NULL, 
&local_err); 
if (local_err) { 
error_propagate(errp, local_err); 
return; 
} 

aio_context = bdrv_get_aio_context(bs); 
aio_context_acquire(aio_context); 

if (!bdrv_is_first_non_filter(bs)) { 
error_setg(errp, QERR_FEATURE_DISABLED, "resize"); 
goto out; 
} 


/* complete all in-flight operations before resizing the device */ 
bdrv_drain_all(); 

if (size < 0) { 
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size"); 
goto out; 
} 

if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) { 
error_setg(errp, QERR_DEVICE_IN_USE, device); 
goto out; 
} 

/* complete all in-flight operations before resizing the device */ 
bdrv_drain_all(); 

ret = bdrv_truncate(bs, size); 
switch (ret) { 
case 0: 
break; 
case -ENOMEDIUM: 
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); 
break; 
case -ENOTSUP: 
error_setg(errp, QERR_UNSUPPORTED); 
break; 
case -EACCES: 
error_setg(errp, "Device '%s' is read only", device); 
break; 
case -EBUSY: 
error_setg(errp, QERR_DEVICE_IN_USE, device); 
break; 
default: 
error_setg_errno(errp, -ret, "Could not resize"); 
break; 
} 

out: 
aio_context_release(aio_context); 
} 


----- Mail original ----- 
De: "dietmar" <dietmar at proxmox.com> 
À: "aderumier" <aderumier at odiso.com> 
Cc: "pve-devel" <pve-devel at pve.proxmox.com> 
Envoyé: Lundi 12 Septembre 2016 17:36:45 
Objet: Re: [pve-devel] qemu2.7: cpu hotplug && hot-unplug v1 

> >>I also wonder if it would make sense to run the backup code 
> >>inside its own thread? I guess this would make the code simpler. 
> 
> Yes. It can have big advantage. 
> 
> If it share the main qemu thread, this can make slowdown or qemu hang is 
> backup process is hanging. 
> 
> Not sure how it's implemented in qemu drive_backup ? 

No idea (and no docs/examples available?) 

_______________________________________________ 
pve-devel mailing list 
pve-devel at pve.proxmox.com 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 

_______________________________________________ 
pve-devel mailing list 
pve-devel at pve.proxmox.com 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 




More information about the pve-devel mailing list