Re: [Libguestfs] [PATCH 4/4] daemon: add split_lines_sb

2015-06-17 Thread Richard W.M. Jones
ACK series. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines

Re: [Libguestfs] [PATCH] daemon: parted: Always use -s option even with -m.

2015-06-17 Thread Richard W.M. Jones
On Wed, Jun 17, 2015 at 05:23:53PM +0100, Richard W.M. Jones wrote: See: https://bugzilla.redhat.com/show_bug.cgi?id=1232241#c3 --- daemon/parted.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/parted.c b/daemon/parted.c index a36e4e7..59760b4 100644 ---

Re: [Libguestfs] [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value

2015-06-17 Thread Chen, Hanxiao
Hi, Pino -Original Message- From: libguestfs-boun...@redhat.com [mailto:libguestfs-boun...@redhat.com] On Behalf Of Pino Toscano Sent: Wednesday, June 17, 2015 10:44 PM To: libguestfs@redhat.com Subject: Re: [Libguestfs] [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return

Re: [Libguestfs] [PATCH v2 1/2] Modify public function: analyze_line, make it more flexible

2015-06-17 Thread Cao jin
Hi Pino 在 2015年06月17日 19:15, Pino Toscano 写道: On Wednesday 17 June 2015 16:44:07 Cao jin wrote: Mofify the function from fixed dilemiter to variabler. So, it could be used in more APIs later. Also modified the existed caller Not to sound too overly pedantic on English (especially that I'm

Re: [Libguestfs] [PATCH v4 1/3] do_btrfs_qgroup_show: fix a bad return value

2015-06-17 Thread Chen, Hanxiao
-Original Message- From: libguestfs-boun...@redhat.com [mailto:libguestfs-boun...@redhat.com] On Behalf Of Pino Toscano Sent: Wednesday, June 17, 2015 10:28 PM To: libguestfs@redhat.com Subject: Re: [Libguestfs] [PATCH v4 1/3] do_btrfs_qgroup_show: fix a bad return value On

Re: [Libguestfs] [PATCH] New API: btrfs_device_stats

2015-06-17 Thread Cao jin
Hi, Pino 在 2015年06月17日 23:37, Pino Toscano 写道: Hi, On Wednesday 17 June 2015 10:12:59 Cao jin wrote: @@ -2083,3 +2083,72 @@ do_btrfs_image (char *const *sources, const char *image, return 0; } + +char ** +do_btrfs_device_stats (const char *path, int zero) +{ + const size_t MAX_ARGS

Re: [Libguestfs] [PATCH v2 1/2] Modify public function: analyze_line, make it more flexible

2015-06-17 Thread Pino Toscano
On Wednesday 17 June 2015 16:44:07 Cao jin wrote: Mofify the function from fixed dilemiter to variabler. So, it could be used in more APIs later. Also modified the existed caller Not to sound too overly pedantic on English (especially that I'm not a native speaker myself), but this needs to be

[Libguestfs] [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value

2015-06-17 Thread Chen Hanxiao
don't return a value which is to be freed. v4: use strndup v3: v3: fix test case failure Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- daemon/btrfs.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index

[Libguestfs] [PATCH v4 0/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free

2015-06-17 Thread Chen Hanxiao
As Pino's comment, we should take advantage of macro CLEANUP_FREE_STRING_LIST v4: remove some redundant strdup v3: fix test case failure v2: properly initialize lines Chen Hanxiao (3): do_btrfs_qgroup_show: fix a bad return value do_btrfs_subvolume_list: fix a bad return value btrfs: use

[Libguestfs] [PATCH v4 1/3] do_btrfs_qgroup_show: fix a bad return value

2015-06-17 Thread Chen Hanxiao
We should not use tmp lines buffer as return value, for lines buffer will be freed. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- v4: take advantage of sscanf's '%m'. v3: fix test case failure daemon/btrfs.c | 40 ++-- 1 file changed, 18

Re: [Libguestfs] [PATCH v2] New API: btrfs_replace

2015-06-17 Thread Cao jin
Hi, pino 在 2015年06月16日 21:58, Pino Toscano 写道: On Monday 15 June 2015 15:52:31 Cao jin wrote: Signed-off-by: Cao jin caoj.f...@cn.fujitsu.com --- daemon/btrfs.c| 37 ++ generator/actions.ml | 16 tests/btrfs/Makefile.am |

Re: [Libguestfs] [PATCH] btrfs: keep calloc and its error message match

2015-06-17 Thread Pino Toscano
On Wednesday 17 June 2015 10:44:09 Chen Hanxiao wrote: commit 3f4ba2e98d21746723d291939ccc2e1f1526aa6d left some error messages unchanged. That commit was about converting a couple of malloc+memset to calloc, not about replacing messages in other parts. Hence, this note is wrong.

[Libguestfs] [PATCH v4 02/11] resize: add logical_partitions and extended_partition

2015-06-17 Thread Chen Hanxiao
For MBR, logical partitions laid inside extended partition. Add 3 variables to describe this: - partitions flat list of primary partitions (as now, the global 'partitions'). extended partitions is essentially primary partition - logical_partitions flat list of logical partitions -

[Libguestfs] [PATCH v4 00/11] virt-resize: add support for resizing MBR logical partitions

2015-06-17 Thread Chen Hanxiao
In current virt-resize, only primary partitions(including extended partition) are supported. They are collected in an array for resize operations. Logical partitions are not supported. This series add support for resizing logical partitions. v4: rebase on upstream. v3: 1) rewrite

[Libguestfs] [PATCH v4 05/11] resize: handle resize of logical partitions

2015-06-17 Thread Chen Hanxiao
This will re-calculate the size of logical partitions. and take logical partitions' aligment into account. If needed, update extended partition's OpResize. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- resize/resize.ml | 31 +++ 1 file changed, 31

[Libguestfs] [PATCH v4 03/11] resize: calculate max alignment of logical partitions

2015-06-17 Thread Chen Hanxiao
If a logical/extended partition is resized, we had to re-calculate all the position of logical partitions. For logical partitions can't be placed just next to each other, we had to think about the loss of the size because of the alignment of recalculation. This patch will calculate a max number to

[Libguestfs] [PATCH v4 11/11] resize: test: add support for resizing extended and logical partitions

2015-06-17 Thread Chen Hanxiao
Signed-off-by: Hu Tao hu...@cn.fujitsu.com Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- resize/test-virt-resize.pl | 32 +--- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/resize/test-virt-resize.pl b/resize/test-virt-resize.pl index

Re: [Libguestfs] [PATCH v4 3/3] btrfs: use CLEANUP_FREE_STRING_LIST for list free

2015-06-17 Thread Pino Toscano
On Wednesday 17 June 2015 16:19:33 Chen Hanxiao wrote: Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- daemon/btrfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 5361984..88be9ec 100644 --- a/daemon/btrfs.c +++

Re: [Libguestfs] [PATCH] btrfs: keep calloc and its error message match

2015-06-17 Thread Chen, Hanxiao
-Original Message- From: libguestfs-boun...@redhat.com [mailto:libguestfs-boun...@redhat.com] On Behalf Of Pino Toscano Sent: Wednesday, June 17, 2015 5:08 PM To: libguestfs@redhat.com Subject: Re: [Libguestfs] [PATCH] btrfs: keep calloc and its error message match On

[Libguestfs] [PATCH v2 1/2] Modify public function: analyze_line, make it more flexible

2015-06-17 Thread Cao jin
Mofify the function from fixed dilemiter to variabler. So, it could be used in more APIs later. Also modified the existed caller Signed-off-by: Cao jin caoj.f...@cn.fujitsu.com --- daemon/btrfs.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/daemon/btrfs.c

[Libguestfs] [PATCH v4 10/11] resize: add support resize extended partition

2015-06-17 Thread Chen Hanxiao
Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- resize/resize.ml | 41 - 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/resize/resize.ml b/resize/resize.ml index 000a4f8..9dfa21e 100644 --- a/resize/resize.ml +++

[Libguestfs] [PATCH v4 06/11] resize: add support for logical partitions of calculate_target_partitions

2015-06-17 Thread Chen Hanxiao
This patch add support for logical partitions. 1) OpResize newsize: an additional parameter for resizing logical partitions: - gap_start For logical partitions, we had to reserce at least 1 gap between each other. Also, we may had an extra aligment between 1st logical partition

[Libguestfs] [PATCH v4 01/11] resize: move loop check from find_partitions

2015-06-17 Thread Chen Hanxiao
As logical partitions laid inside extended partition, overlap check will not work. make loop as a individual function, which could do a seperate check on logical/extended partitions. Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- resize/resize.ml | 20 ++-- 1 file

[Libguestfs] [PATCH v4 08/11] resize: parted and copy logical partitions

2015-06-17 Thread Chen Hanxiao
Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- resize/resize.ml | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/resize/resize.ml b/resize/resize.ml index 7d99b38..b4236ab 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -1258,6

[Libguestfs] [PATCH v4 09/11] resize: more misc ops on logical partition

2015-06-17 Thread Chen Hanxiao
Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- resize/resize.ml | 9 + 1 file changed, 9 insertions(+) diff --git a/resize/resize.ml b/resize/resize.ml index b4236ab..000a4f8 100644 --- a/resize/resize.ml +++ b/resize/resize.ml @@ -1322,6 +1322,7 @@ read the man page

[Libguestfs] [PATCH v4 04/11] resize: add support for logical partitions for calculate_surplus

2015-06-17 Thread Chen Hanxiao
Add support for logical partitions. - add max_logi_align for calculate_surplus If we resize logical partition, we will lose size becasue of alignment. max_logi_align shows the max loss for alignment, which can ensure a successfully resize - don't count size of extended partition For

Re: [Libguestfs] [PATCH v4 2/3] do_btrfs_subvolume_list: fix a bad return value

2015-06-17 Thread Pino Toscano
On Wednesday 17 June 2015 16:19:32 Chen Hanxiao wrote: don't return a value which is to be freed. v4: use strndup v3: v3: fix test case failure Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- daemon/btrfs.c | 26 +- 1 file changed, 17 insertions(+), 9

Re: [Libguestfs] [PATCH v4 1/3] do_btrfs_qgroup_show: fix a bad return value

2015-06-17 Thread Pino Toscano
On Wednesday 17 June 2015 16:19:31 Chen Hanxiao wrote: We should not use tmp lines buffer as return value, for lines buffer will be freed. s/tmp/temporary/ Signed-off-by: Chen Hanxiao chenhanx...@cn.fujitsu.com --- v4: take advantage of sscanf's '%m'. v3: fix test case failure

Re: [Libguestfs] Add Remote Disk with SAS Key

2015-06-17 Thread Pino Toscano
On Tuesday 16 June 2015 23:21:35 Richard W.M. Jones wrote: https://bugzilla.redhat.com/show_bug.cgi?id=1232476 guestfish drops -a URL?query parameters This is https://bugzilla.redhat.com/show_bug.cgi?id=1092583 actually. -- Pino Toscano ___

Re: [Libguestfs] [PATCH] New API: btrfs_device_stats

2015-06-17 Thread Pino Toscano
Hi, On Wednesday 17 June 2015 10:12:59 Cao jin wrote: @@ -2083,3 +2083,72 @@ do_btrfs_image (char *const *sources, const char *image, return 0; } + +char ** +do_btrfs_device_stats (const char *path, int zero) +{ + const size_t MAX_ARGS = 64; + const char

[Libguestfs] [PATCH] daemon: parted: Always use -s option even with -m.

2015-06-17 Thread Richard W.M. Jones
See: https://bugzilla.redhat.com/show_bug.cgi?id=1232241#c3 --- daemon/parted.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/parted.c b/daemon/parted.c index a36e4e7..59760b4 100644 --- a/daemon/parted.c +++ b/daemon/parted.c @@ -356,7 +356,7 @@ print_partition_table

[Libguestfs] [PATCH 4/4] daemon: add split_lines_sb

2015-06-17 Thread Pino Toscano
Mold split_lines_sb from split_lines, so it returns the strings buffer with the result of the split. This way, we can have the number of lines in the array, with no need to count them again later. split_lines is rewritten to take the ownership of the result of split_lines_sb. --- daemon/daemon.h

[Libguestfs] [PATCH 2/4] daemon: add CLEANUP_FREE_STRINGSBUF

2015-06-17 Thread Pino Toscano
--- daemon/daemon.h | 3 +++ daemon/guestfsd.c | 6 ++ 2 files changed, 9 insertions(+) diff --git a/daemon/daemon.h b/daemon/daemon.h index bed4dbc..d3ba148 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -178,6 +178,7 @@ extern void cleanup_free_string_list (void *ptr); extern

[Libguestfs] [PATCH 3/4] daemon: add take_stringsbuf

2015-06-17 Thread Pino Toscano
--- daemon/daemon.h | 1 + daemon/guestfsd.c | 12 2 files changed, 13 insertions(+) diff --git a/daemon/daemon.h b/daemon/daemon.h index d3ba148..f2244b0 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -92,6 +92,7 @@ extern int add_string (struct stringsbuf *sb, const char

[Libguestfs] [PATCH 1/4] daemon: introduce free_stringsbuf

2015-06-17 Thread Pino Toscano
Simple shortcut to easily cleanup a stringsbuf. --- daemon/daemon.h | 1 + daemon/guestfsd.c | 7 +++ 2 files changed, 8 insertions(+) diff --git a/daemon/daemon.h b/daemon/daemon.h index 53cb797..bed4dbc 100644 --- a/daemon/daemon.h +++ b/daemon/daemon.h @@ -92,6 +92,7 @@ extern int