Re: [kvm-devel] [PATCH] QEMU KVM balloon support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 08, 2008 at 01:43:40PM -0200, Marcelo Tosatti wrote:
> Index: kvm-userspace/qemu/monitor.c
> ===================================================================
> --- kvm-userspace.orig/qemu/monitor.c
> +++ kvm-userspace/qemu/monitor.c
> @@ -1339,6 +1339,8 @@ static term_cmd_t term_cmds[] = {
>        "", "cancel the current VM migration" },
>      { "migrate_set_speed", "s", do_migrate_set_speed,
>        "value", "set maximum speed (in bytes) for migrations" },
> +    { "setmem", "s", do_setmemory, "value", 
> +      "set memory for the guest (in bytes)" },
>      { NULL, NULL, },
>  };

[snip]

> +void do_setmemory(const char *value)
> +{
> +	int target_ramsize;
> +	char *ptr;
> +
> +	target_ramsize = strtol(value, &ptr, 10);
> +	switch (*ptr) {
> +	case 'G': case 'g':
> +		target_ramsize *= 1024;
> +	case 'M': case 'm':
> +		target_ramsize *= 1024;
> +	case 'K': case 'k':
> +		target_ramsize *= 1024;
> +	default:
> +		break;
> +	}
> +
> +	if (target_ramsize > ram_size) {
> +		term_printf("Invalid RAM size, maximum: %d\n", ram_size);
> +		return;
> +	}
> +	
> +	balloon_update_target(target_ramsize);
> +}

Shouldn't this use  int64, and strtoll(), otherwise you'll wrap
at the 2 GB mark ?

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux