Skip to contentSkip to conversation

guestfwd option doesn't allow supplementary , server, nowait

Qemu-devel Richard W.M. Jones 5 participants 19 messages Jul 21, 2009 – Jul 22, 2009

lore
Share & tools
lore
#0 lore raw

The option formerly known as -net channel was changed to:

-net user,guestfwd=[tcp]:server:port-dev

which in general would be an improvement. libguestfs currently uses:

-net channel,6666:unix:/some/path,server,nowait

which works (probably by accident, because the code happens not to use get_param_value). However in the new syntax that would be:

-net user,guestfwd=tcp:10.0.2.4:6666-unix:/some/path,server,nowait

This gives errors like:

qemu: invalid parameter 'server,nowait' in 'vlan=0,guestfwd=tcp:10.0.2.4:6666-unix:/tmp/libguestfshRZgxr/sock,server,nowait'

It seems like the code tries to do the right thing for the hostfwd and guestfwd parameters. There is a while loop which seems to check for these parameters explicitly, but it doesn't work -- I'm not sure why.

libguestfs is continuing to use the old, working -net channel form of this parameter, so please don't remove it.

Rich.

Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
#1 lore raw
Quoted 1 line · Richard W.M. Jones

libguestfs is continuing to use the old, working

                                           ^^^^^^^

Actually I'll take that back. guestfwd seems to get stuck / deadlocked after sending a couple of messages back and forwards.

Rich.

Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
#2 lore raw
In reply to Richard W.M. Jones
Quoted 10 lines · Richard W.M. Jones

The option formerly known as -net channel was changed to:

-net user,guestfwd=[tcp]:server:port-dev

which in general would be an improvement. libguestfs currently uses:

-net channel,6666:unix:/some/path,server,nowait

which works (probably by accident, because the code happens not to use get_param_value).

I suspect so...

Quoted 7 lines

However in the new syntax that would be:

-net user,guestfwd=tcp:10.0.2.4:6666-unix:/some/path,server,nowait

This gives errors like:

qemu: invalid parameter 'server,nowait' in 'vlan=0,guestfwd=tcp:10.0.2.4:6666-unix:/tmp/libguestfshRZgxr/sock,server,nowait'

Yep, that case does not fit into the syntax of comma-separated arguments. We need to find a new syntax within the given constraints. Need to think about it.

Quoted 4 lines

It seems like the code tries to do the right thing for the hostfwd and guestfwd parameters. There is a while loop which seems to check for these parameters explicitly, but it doesn't work -- I'm not sure why.

What is your precise qemu command line? I noticed that omitting "-net user" while specifying "-net channel" seems to miss instantiating a default slirp stack. That should be easy to fix, will have a look. If your problem is a different one, please describe the details.

Quoted 3 lines

libguestfs is continuing to use the old, working -net channel form of this parameter, so please don't remove it.

It won't be removed in the foreseeable future for backward compatibility. But we also need to fix the new format as the old one does not allow to specify the slirp stack it should be apply to.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 4 lines · Jan Kiszka

What is your precise qemu command line? I noticed that omitting "-net user" while specifying "-net channel" seems to miss instantiating a default slirp stack. That should be easy to fix, will have a look. If your problem is a different one, please describe the details.

This is my full command line, where $qemudir is my qemu git directory.

$qemudir/i386-softmmu/qemu -L $qemudir/pc-bios \
-drive file=/tmp/test.img,cache=off,if=ide \
-m 500 -no-reboot \
-kernel /tmp/libguestfsivUi3g/kernel -initrd /tmp/libguestfsivUi3g/initrd \
-append 'panic=1 console=ttyS0 udevtimeout=300 noapic acpi=off guestfs=10.0.2.4:6666 guestfs_verbose=1' \
-nographic -serial stdio \
-net channel,6666:unix:/tmp/libguestfsivUi3g/sock,server,nowait \
-net user,vlan=0 \
-net nic,model=virtio,vlan=0 \
-no-hpet -rtc-td-hack

