Skip to contentSkip to conversation

Random swap of interfaces at domU startup

Xen-users Daniele Palumbo 3 participants 7 messages Jan 24, 2007 – Jan 29, 2007

lore
Share & tools
lore
#0 lore raw

maybe a developer can explain that...

---------- Forwarded Message ----------

Subject: Re: [Xen-users] Random swap of interfaces at domU startup
Date: Tuesday 23 January 2007 13:24
From: Daniele Palumbo <[email protected]>
To: [email protected]

Quoted 5 lines · Frédéric VANNIÈRE

I don't think so. The problem comes from xend, it doesn't plug the vif interface on the right bridge.

I guess the problem comes from dict handling in Python, default dicts are not ordered

i have same problem too, and 3.0.4 too (but seems, at first look, that also 3.0.3 got it)
and i agree (almost) with you, but i think that is not something like "unordered" (you can see correct order in vif0.0, vif0.1). my opinion (without looking at code) is that there is concurrent thread that setup bridge, and so who is running faster will be setup as eth0.

Quoted 7 lines

This is OK :

   (XendDomainInfo:1195) {'bridge': 'xenbr0', 'mac': '00:26:3E:7B:0B:

24', 'uuid': '17ccddf1-17ee-87a6-9534-a8439402f38a', 'ip':
'192.168.2.145'}
(XendDomainInfo:1195) {'bridge': 'xenbr1', 'mac': '00:26:3E:7B:0B:
25', 'uuid': 'b96f77b6-b310-7f21-cdfc-a9a598c85790', 'ip': '10.1.0.21'}

Quoted 6 lines

This is NOT OK :
(XendDomainInfo:1195) {'bridge': 'xenbr1', 'mac': '00:26:3E:7B:0B:
25', 'uuid': '661e6a7e-be77-28ce-180d-fca88aa826ab', 'ip': '10.1.0.21'}
(XendDomainInfo:1195) {'bridge': 'xenbr0', 'mac': '00:26:3E:7B:0B:
24', 'uuid': '87f327a3-0544-f76a-81f8-6edd5ac7b6f5', 'ip':
'192.168.2.145'}

just other logs:

config file:
vif = [ 'bridge=xenbr1', 'bridge=xenbr1.600', 'bridge=xenbr1.14' ]

in attachment: xend.log, notable lines:
--
['device', ['vif', ['bridge', 'xenbr1']]], [' device', ['vif', ['bridge', 'xenbr1.600']]], ['device', ['vif', ['bridge', 'xenbr1.14']]]
[...]
createDevice: vif : {'bridge': 'xenbr1'
[...]
createDevice: vif : {'bridge': 'xenbr1.14',
[...]
createDevice: vif : {'bridge': 'xenbr1.600',
[...]
--
as you can see, eth1 and eth2 are swapped.
but in a precedent boot, eth0 and eth1 were swapped.

- messages -

Jan 23 12:19:13 xen2 logger: /etc/xen/scripts/block: add
XENBUS_PATH=backend/vbd/2/2049
Jan 23 12:19:13 xen2 logger: /etc/xen/scripts/block: add
XENBUS_PATH=backend/vbd/2/2065
Jan 23 12:19:13 xen2 logger: /etc/xen/scripts/vif-bridge: online
XENBUS_PATH=backend/vif/2/0
Jan 23 12:19:13 xen2 logger: /etc/xen/scripts/vif-bridge: online
XENBUS_PATH=backend/vif/2/1
Jan 23 12:19:13 xen2 logger: /etc/xen/scripts/block: add
XENBUS_PATH=backend/vbd/2/2050
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/vif-bridge: online
XENBUS_PATH=backend/vif/2/2
Jan 23 12:19:14 xen2 [ 2832.403309] device vif2.1 entered promiscuous mode
Jan 23 12:19:14 xen2 [ 2832.407399] device vif2.0 entered promiscuous mode
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/vif-bridge: Successful
vif-bridge online for vif2.1, bridge xenbr1.14.
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/vif-bridge: Writing
backend/vif/2/1/hotplug-status connected to xenstore.
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/vif-bridge: Successful
vif-bridge online for vif2.0, bridge xenbr1.
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/vif-bridge: Writing
backend/vif/2/0/hotplug-status connected to xenstore.
Jan 23 12:19:14 xen2 [ 2832.428236] device vif2.2 entered promiscuous mode
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/block: Writing
backend/vbd/2/2065/physical-device fd:5 to xenstore.
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/vif-bridge: Successful
vif-bridge online for vif2.2, bridge xenbr1.600.
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/block: Writing
backend/vbd/2/2065/hotplug-status connected to xenstore.
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/vif-bridge: Writing
backend/vif/2/2/hotplug-status connected to xenstore.
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/block: Writing
backend/vbd/2/2050/physical-device fd:9 to xenstore.
Jan 23 12:19:14 xen2 logger: /etc/xen/scripts/block: Writing
backend/vbd/2/2050/hotplug-status connected to xenstore.
Jan 23 12:19:15 xen2 logger: /etc/xen/scripts/block: Writing
backend/vbd/2/2049/physical-device fd:8 to xenstore.
Jan 23 12:19:15 xen2 logger: /etc/xen/scripts/block: Writing

backend/vbd/2/2049/hotplug-status connected to xenstore.

bye
d.

-------------------------------------------------------

[2007-01-23 12:19:13 xend.XendDomainInfo 9429] DEBUG (XendDomainInfo:94) XendDomainInfo.create(['vm', ['name', 'prova2'], ['memory', 512], ['maxmem', 1024], ['vcpus', 1], ['on_xend_start', 'ignore'], ['on_xend_stop', 'ignore'], ['cpus', '1-3'], ['cpu_cap', 0], ['cpu_weight', 256], ['image', ['linux', ['kernel', '/boot/vmlinuz-default-xen-DomU'], ['root', '/dev/sda1 ro'], ['args', '3']]], ['device', ['vbd', ['uname', 'phy:/dev/Xen2Volume/prova2'], ['dev', '/dev/sda1'], ['mode', 'w']]], ['device', ['vbd', ['uname', 'phy:/dev/Xen2Volume/prova2-swap'], ['dev', '/dev/sda2'], ['mode', 'w']]], ['device', ['vbd', ['uname', 'phy:/dev/Xen2Volume/domU-kernel-needed'], ['dev', '/dev/sdb1'], ['mode', 'r']]], ['device', ['vif', ['bridge', 'xenbr1']]], ['device', ['vif', ['bridge', 'xenbr1.600']]], ['device', ['vif', ['bridge', 'xenbr1.14']]]]) [2007-01-23 12:19:13 xend.XendConfig 9429] WARNING (XendConfig:606) Unconverted key: cpus
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] DEBUG (XendDomainInfo:1284) XendDomainInfo.constructDomain
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] DEBUG (XendDomainInfo:1330) XendDomainInfo.initDomain: 2 256
[2007-01-23 12:19:13 xend 9429] DEBUG (balloon:127) Balloon: 8049564 KiB free; need 524288; done.
[2007-01-23 12:19:13 xend 9429] INFO (image:125) buildDomain os=linux dom=2 vcpus=1

[2007-01-23 12:19:13 xend 9429] DEBUG (image:194) domid          = 2
[2007-01-23 12:19:13 xend 9429] DEBUG (image:195) memsize        = 512
[2007-01-23 12:19:13 xend 9429] DEBUG (image:196) image          = /boot/vmlinuz-default-xen-DomU
[2007-01-23 12:19:13 xend 9429] DEBUG (image:197) store_evtchn   = 1
[2007-01-23 12:19:13 xend 9429] DEBUG (image:198) console_evtchn = 2
[2007-01-23 12:19:13 xend 9429] DEBUG (image:199) cmdline        = root=/dev/sda1 ro 3
[2007-01-23 12:19:13 xend 9429] DEBUG (image:200) ramdisk        = 
[2007-01-23 12:19:13 xend 9429] DEBUG (image:201) vcpus          = 1
[2007-01-23 12:19:13 xend 9429] DEBUG (image:202) features       = 

[2007-01-23 12:19:13 xend.XendDomainInfo 9429] INFO (XendDomainInfo:1194) createDevice: vbd : {'uname': 'phy:/dev/Xen2Volume/prova2', 'driver': 'paravirtualised', 'mode': 'w', 'dev': '/dev/sda1', 'uuid': '79c201df-0918-d43e-30c5-7164438b8fda'}
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:115) DevController: writing {'backend-id': '0', 'virtual-device': '2049', 'device-type': 'disk', 'state': '1', 'backend': '/local/domain/0/backend/vbd/2/2049'} to /local/domain/2/device/vbd/2049.
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:117) DevController: writing {'domain': 'prova2', 'frontend': '/local/domain/2/device/vbd/2049', 'uuid': '79c201df-0918-d43e-30c5-7164438b8fda', 'dev': '/dev/sda1', 'state': '1', 'params': '/dev/Xen2Volume/prova2', 'mode': 'w', 'online': '1', 'frontend-id': '2', 'type': 'phy'} to /local/domain/0/backend/vbd/2/2049.
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] INFO (XendDomainInfo:1194) createDevice: vif : {'bridge': 'xenbr1', 'uuid': 'da302cad-57f5-cfc2-4a26-bc08f10d0cca'}
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:115) DevController: writing {'backend-id': '0', 'mac': '00:16:3e:0c:cd:8b', 'handle': '0', 'state': '1', 'backend': '/local/domain/0/backend/vif/2/0'} to /local/domain/2/device/vif/0.
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:117) DevController: writing {'bridge': 'xenbr1', 'domain': 'prova2', 'handle': '0', 'uuid': 'da302cad-57f5-cfc2-4a26-bc08f10d0cca', 'script': '/etc/xen/scripts/vif-bridge', 'state': '1', 'frontend': '/local/domain/2/device/vif/0', 'mac': '00:16:3e:0c:cd:8b', 'online': '1', 'frontend-id': '2'} to /local/domain/0/backend/vif/2/0.
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] INFO (XendDomainInfo:1194) createDevice: vbd : {'uname': 'phy:/dev/Xen2Volume/domU-kernel-needed', 'driver': 'paravirtualised', 'mode': 'r', 'dev': '/dev/sdb1', 'uuid': '782c977f-c41c-e72a-ec03-64e1878af5a1'}
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:115) DevController: writing {'backend-id': '0', 'virtual-device': '2065', 'device-type': 'disk', 'state': '1', 'backend': '/local/domain/0/backend/vbd/2/2065'} to /local/domain/2/device/vbd/2065.
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:117) DevController: writing {'domain': 'prova2', 'frontend': '/local/domain/2/device/vbd/2065', 'uuid': '782c977f-c41c-e72a-ec03-64e1878af5a1', 'dev': '/dev/sdb1', 'state': '1', 'params': '/dev/Xen2Volume/domU-kernel-needed', 'mode': 'r', 'online': '1', 'frontend-id': '2', 'type': 'phy'} to /local/domain/0/backend/vbd/2/2065.
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] INFO (XendDomainInfo:1194) createDevice: vif : {'bridge': 'xenbr1.14', 'uuid': '2cddd99c-7a6b-5f7b-4ead-264aa5905cad'}
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:115) DevController: writing {'backend-id': '0', 'mac': '00:16:3e:23:d9:a3', 'handle': '1', 'state': '1', 'backend': '/local/domain/0/backend/vif/2/1'} to /local/domain/2/device/vif/1.
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:117) DevController: writing {'bridge': 'xenbr1.14', 'domain': 'prova2', 'handle': '1', 'uuid': '2cddd99c-7a6b-5f7b-4ead-264aa5905cad', 'script': '/etc/xen/scripts/vif-bridge', 'state': '1', 'frontend': '/local/domain/2/device/vif/1', 'mac': '00:16:3e:23:d9:a3', 'online': '1', 'frontend-id': '2'} to /local/domain/0/backend/vif/2/1.
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] INFO (XendDomainInfo:1194) createDevice: vbd : {'uname': 'phy:/dev/Xen2Volume/prova2-swap', 'driver': 'paravirtualised', 'mode': 'w', 'dev': '/dev/sda2', 'uuid': 'c0d3aefc-e6cc-11fc-c17b-1ea240e04437'}
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:115) DevController: writing {'backend-id': '0', 'virtual-device': '2050', 'device-type': 'disk', 'state': '1', 'backend': '/local/domain/0/backend/vbd/2/2050'} to /local/domain/2/device/vbd/2050.
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:117) DevController: writing {'domain': 'prova2', 'frontend': '/local/domain/2/device/vbd/2050', 'uuid': 'c0d3aefc-e6cc-11fc-c17b-1ea240e04437', 'dev': '/dev/sda2', 'state': '1', 'params': '/dev/Xen2Volume/prova2-swap', 'mode': 'w', 'online': '1', 'frontend-id': '2', 'type': 'phy'} to /local/domain/0/backend/vbd/2/2050.
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] INFO (XendDomainInfo:1194) createDevice: vif : {'bridge': 'xenbr1.600', 'uuid': '698de99a-10b6-4940-7232-72438a4e2c08'}
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:115) DevController: writing {'backend-id': '0', 'mac': '00:16:3e:73:b6:88', 'handle': '2', 'state': '1', 'backend': '/local/domain/0/backend/vif/2/2'} to /local/domain/2/device/vif/2.
[2007-01-23 12:19:13 xend 9429] DEBUG (DevController:117) DevController: writing {'bridge': 'xenbr1.600', 'domain': 'prova2', 'handle': '2', 'uuid': '698de99a-10b6-4940-7232-72438a4e2c08', 'script': '/etc/xen/scripts/vif-bridge', 'state': '1', 'frontend': '/local/domain/2/device/vif/2', 'mac': '00:16:3e:73:b6:88', 'online': '1', 'frontend-id': '2'} to /local/domain/0/backend/vif/2/2.
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] DEBUG (XendDomainInfo:1714) Storing VM details: {'on_xend_stop': 'ignore', 'shadow_memory': '0', 'uuid': '13f32c97-601c-9ac3-7913-23080daeac9a', 'name': 'prova2', 'on_reboot': 'restart', 'start_time': '1169551153.95', 'on_poweroff': 'destroy', 'on_xend_start': 'ignore', 'on_crash': 'restart', 'xend/restart_count': '0', 'vcpus': '1', 'vcpu_avail': '1', 'memory': '512', 'image': "(linux (kernel /boot/vmlinuz-default-xen-DomU) (args 'root=/dev/sda1 ro 3') (root '/dev/sda1 ro'))", 'maxmem': '1024'} [2007-01-23 12:19:13 xend.XendDomainInfo 9429] DEBUG (XendDomainInfo:731) Storing domain details: {'console/ring-ref': '2292954', 'console/port': '2', 'name': 'prova2', 'console/limit': '1048576', 'vm': '/vm/13f32c97-601c-9ac3-7913-23080daeac9a', 'domid': '2', 'cpu/0/availability': 'online', 'memory/target': '524288', 'store/ring-ref': '2292955', 'store/port': '1'}
[2007-01-23 12:19:13 xend 9429] DEBUG (XendDomain:428) Adding Domain: 2
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] DEBUG (XendDomainInfo:731) Storing domain details: {'console/ring-ref': '2292954', 'console/port': '2', 'name': 'prova2', 'console/limit': '1048576', 'vm': '/vm/13f32c97-601c-9ac3-7913-23080daeac9a', 'domid': '2', 'cpu/0/availability': 'online', 'memory/target': '524288', 'store/ring-ref': '2292955', 'store/port': '1'}
[2007-01-23 12:19:13 xend.XendDomainInfo 9429] DEBUG (XendDomainInfo:798) XendDomainInfo.handleShutdownWatch
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:148) Waiting for devices vif.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:153) Waiting for 0.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:521) hotplugStatusCallback /local/domain/0/backend/vif/2/0/hotplug-status.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:521) hotplugStatusCallback /local/domain/0/backend/vif/2/0/hotplug-status.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:535) hotplugStatusCallback 1.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:153) Waiting for 1.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:521) hotplugStatusCallback /local/domain/0/backend/vif/2/1/hotplug-status.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:535) hotplugStatusCallback 1.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:153) Waiting for 2.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:521) hotplugStatusCallback /local/domain/0/backend/vif/2/2/hotplug-status.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:535) hotplugStatusCallback 1.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:148) Waiting for devices usb.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:148) Waiting for devices vbd.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:153) Waiting for 2049.
[2007-01-23 12:19:14 xend 9429] DEBUG (DevController:521) hotplugStatusCallback /local/domain/0/backend/vbd/2/2049/hotplug-status.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:521) hotplugStatusCallback /local/domain/0/backend/vbd/2/2049/hotplug-status.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:535) hotplugStatusCallback 1.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:153) Waiting for 2065.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:521) hotplugStatusCallback /local/domain/0/backend/vbd/2/2065/hotplug-status.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:535) hotplugStatusCallback 1.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:153) Waiting for 2050.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:521) hotplugStatusCallback /local/domain/0/backend/vbd/2/2050/hotplug-status.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:535) hotplugStatusCallback 1.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:148) Waiting for devices irq.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:148) Waiting for devices vkbd.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:148) Waiting for devices vfb.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:148) Waiting for devices pci.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:148) Waiting for devices ioports.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:148) Waiting for devices tap.
[2007-01-23 12:19:15 xend 9429] DEBUG (DevController:148) Waiting for devices vtpm.
[2007-01-23 12:19:15 xend 9429] INFO (XendDomain:1020) Domain prova2 (2) unpaused.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 15 lines · Daniele Palumbo

