Discussion:
[Xen-users] xl network-attach
席康杰
2016-05-18 13:12:39 UTC
Permalink
Hi,



I use ¡®xl network-attach¡¯ to attach a nic, but failed.



# xl -vvv network-attach 6028 mac=00:16:3e:eb:ca:81 bridge=virbr0

libxl: debug: libxl.c:4247:libxl_device_nic_add: ao 0x20a9190: create: how=(nil) callback=(nil) poller=0x20a91f0

libxl: debug: libxl_event.c:577:libxl__ev_xswatch_register: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: register slotnum=3

libxl: debug: libxl.c:4247:libxl_device_nic_add: ao 0x20a9190: inprogress: poller=0x20a91f0, flags=i

libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: event epath=/local/domain/0/backend/vif/6028/0/state

libxl: debug: libxl_event.c:834:devstate_watch_callback: backend /local/domain/0/backend/vif/6028/0/state wanted state 2 still waiting state 1

libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: event epath=/local/domain/0/backend/vif/6028/0/state

libxl: debug: libxl_event.c:830:devstate_watch_callback: backend /local/domain/0/backend/vif/6028/0/state wanted state 2 ok

libxl: debug: libxl_event.c:615:libxl__ev_xswatch_deregister: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: deregister slotnum=3

libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a5948: deregister unregistered

libxl: debug: libxl_device.c:1028:device_hotplug: calling hotplug script: /etc/xen/scripts/vif-bridge online

libxl: debug: libxl_aoutils.c:513:libxl__async_exec_start: forking to execute: /etc/xen/scripts/vif-bridge online

libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered

libxl: debug: libxl_device.c:1028:device_hotplug: calling hotplug script: /etc/xen/scripts/vif-bridge add

libxl: debug: libxl_aoutils.c:513:libxl__async_exec_start: forking to execute: /etc/xen/scripts/vif-bridge add

libxl: error: libxl_exec.c:118:libxl_report_child_exitstatus: /etc/xen/scripts/vif-bridge add [-1] exited with error status 255

libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered

libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered

libxl: error: libxl.c:1965:device_addrm_aocomplete: unable to add vif with id 0

libxl: debug: libxl_event.c:1765:libxl__ao_complete: ao 0x20a9190: complete, rc=-3

libxl: debug: libxl_event.c:1737:libxl__ao__destroy: ao 0x20a9190: destroy libxl_device_nic_add failed.

xc: debug: hypercall buffer: total allocations:26 total releases:26

xc: debug: hypercall buffer: current allocations:0 maximum allocations:2

xc: debug: hypercall buffer: cache current size:2

xc: debug: hypercall buffer: cache hits:20 misses:2 toobig:4



# xl network-list 6028

Idx BE Mac Addr. handle state evt-ch tx-/rx-ring-ref BE-path

0 0 00:16:3e:eb:ca:81 0 1 -1 -1/-1 /local/domain/0/backend/vif/6028/0



# brctl show

bridge name bridge id STP enabled interfaces

virbr0 8000.feffffffffff no vif6028.0



If succeed to attach£¬¡¯brctl show¡¯ will output:

bridge name bridge id STP enabled interfaces

virbr0 8000.feffffffffff no vif6028.0

vif6028.0-emu



# cat /var/log/xen/xen-hotplug.log

Cannot find device "vif6028.0-emu"



I trace /etc/xen/scripts/vif-bridge£¬find it is /etc/xen/scripts/xen-network-common.sh:88, failed to execute command

¡®ip link set dev vif6028.0-emu down¡¯£¬then output ¡®Cannot find device "vif6028.0-emu"¡¯



82 # configure interfaces which act as pure bridge ports:

83 _setup_bridge_port() {

84 local dev="$1"

85 local virtual="$2"

86

87 # take interface down ...

88 ip link set dev ${dev} down

89

90 if [ $virtual -ne 0 ] ; then

91 # Initialise a dummy MAC address. We choose the numerically

92 # largest non-broadcast address to prevent the address getting

93 # stolen by an Ethernet bridge for STP purposes.

94 # (FE:FF:FF:FF:FF:FF)

95 ip link set dev ${dev} address fe:ff:ff:ff:ff:ff || true

96 fi

97

98 # ... and configure it

99 ip address flush dev ${dev}

100 }



Anyone have an idea?



Thanks!
Wei Liu
2016-05-18 15:45:43 UTC
Permalink
Hi,
I use ‘xl network-attach’ to attach a nic, but failed.
# xl -vvv network-attach 6028 mac=00:16:3e:eb:ca:81 bridge=virbr0
As a starter, can you try:

xl -vvv network-attach 6028 "mac=00:16:3e:eb:ca:81,bridge=virbr0"

ISTR there is a problem with command line argument parsing and even
wrote a patch series for it.

Worth trying anyway.
libxl: debug: libxl.c:4247:libxl_device_nic_add: ao 0x20a9190: create: how=(nil) callback=(nil) poller=0x20a91f0
libxl: debug: libxl_event.c:577:libxl__ev_xswatch_register: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: register slotnum=3
libxl: debug: libxl.c:4247:libxl_device_nic_add: ao 0x20a9190: inprogress: poller=0x20a91f0, flags=i
libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: event epath=/local/domain/0/backend/vif/6028/0/state
libxl: debug: libxl_event.c:834:devstate_watch_callback: backend /local/domain/0/backend/vif/6028/0/state wanted state 2 still waiting state 1
libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: event epath=/local/domain/0/backend/vif/6028/0/state
libxl: debug: libxl_event.c:830:devstate_watch_callback: backend /local/domain/0/backend/vif/6028/0/state wanted state 2 ok
libxl: debug: libxl_event.c:615:libxl__ev_xswatch_deregister: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: deregister slotnum=3
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a5948: deregister unregistered
libxl: debug: libxl_device.c:1028:device_hotplug: calling hotplug script: /etc/xen/scripts/vif-bridge online
libxl: debug: libxl_aoutils.c:513:libxl__async_exec_start: forking to execute: /etc/xen/scripts/vif-bridge online
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered
libxl: debug: libxl_device.c:1028:device_hotplug: calling hotplug script: /etc/xen/scripts/vif-bridge add
libxl: debug: libxl_aoutils.c:513:libxl__async_exec_start: forking to execute: /etc/xen/scripts/vif-bridge add
libxl: error: libxl_exec.c:118:libxl_report_child_exitstatus: /etc/xen/scripts/vif-bridge add [-1] exited with error status 255
This is the culprit.
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered
libxl: error: libxl.c:1965:device_addrm_aocomplete: unable to add vif with id 0
libxl: debug: libxl_event.c:1765:libxl__ao_complete: ao 0x20a9190: complete, rc=-3
libxl: debug: libxl_event.c:1737:libxl__ao__destroy: ao 0x20a9190: destroy libxl_device_nic_add failed.
xc: debug: hypercall buffer: total allocations:26 total releases:26
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:20 misses:2 toobig:4
# xl network-list 6028
Idx BE Mac Addr. handle state evt-ch tx-/rx-ring-ref BE-path
0 0 00:16:3e:eb:ca:81 0 1 -1 -1/-1 /local/domain/0/backend/vif/6028/0
# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.feffffffffff no vif6028.0
bridge name bridge id STP enabled interfaces
virbr0 8000.feffffffffff no vif6028.0
vif6028.0-emu
# cat /var/log/xen/xen-hotplug.log
Cannot find device "vif6028.0-emu"
This is strange...

Let me try to test this functionality a bit.

Wei.
Wei Liu
2016-05-18 16:25:07 UTC
Permalink
Post by Wei Liu
Hi,
I use ‘xl network-attach’ to attach a nic, but failed.
# xl -vvv network-attach 6028 mac=00:16:3e:eb:ca:81 bridge=virbr0
xl -vvv network-attach 6028 "mac=00:16:3e:eb:ca:81,bridge=virbr0"
ISTR there is a problem with command line argument parsing and even
wrote a patch series for it.
Worth trying anyway.
libxl: debug: libxl.c:4247:libxl_device_nic_add: ao 0x20a9190: create: how=(nil) callback=(nil) poller=0x20a91f0
libxl: debug: libxl_event.c:577:libxl__ev_xswatch_register: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: register slotnum=3
libxl: debug: libxl.c:4247:libxl_device_nic_add: ao 0x20a9190: inprogress: poller=0x20a91f0, flags=i
libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: event epath=/local/domain/0/backend/vif/6028/0/state
libxl: debug: libxl_event.c:834:devstate_watch_callback: backend /local/domain/0/backend/vif/6028/0/state wanted state 2 still waiting state 1
libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: event epath=/local/domain/0/backend/vif/6028/0/state
libxl: debug: libxl_event.c:830:devstate_watch_callback: backend /local/domain/0/backend/vif/6028/0/state wanted state 2 ok
libxl: debug: libxl_event.c:615:libxl__ev_xswatch_deregister: watch w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: deregister slotnum=3
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a5948: deregister unregistered
libxl: debug: libxl_device.c:1028:device_hotplug: calling hotplug script: /etc/xen/scripts/vif-bridge online
libxl: debug: libxl_aoutils.c:513:libxl__async_exec_start: forking to execute: /etc/xen/scripts/vif-bridge online
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered
libxl: debug: libxl_device.c:1028:device_hotplug: calling hotplug script: /etc/xen/scripts/vif-bridge add
libxl: debug: libxl_aoutils.c:513:libxl__async_exec_start: forking to execute: /etc/xen/scripts/vif-bridge add
libxl: error: libxl_exec.c:118:libxl_report_child_exitstatus: /etc/xen/scripts/vif-bridge add [-1] exited with error status 255
This is the culprit.
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch w=0x20a59d0: deregister unregistered
libxl: error: libxl.c:1965:device_addrm_aocomplete: unable to add vif with id 0
libxl: debug: libxl_event.c:1765:libxl__ao_complete: ao 0x20a9190: complete, rc=-3
libxl: debug: libxl_event.c:1737:libxl__ao__destroy: ao 0x20a9190: destroy libxl_device_nic_add failed.
xc: debug: hypercall buffer: total allocations:26 total releases:26
xc: debug: hypercall buffer: current allocations:0 maximum allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:20 misses:2 toobig:4
# xl network-list 6028
Idx BE Mac Addr. handle state evt-ch tx-/rx-ring-ref BE-path
0 0 00:16:3e:eb:ca:81 0 1 -1 -1/-1 /local/domain/0/backend/vif/6028/0
# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.feffffffffff no vif6028.0
bridge name bridge id STP enabled interfaces
virbr0 8000.feffffffffff no vif6028.0
vif6028.0-emu
# cat /var/log/xen/xen-hotplug.log
Cannot find device "vif6028.0-emu"
This is strange...
Let me try to test this functionality a bit.
OK, so apparently the attachment of the PV interface is successfully
(vif6028.0) and you can check that in your guest with ifconfig -a.

It's the attachment of emulated interface that failed. I will have a
closer look of the code tomorrow.

Wei.
Post by Wei Liu
Wei.
席康杰
2016-05-19 03:29:59 UTC
Permalink
Thank you very much, xl network-attach is very important for me.

-----邮件原件-----
发件人: Wei Liu [mailto:***@citrix.com]
发送时间: 2016年5月19日 0:25
收件人: 席康杰
抄送: Xen-***@lists.xen.org; Wei Liu
主题: Re: [Xen-users] xl network-attach
Post by Wei Liu
Hi,
I use ‘xl network-attach’ to attach a nic, but failed.
# xl -vvv network-attach 6028 mac=00:16:3e:eb:ca:81 bridge=virbr0
xl -vvv network-attach 6028 "mac=00:16:3e:eb:ca:81,bridge=virbr0"
ISTR there is a problem with command line argument parsing and even
wrote a patch series for it.
Worth trying anyway.
create: how=(nil) callback=(nil) poller=0x20a91f0
libxl: debug: libxl_event.c:577:libxl__ev_xswatch_register: watch
w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state
token=3/0: register slotnum=3
inprogress: poller=0x20a91f0, flags=i
libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x20a5948
wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: event
epath=/local/domain/0/backend/vif/6028/0/state
libxl: debug: libxl_event.c:834:devstate_watch_callback: backend
/local/domain/0/backend/vif/6028/0/state wanted state 2 still
waiting state 1
libxl: debug: libxl_event.c:514:watchfd_callback: watch w=0x20a5948
wpath=/local/domain/0/backend/vif/6028/0/state token=3/0: event
epath=/local/domain/0/backend/vif/6028/0/state
libxl: debug: libxl_event.c:830:devstate_watch_callback: backend
/local/domain/0/backend/vif/6028/0/state wanted state 2 ok
libxl: debug: libxl_event.c:615:libxl__ev_xswatch_deregister: watch
w=0x20a5948 wpath=/local/domain/0/backend/vif/6028/0/state
token=3/0: deregister slotnum=3
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch
w=0x20a5948: deregister unregistered
libxl: debug: libxl_device.c:1028:device_hotplug: calling hotplug
script: /etc/xen/scripts/vif-bridge online
libxl: debug: libxl_aoutils.c:513:libxl__async_exec_start: forking
to execute: /etc/xen/scripts/vif-bridge online
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch
w=0x20a59d0: deregister unregistered
libxl: debug: libxl_device.c:1028:device_hotplug: calling hotplug
script: /etc/xen/scripts/vif-bridge add
libxl: debug: libxl_aoutils.c:513:libxl__async_exec_start: forking
to execute: /etc/xen/scripts/vif-bridge add
/etc/xen/scripts/vif-bridge add [-1] exited with error status 255
This is the culprit.
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch
w=0x20a59d0: deregister unregistered
libxl: debug: libxl_event.c:629:libxl__ev_xswatch_deregister: watch
w=0x20a59d0: deregister unregistered
libxl: error: libxl.c:1965:device_addrm_aocomplete: unable to add vif with id 0
libxl: debug: libxl_event.c:1765:libxl__ao_complete: ao 0x20a9190: complete, rc=-3
libxl: debug: libxl_event.c:1737:libxl__ao__destroy: ao 0x20a9190: destroy libxl_device_nic_add failed.
xc: debug: hypercall buffer: total allocations:26 total releases:26
xc: debug: hypercall buffer: current allocations:0 maximum
allocations:2
xc: debug: hypercall buffer: cache current size:2
xc: debug: hypercall buffer: cache hits:20 misses:2 toobig:4
# xl network-list 6028
Idx BE Mac Addr. handle state evt-ch tx-/rx-ring-ref BE-path
0 0 00:16:3e:eb:ca:81 0 1 -1 -1/-1 /local/domain/0/backend/vif/6028/0
# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.feffffffffff no vif6028.0
bridge name bridge id STP enabled interfaces
virbr0 8000.feffffffffff no vif6028.0
vif6028.0-emu
# cat /var/log/xen/xen-hotplug.log
Cannot find device "vif6028.0-emu"
This is strange...
Let me try to test this functionality a bit.
OK, so apparently the attachment of the PV interface is successfully
(vif6028.0) and you can check that in your guest with ifconfig -a.