The above works with qemu 0.10.4, but not with qemu 0.10.5 where there is a hang (which I'm investigating - first send from guest -> host works, response from host -> guest disappears into the ether somewhere).

Quoted 7 lines
Quoted 3 lines

libguestfs is continuing to use the old, working -net channel form of this parameter, so please don't remove it.

It won't be removed in the foreseeable future for backward compatibility. But we also need to fix the new format as the old one does not allow to specify the slirp stack it should be apply to.

Good to know, thanks.

Rich.

Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
#4 lore raw
Quoted 19 lines · Richard W.M. Jones
Quoted 4 lines · Jan Kiszka

What is your precise qemu command line? I noticed that omitting "-net user" while specifying "-net channel" seems to miss instantiating a default slirp stack. That should be easy to fix, will have a look. If your problem is a different one, please describe the details.

This is my full command line, where $qemudir is my qemu git directory.

$qemudir/i386-softmmu/qemu -L $qemudir/pc-bios \
-drive file=/tmp/test.img,cache=off,if=ide \
-m 500 -no-reboot \
-kernel /tmp/libguestfsivUi3g/kernel -initrd /tmp/libguestfsivUi3g/initrd \
-append 'panic=1 console=ttyS0 udevtimeout=300 noapic acpi=off guestfs=10.0.2.4:6666 guestfs_verbose=1' \
-nographic -serial stdio \
-net channel,6666:unix:/tmp/libguestfsivUi3g/sock,server,nowait \
-net user,vlan=0 \
-net nic,model=virtio,vlan=0 \
-no-hpet -rtc-td-hack

Quoted 1 line

The above works with qemu 0.10.4, but not with qemu 0.10.5 where there

So this particular issue is (also?) a -stable regression? That should be easily bisectible.

Quoted 6 lines

is a hang (which I'm investigating - first send from guest -> host works, response from host -> guest disappears into the ether somewhere).

Quoted 2 lines
Quoted 2 lines

libguestfs is continuing to use the old, working -net channel form of this parameter, so please don't remove it.

Quoted 8 lines
Quoted 3 lines

It won't be removed in the foreseeable future for backward compatibility. But we also need to fix the new format as the old one does not allow to specify the slirp stack it should be apply to.

Good to know, thanks.

Rich.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 2 lines · Jan Kiszka

So this particular issue is (also?) a -stable regression? That should be easily bisectible.

Good idea - I'm going to do that now.

Rich.

Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
#6 lore raw
In reply to Jan Kiszka
Quoted 2 lines · Jan Kiszka

So this particular issue is (also?) a -stable regression? That should be easily bisectible.

This is what git-bisect said:

c92ef6a22d3c71538fcc48fb61ad353f7ba03b62 is first bad commit commit c92ef6a22d3c71538fcc48fb61ad353f7ba03b62
Author: Jan Kiszka <[email protected]>
Date: Wed Jun 24 14:42:28 2009 +0200

slirp: Rework external configuration interface

With the internal IP configuration made more flexible, we can now enhance the user interface. This patch adds a number of new options to "-net user": net (address and mask), host, dhcpstart, dns and smbserver. It also renames "redir" to "hostfwd" and "channel" to "guestfwd" in order to (hopefully) clarify their meanings. The format of guestfwd is extended so that the user can define not only the port but also the virtual server's IP address the forwarding starts from.

:100644 100644 18c51190bf5ff20625ecaf3de45bd4aab4403044 f26c3f804ec5d234f76e14200e1188d21923a732 M net.c
:100644 100644 d1c1539e21caf9da16ef1cd68e29976d1abf576f da5b0ac6a503445431f966de37be0ed3440c6225 M qemu-options.hx
:040000 040000 e371676d54aea53190c3ab3fb36a2d9d8da97ded af6ed9e3cc7c650828315f836615ffdb829b02a3 M slirp

I have stared at the code for quite a while and I don't see the error.

As another data point: I added some fprintf's to guestfwd_can_read and guestfwd_read and I can tell you that guestfwd_can_read is called continually (returning 0 each time), while guestfwd_read is never called.

Rich.

Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
#7 lore raw
Quoted 21 lines · Richard W.M. Jones
Quoted 2 lines · Jan Kiszka

So this particular issue is (also?) a -stable regression? That should be easily bisectible.

This is what git-bisect said:

c92ef6a22d3c71538fcc48fb61ad353f7ba03b62 is first bad commit commit c92ef6a22d3c71538fcc48fb61ad353f7ba03b62
Author: Jan Kiszka <[email protected]>
Date: Wed Jun 24 14:42:28 2009 +0200

slirp: Rework external configuration interface

With the internal IP configuration made more flexible, we can now enhance the user interface. This patch adds a number of new options to "-net user": net (address and mask), host, dhcpstart, dns and smbserver. It also renames "redir" to "hostfwd" and "channel" to "guestfwd" in order to (hopefully) clarify their meanings. The format of guestfwd is extended so that the user can define not only the port but also the virtual server's IP address the forwarding starts from.

Quoted 8 lines

:100644 100644 18c51190bf5ff20625ecaf3de45bd4aab4403044 f26c3f804ec5d234f76e14200e1188d21923a732 M net.c
:100644 100644 d1c1539e21caf9da16ef1cd68e29976d1abf576f da5b0ac6a503445431f966de37be0ed3440c6225 M qemu-options.hx
:040000 040000 e371676d54aea53190c3ab3fb36a2d9d8da97ded af6ed9e3cc7c650828315f836615ffdb829b02a3 M slirp

I have stared at the code for quite a while and I don't see the error.

That commit is not from stable, but from 0.11 (and it is expected to introduce the regression for that series). You are confusing me: Are you actually seeing a regression with *0.10.5*?

Quoted 5 lines

As another data point: I added some fprintf's to guestfwd_can_read and guestfwd_read and I can tell you that guestfwd_can_read is called continually (returning 0 each time), while guestfwd_read is never called.

Can't tell, need to check the code in more details. Was the corresponding vmchannel handler called properly in 0.10.x?

Jan

#8 lore raw
Quoted 3 lines · Jan Kiszka

That commit is not from stable, but from 0.11 (and it is expected to introduce the regression for that series). You are confusing me: Are you actually seeing a regression with *0.10.5*?

The regression is in both 0.10.5 and git. It worked in 0.10.4, now it doesn't work in either 0.10.5 or in git.

Rich.

Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
#9 lore raw
Quoted 8 lines · Richard W.M. Jones
Quoted 3 lines · Jan Kiszka

That commit is not from stable, but from 0.11 (and it is expected to introduce the regression for that series). You are confusing me: Are you actually seeing a regression with *0.10.5*?

The regression is in both 0.10.5 and git. It worked in 0.10.4, now it doesn't work in either 0.10.5 or in git.

Huh, that's strange. That was my setup:

qemu... -net channel,6666:tcp:localhost:1234,server,nowait -net user -net nic

Then "telnet localhost 1234" on the host and "telnet 10.0.2.4 6666" on the guest. Guest->host works in all cases, host->guest only with stable-0.10 for me.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#10 lore raw
Quoted 11 lines · Jan Kiszka
Quoted 8 lines · Richard W.M. Jones
Quoted 3 lines · Jan Kiszka

That commit is not from stable, but from 0.11 (and it is expected to introduce the regression for that series). You are confusing me: Are you actually seeing a regression with *0.10.5*?

The regression is in both 0.10.5 and git. It worked in 0.10.4, now it doesn't work in either 0.10.5 or in git.

Huh, that's strange.

Yup, ignore that - 0.10.5 works, it's the git HEAD which fails.

Quoted 8 lines

That was my setup:

qemu... -net channel,6666:tcp:localhost:1234,server,nowait -net user -net nic

Then "telnet localhost 1234" on the host and "telnet 10.0.2.4 6666" on the guest. Guest->host works in all cases, host->guest only with stable-0.10 for me.

I'm also going to take a further look at this this morning ...

Rich.

Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
#11 lore raw
In reply to Richard W.M. Jones

No this is wrong - the "0.10.5" in Fedora Rawhide is a strange combination of qemu and KVM bits. I just checked out the real stable-0.10 branch from qemu git and tried that and it's OK.

Anyway ... It doesn't work in qemu git, which concerns me.

Quoted 3 lines · When you
Quoted 2 lines · Jan Kiszka

That commit is not from stable, but from 0.11 (and it is expected to introduce the regression for that series).

What do you mean by "it is expected to introduce the regression"? You mean that guestfwd is supposed to not work?

Rich.

Signature · 4 lines
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
#12 lore raw
Quoted 7 lines · Richard W.M. Jones

No this is wrong - the "0.10.5" in Fedora Rawhide is a strange combination of qemu and KVM bits. I just checked out the real stable-0.10 branch from qemu git and tried that and it's OK.

Anyway ... It doesn't work in qemu git, which concerns me. When you said:

Quoted 6 lines
Quoted 3 lines · Jan Kiszka
Quoted 2 lines

That commit is not from stable, but from 0.11 (and it is expected to introduce the regression for that series).

What do you mean by "it is expected to introduce the regression"? You mean that guestfwd is supposed to not work?

I mean that, now that we know there is a regression, it is most likely that it comes from this patch which switches from the old "-net channel" code to the wrapped version over the new syntax. But I definitely not planned to break anything here. :)

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#13 lore raw
In reply to Jan Kiszka
Quoted 28 lines · Jan Kiszka
Quoted 27 lines · Richard W.M. Jones
Quoted 2 lines · Jan Kiszka

So this particular issue is (also?) a -stable regression? That should be easily bisectible.

This is what git-bisect said:

c92ef6a22d3c71538fcc48fb61ad353f7ba03b62 is first bad commit commit c92ef6a22d3c71538fcc48fb61ad353f7ba03b62
Author: Jan Kiszka <[email protected]>
Date: Wed Jun 24 14:42:28 2009 +0200

slirp: Rework external configuration interface

With the internal IP configuration made more flexible, we can now enhance the user interface. This patch adds a number of new options to "-net user": net (address and mask), host, dhcpstart, dns and smbserver. It also renames "redir" to "hostfwd" and "channel" to "guestfwd" in order to (hopefully) clarify their meanings. The format of guestfwd is extended so that the user can define not only the port but also the virtual server's IP address the forwarding starts from.

:100644 100644 18c51190bf5ff20625ecaf3de45bd4aab4403044 f26c3f804ec5d234f76e14200e1188d21923a732 M net.c
:100644 100644 d1c1539e21caf9da16ef1cd68e29976d1abf576f da5b0ac6a503445431f966de37be0ed3440c6225 M qemu-options.hx
:040000 040000 e371676d54aea53190c3ab3fb36a2d9d8da97ded af6ed9e3cc7c650828315f836615ffdb829b02a3 M slirp

Quoted 5 lines
Quoted 1 line

I have stared at the code for quite a while and I don't see the error.

That commit is not from stable, but from 0.11 (and it is expected to introduce the regression for that series). You are confusing me: Are you actually seeing a regression with *0.10.5*?

OK, regression is reproducible here with the 0.11 branch but not with stable-0.10. Will look into the former later.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#14 lore raw
In reply to Jan Kiszka
Quoted 5 lines · Jan Kiszka
Quoted 5 lines

However in the new syntax that would be:

-net user,guestfwd=tcp:10.0.2.4:6666-unix:/some/path,server,nowait

Quoted 9 lines
Quoted 4 lines

This gives errors like:

qemu: invalid parameter 'server,nowait' in 'vlan=0,guestfwd=tcp:10.0.2.4:6666-unix:/tmp/libguestfshRZgxr/sock,server,nowait'

Yep, that case does not fit into the syntax of comma-separated arguments. We need to find a new syntax within the given constraints. Need to think about it.

The syntax I proposed early for -drive could address this.

-net user,name=foo,guestfwd=tcp:10.0.2.4:6666 -net.foo.guestfwd-arg unix:/some/path,server,nowait

Regards,

Anthony Liguori

#15 lore raw
Quoted 20 lines · Anthony Liguori
Quoted 7 lines · Jan Kiszka
Quoted 7 lines

However in the new syntax that would be:

-net user,guestfwd=tcp:10.0.2.4:6666-unix:/some/path,server,nowait

This gives errors like:

Quoted 9 lines
Quoted 4 lines

qemu: invalid parameter 'server,nowait' in
'vlan=0,guestfwd=tcp:10.0.2.4:6666-unix:/tmp/libguestfshRZgxr/sock,server,nowait'

Yep, that case does not fit into the syntax of comma-separated arguments. We need to find a new syntax within the given constraints. Need to think about it.

The syntax I proposed early for -drive could address this.

Review

Quoted 2 lines
(quoted diff) +0 -2
-net user,name=foo,guestfwd=tcp:10.0.2.4:6666
-net.foo.guestfwd-arg unix:/some/path,server,nowait

I general yes, but I would rate this particular suggestion as a bad example for intuitive argument splitting (guestfwd is useless without a target like unix:/bla). If at all, we would have to push server and nowait into the additional args. Still, this requires more thoughts.

Jan

#16 lore raw
Quoted 10 lines · Jan Kiszka

Review

Quoted 6 lines

The syntax I proposed early for -drive could address this.

(quoted diff) +0 -2
-net user,name=foo,guestfwd=tcp:10.0.2.4:6666
-net.foo.guestfwd-arg unix:/some/path,server,nowait

I general yes, but I would rate this particular suggestion as a bad example for intuitive argument splitting (guestfwd is useless without a target like unix:/bla).

The throw an error.

-drive name=foo is also useless without a file= option.

Quoted 3 lines

If at all, we would have to push server and
nowait into the additional args. Still, this requires more thoughts.

Yes, the server and nowait options are unfortunate. We should probably introduce mode=client|server and wait=on|off. Best thing to do is completely swizzle the char device syntax. Something like:

-char name=foo,type=unix,unix-path=/some/path,mode=server,wait=off

Then allow a char:<name> url to be used anywhere that takes traditional char device urls.

-net user,guestfwd=tcp:10.0.2.4:6666-char:foo

Quoted 3 lines

Jan

Regards,

Anthony Liguori

#17 lore raw
Quoted 8 lines · Anthony Liguori

completely swizzle the char device syntax. Something like:

-char name=foo,type=unix,unix-path=/some/path,mode=server,wait=off

Then allow a char:<name> url to be used anywhere that takes traditional char device urls.

-net user,guestfwd=tcp:10.0.2.4:6666-char:foo

Also: -serial char=foo

Very useful IMHO.

cheers,
Gerd

#18 lore raw
Quoted 6 lines · Gerd Hoffmann
Quoted 4 lines · Anthony Liguori

completely swizzle the char device syntax. Something like:

-char name=foo,type=unix,unix-path=/some/path,mode=server,wait=off

Quoted 9 lines
Quoted 4 lines

Then allow a char:<name> url to be used anywhere that takes traditional char device urls.

-net user,guestfwd=tcp:10.0.2.4:6666-char:foo

Also: -serial char=foo

Very useful IMHO.

Yeah, I'm also starting to like this direction.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux