qga: implement qmp_guest_set_vcpus() for Linux with sysfs
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
		
							parent
							
								
									d2baff6253
								
							
						
					
					
						commit
						cbb65fc27f
					
				@ -1245,6 +1245,32 @@ GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
 | 
				
			|||||||
    return NULL;
 | 
					    return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    int64_t processed;
 | 
				
			||||||
 | 
					    Error *local_err = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    processed = 0;
 | 
				
			||||||
 | 
					    while (vcpus != NULL) {
 | 
				
			||||||
 | 
					        transfer_vcpu(vcpus->value, false, &local_err);
 | 
				
			||||||
 | 
					        if (local_err != NULL) {
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        ++processed;
 | 
				
			||||||
 | 
					        vcpus = vcpus->next;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (local_err != NULL) {
 | 
				
			||||||
 | 
					        if (processed == 0) {
 | 
				
			||||||
 | 
					            error_propagate(errp, local_err);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            error_free(local_err);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return processed;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#else /* defined(__linux__) */
 | 
					#else /* defined(__linux__) */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void qmp_guest_suspend_disk(Error **err)
 | 
					void qmp_guest_suspend_disk(Error **err)
 | 
				
			||||||
@ -1274,6 +1300,12 @@ GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
 | 
				
			|||||||
    return NULL;
 | 
					    return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    error_set(errp, QERR_UNSUPPORTED);
 | 
				
			||||||
 | 
					    return -1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if !defined(CONFIG_FSFREEZE)
 | 
					#if !defined(CONFIG_FSFREEZE)
 | 
				
			||||||
@ -1307,12 +1339,6 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    error_set(errp, QERR_UNSUPPORTED);
 | 
					 | 
				
			||||||
    return -1;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* register init/cleanup routines for stateful command groups */
 | 
					/* register init/cleanup routines for stateful command groups */
 | 
				
			||||||
void ga_command_state_init(GAState *s, GACommandState *cs)
 | 
					void ga_command_state_init(GAState *s, GACommandState *cs)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user