maybe a developer can explain that...

---------- Forwarded Message ----------

Subject: Re: [Xen-users] Random swap of interfaces at domU startup
Date: Tuesday 23 January 2007 13:24
From: Daniele Palumbo <[email protected]>
To: [email protected]

Quoted 5 lines · Frédéric VANNIÈRE

I don't think so. The problem comes from xend, it doesn't plug the vif interface on the right bridge.

I guess the problem comes from dict handling in Python, default dicts are not ordered

I discovered this problem recently, and have a patch against xen-unstable that will help -- I'm testing it at the moment, and hopefully will be able to drop it in today.

Ewan.

#2 lore raw
Quoted 7 lines · Ewan Mellor
Quoted 3 lines · Frédéric VANNIÈRE
Quoted 2 lines

I guess the problem comes from dict handling in Python, default dicts are not ordered

I discovered this problem recently, and have a patch against xen-unstable that will help -- I'm testing it at the moment, and hopefully will be able to drop it in today.

is the patch already on the web, so i can test it?
do you plan to write a patch also for 3.0.4?
will you please send in -users thread a mail when the patch is up and running? :)

bye
d.

#3 lore raw
Quoted 19 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Daniele Palumbo
Sent: 24 January 2007 15:05
To: [email protected]
Subject: Re: [Xen-devel] Fwd: Re: [Xen-users] Random swap of interfaces at domU startup

Quoted 2 lines · Ewan Mellor
Quoted 2 lines · Frédéric VANNIÈRE
Quoted 1 line

I guess the problem comes from dict handling in Python,

default dicts

Quoted 3 lines
Quoted 1 line
Quoted 1 line

are not ordered

I discovered this problem recently, and have a patch

against xen-unstable

Quoted 8 lines
Quoted 1 line

that will help -- I'm testing it at the moment, and

hopefully will be able

Quoted 1 line

to drop it in today.

is the patch already on the web, so i can test it?
do you plan to write a patch also for 3.0.4?
will you please send in -users thread a mail when the patch is up and running? :)

The patch just turned up in the staging tree (which is "before it's been tested"), so I expect it to hit the "unstable" tomorrow. I can't comment on the plans to include this in 3.0.4 or not, but since the patch is relatively simple (about 6-8 lines that change) I don't see why it would be a hard task to get it into your own 3.0.4 build even if it's not in the 3.0.4 official tree.

--
Mats

Quoted 11 lines

bye
d.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
In reply to Daniele Palumbo
Quoted 5 lines · Daniele Palumbo
Quoted 4 lines · Ewan Mellor
Quoted 3 lines · Frédéric VANNIÈRE
Quoted 2 lines

I guess the problem comes from dict handling in Python, default dicts are not ordered

Quoted 8 lines
Quoted 3 lines

I discovered this problem recently, and have a patch against xen-unstable that will help -- I'm testing it at the moment, and hopefully will be able to drop it in today.

is the patch already on the web, so i can test it?
do you plan to write a patch also for 3.0.4?
will you please send in -users thread a mail when the patch is up and running? :)

It's xen-unstable changeset 13425:4cad44a3ad86ae83a573fa915d980a00ea430f32.

I don't plan to backport this to 3.0.4, but if someone else did, I'd apply it.

Thanks,

Ewan.

#5 lore raw
Quoted 4 lines · Ewan Mellor

It's xen-unstable changeset 13425:4cad44a3ad86ae83a573fa915d980a00ea430f32.

I don't plan to backport this to 3.0.4, but if someone else did, I'd apply it.

that is.
i tested it 10 times on create and shutdown, plus 3 reboot, all fine

bye
d.

p.s.: is "Signed-off-by" correct?

Fix device reordering that occurs when the config gets read into dictionaries. Merging from unstable to 3.0.4

tools/python/xen/xend/XendConfig.py +22 -20
@@ -638,19 +638,11 @@
 
         # set device references in the configuration
         self['devices'] = cfg.get('devices', {})
-        
-        self['console_refs'] = []
-        self['vif_refs'] = []
-        self['vbd_refs'] = []
-        self['vtpm_refs'] = []
-        for dev_uuid, (dev_type, dev_info) in self['devices'].items():
-            if dev_type == 'vif':
-                self['vif_refs'].append(dev_uuid)
-            elif dev_type in ('vbd','tap'):
-                self['vbd_refs'].append(dev_uuid)
-            elif dev_type in ('vtpm',):
-                self['vtpm_refs'].append(dev_uuid)
-        
+        self['console_refs'] = cfg.get('console_refs', [])
+        self['vif_refs'] = cfg.get('vif_refs', [])
+        self['vbd_refs'] = cfg.get('vbd_refs', [])
+        self['vtpm_refs'] = cfg.get('vtpm_refs', [])
+
 
     def _sxp_to_xapi_unsupported(self, sxp_cfg):
         """Read in an SXP configuration object and populate
@@ -966,8 +958,8 @@
                 
                 dev_uuid = cfg_xenapi.get('uuid', uuid.createString())
                 dev_info['uuid'] = dev_uuid
-                self['devices'][dev_uuid] = (dev_type, dev_info)
-                self['vif_refs'].append(dev_uuid)
+                target['devices'][dev_uuid] = (dev_type, dev_info)
+                target['vif_refs'].append(dev_uuid)
                 return dev_uuid
             
             elif dev_type in ('vbd', 'tap'):
@@ -988,8 +980,8 @@
 
                 dev_uuid = cfg_xenapi.get('uuid', uuid.createString())
                 dev_info['uuid'] = dev_uuid
-                self['devices'][dev_uuid] = (dev_type, dev_info)
-                self['vbd_refs'].append(dev_uuid)                
+                target['devices'][dev_uuid] = (dev_type, dev_info)
+                target['vbd_refs'].append(dev_uuid)                
                 return dev_uuid
 
             elif dev_type in ('vtpm'):
@@ -998,8 +990,8 @@
 
                 dev_uuid = cfg_xenapi.get('uuid', uuid.createString())
                 dev_info['uuid'] = dev_uuid
-                self['devices'][dev_uuid] = (dev_type, dev_info)
-                self['vtpm_refs'].append(dev_uuid)
+                target['devices'][dev_uuid] = (dev_type, dev_info)
+                target['vtpm_refs'].append(dev_uuid)
                 return dev_uuid
 
         return ''
@@ -1046,6 +1038,14 @@
 
         return sxpr
 
+    def ordered_device_refs(self):
+        result = (self['console_refs'] +
+                  self['vbd_refs'] +
+                  self['vif_refs'] +
+                  self['vtpm_refs'])
+        result.extend([u for u in self['devices'].keys() if u not in result])
+        return result
+
     def all_devices_sxpr(self):
         """Returns the SXPR for all devices in the current configuration."""
         sxprs = []
@@ -1054,7 +1054,9 @@
         if 'devices' not in self:
             return sxprs
         
-        for dev_type, dev_info in self['devices'].values():
+        ordered_refs = self.ordered_device_refs()
+        for dev_uuid in ordered_refs:
+            dev_type, dev_info = self['devices'][dev_uuid]
             if dev_type == 'pci': # special case for pci devices
                 sxpr = [['uuid', dev_info['uuid']]]
                 for pci_dev_info in dev_info['devs']:
tools/python/xen/xend/XendDomainInfo.py +4 -2
@@ -1189,8 +1189,10 @@
 
         @raise: VmError for invalid devices
         """
-        for (devclass, config) in self.info.get('devices', {}).values():
-            if devclass in XendDevices.valid_devices():            
+        ordered_refs = self.info.ordered_device_refs()
+        for dev_uuid in ordered_refs:
+            devclass, config = self.info['devices'][dev_uuid]
+            if devclass in XendDevices.valid_devices():
                 log.info("createDevice: %s : %s" % (devclass, scrub_password(config)))
                 self._createDevice(devclass, config)
 
tools/python/xen/xend/image.py +29 -26

77 lines not on this page · raw message

tools/python/xen/xend/tests/test_XendConfig.py +42 -0

42 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw
Quoted 9 lines · Daniele Palumbo
Quoted 4 lines · Ewan Mellor

It's xen-unstable changeset 13425:4cad44a3ad86ae83a573fa915d980a00ea430f32.

I don't plan to backport this to 3.0.4, but if someone else did, I'd apply it.

that is.
i tested it 10 times on create and shutdown, plus 3 reboot, all fine

Quoted 6 lines

bye
d.

p.s.: is "Signed-off-by" correct?

Yes, that's right. I've applied this patch, thank you.

Ewan.