It's the attachment of emulated interface that failed. I will have a closer look of the code tomorrow.

Wei.
Post by Wei Liu
Wei.
Wei Liu
2016-05-19 16:18:38 UTC
Permalink
Post by 席康杰
Thank you very much, xl network-attach is very important for me.
For now please explicitly specify type=vif to work around this issue.

I need to discuss with QEMU maintainer and do some code archaeology to
figure out a proper fix.

Wei.
席康杰
2016-05-20 02:49:02 UTC
Permalink
The "type=vif" also doesn't work.

My domain guest type is HVM, guest OS is windows, Xen version is 4.5.1.

How long can QEMU maintainer fix the issue? one week or one month?
I will adjust my development plan according to the time.

Many thanks.

-KangJie Xi


-----邮件原件-----
发件人: Wei Liu [mailto:***@citrix.com]
发送时间: 2016年5月20日 0:19
收件人: 席康杰
抄送: Wei Liu; Xen-***@lists.xen.org
主题: Re: 答复: [Xen-users] xl network-attach
Post by 席康杰
Thank you very much, xl network-attach is very important for me.
For now please explicitly specify type=vif to work around this issue.

I need to discuss with QEMU maintainer and do some code archaeology to figure out a proper fix.

Wei.
Wei Liu
2016-05-20 09:34:09 UTC
Permalink
Post by 席康杰
The "type=vif" also doesn't work.
My domain guest type is HVM, guest OS is windows, Xen version is 4.5.1.
How long can QEMU maintainer fix the issue? one week or one month?
I will adjust my development plan according to the time.
I can't tell at this point. Even if we manage to fix that, it is not
going to be backported to 4.5.1.

I'm probably the one that ends up fixing that, but my plate is quite
full at the moment I don't know when I will be able to get to that.

Wei.
Post by 席康杰
Many thanks.
-KangJie Xi
-----邮件原件-----
发送时间: 2016年5月20日 0:19
收件人: 席康杰
主题: Re: 答复: [Xen-users] xl network-attach
Post by 席康杰
Thank you very much, xl network-attach is very important for me.
For now please explicitly specify type=vif to work around this issue.
I need to discuss with QEMU maintainer and do some code archaeology to figure out a proper fix.
Wei.
Wei Liu
2016-05-20 22:56:00 UTC
Permalink
Post by Wei Liu
Post by 席康杰
The "type=vif" also doesn't work.
My domain guest type is HVM, guest OS is windows, Xen version is 4.5.1.
How long can QEMU maintainer fix the issue? one week or one month?
I will adjust my development plan according to the time.
I can't tell at this point. Even if we manage to fix that, it is not
going to be backported to 4.5.1.
I'm probably the one that ends up fixing that, but my plate is quite
full at the moment I don't know when I will be able to get to that.
After discussing with other maintainers, we don't think hot plugging
emulated devices can be supported by upstream. [0]

In this particular case, the fix is going to make nic hotplug support pv
by default. If you try to plug in an emulated device, you still get the
same error.

That being said, you can poke QEMU via QMP socket to do things as you
see fit. Xen toolstack creates a QEMU monitor socket in /var/run/xen,
you can use the QMP script in QEMU source code to connect to that socket
to do things.

Wei.

[0] http://lists.xen.org/archives/html/xen-devel/2016-05/msg02016.html
Loading...