Skip to contentSkip to conversation

exception looking up device number f,or hda

DISCUSSION Arun Sharma 7 participants 14 messages Aug 5, 2005 – Aug 9, 2005 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi Mike,

I have the following line in my config file:

disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]

and my host doesn't have a /dev/hda (it has a SATA disk which shows up as /dev/sda).

But I would like the guest to see a /dev/hda. Sounds reasonable?

Now, when I try to create this domain, I get:

[2005-08-05 14:40:53 xend] DEBUG (blkif:24) exception looking up device number for hda: [Errno 2] No such file or directory: '/dev/hda'

2005-08-05 14:40:53 xend] DEBUG (blkif:449) Destroying blkif domain=1

[2005-08-05 14:40:53 xend] DEBUG (blkif:337) Destroying vbd domain=1 id=0

The code in util/blkif.py that tries to convert name to device number doesn't seem to be new, but I don't know why it started showing up suddenly.

I worked around by manually creating /dev/hda, but I don't think it's reasonable to expect that host's /dev contains entries for all guest devices.

Also, the effect of having a bad "disk=" line in xmdefconfig (such as pointing to a non-existent file) results in a xend crash. We probably need to add a few checks at the python level so that the user sees a more useful stack trace.

-Arun

#1 lore raw

Hi Arun,

I just pulled the latest unstable and could not reproduce. I have an identical scenario (no /dev/hda only /dev/sda due to SATA).

Also, if the devno resolution code fails you should also get a vbd: Device not found exception in the logs. The exception you are seeing is not actually a problem, it just means that stat has failed.

We should probably cleanup that error message.

Can you post a more complete log file? I think the error is being caused somewhere else.

Thanks,

Anthony Liguori

Quoted 29 lines · Arun Sharma

Hi Mike,

I have the following line in my config file:

disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]

and my host doesn't have a /dev/hda (it has a SATA disk which shows up as /dev/sda).

But I would like the guest to see a /dev/hda. Sounds reasonable?

Now, when I try to create this domain, I get:

[2005-08-05 14:40:53 xend] DEBUG (blkif:24) exception looking up device number for hda: [Errno 2] No such file or directory: '/dev/hda'

2005-08-05 14:40:53 xend] DEBUG (blkif:449) Destroying blkif domain=1

[2005-08-05 14:40:53 xend] DEBUG (blkif:337) Destroying vbd domain=1 id=0

The code in util/blkif.py that tries to convert name to device number doesn't seem to be new, but I don't know why it started showing up suddenly.

I worked around by manually creating /dev/hda, but I don't think it's reasonable to expect that host's /dev contains entries for all guest devices.

Also, the effect of having a bad "disk=" line in xmdefconfig (such as pointing to a non-existent file) results in a xend crash. We probably need to add a few checks at the python level so that the user sees a more useful stack trace.

-Arun

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

#2 lore raw
Quoted 11 lines · Anthony Liguori

Hi Arun,

I just pulled the latest unstable and could not reproduce. I have an identical scenario (no /dev/hda only /dev/sda due to SATA).

Also, if the devno resolution code fails you should also get a vbd: Device not found exception in the logs. The exception you are seeing is not actually a problem, it just means that stat has failed.

We should probably cleanup that error message.

Can you post a more complete log file? I think the error is being caused somewhere else.

Hi Anthony,

You're probably not able to reproduce the problem because you're not using VMX domains?

We're overloading the semantics of

disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]

to create a IDE hard drive for a VMX domain. So we want to take advantage of the config file parsing code from the VBD code path, but we don't want to do other tasks such as connecting the backend/frontend etc.

The log from a successful VMX domain startup looks like:

[2005-08-05 14:54:41 xend] INFO (XendRoot:126) EVENT> xend.domain.create ['fc3', 2]
[2005-08-05 14:54:42 xend] ERROR (process:37) [block-file] ioctl: LOOP_SET_FD: Device or resource busy [2005-08-05 14:54:42 xend] DEBUG (blkif:81) Connecting blkif <BlkifBackend frontend=2 backend=0 id=0> [2005-08-05 14:54:42 xend] DEBUG (blkif:89) send_be_create <BlkifBackend frontend=2 backend=0 id=0> [2005-08-05 14:54:42 xend] DEBUG (image:293) args: cdrom, val: None
[2005-08-05 14:54:42 xend] DEBUG (image:293) args: boot, val: c
[2005-08-05 14:54:42 xend] DEBUG (image:293) args: fda, val: None
[2005-08-05 14:54:42 xend] DEBUG (image:293) args: fdb, val: None
[2005-08-05 14:54:42 xend] DEBUG (image:293) args: localtime, val: None
[2005-08-05 14:54:42 xend] DEBUG (image:293) args: serial, val: None
[2005-08-05 14:54:42 xend] DEBUG (image:293) args: std-vga, val: None
[2005-08-05 14:54:42 xend] DEBUG (image:293) args: isa, val: None
[2005-08-05 14:54:42 xend] INFO (image:352) spawning device models: /usr/lib/xen/bin/qemu-dm ['/usr/lib/xen/bin/qemu-dm', ' -vncconnect', '143.183.130.223:5502', '-d', '2', '-p', '19', '-m', '128', '-boot', 'c', '-hda', '/var/images/min-el3-i386.i mg', '-vnc', '-k', 'en-us', '-vncport', '5902']

i.e. we were doing things which we really shouldn't be doing, but it didn't hurt. But it started hurting today :)

In the future, we're also planning to have a VBD driver for unmodified OSes running on VMX domains and I was thinking of a syntax such as:

disk = [ 'file:/var/images/min-el3-i386.img,vhda,w' ]

Any comments/suggestions on the syntax above to present emulated real devices as well as virtual devices to an unmodified OS?

-Arun

Complete log for the failed case:

[2005-08-05 14:40:33 xend] INFO (SrvDaemon:300) Xend Daemon started
[2005-08-05 14:40:33 xend] INFO (channel:148) Virq 3 on port 13
[2005-08-05 14:40:33 xend] DEBUG (XendDomainInfo:171) info={'vcpu_to_cpu': [0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1], 'cpu_time': 20984020436L, 'ssidref': 0, 's hutdown_reason': 0, 'dying': 0, 'dom': 0, 'running': 1, 'maxmem_kb': -4, 'paused': 0, 'crashed': 0, 'vcpus': 1, 'shutdown':
0, 'mem_kb': 250880, 'cpumap': [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0], 'blocked': 0}
[2005-08-05 14:40:33 xend] DEBUG (XendDomainInfo:172) config='None'

[2005-08-05 14:40:33 xend] INFO (SrvServer:63) unix path=/var/lib/xend/xend-socket
[2005-08-05 14:40:33 xend] INFO (XendRoot:126) EVENT> xend.start 0
[2005-08-05 14:40:33 xend] INFO (process:35) [network] network start bridge=xen-br0 netdev=eth0 antispoof=no [2005-08-05 14:40:53 xend] DEBUG (image:135) initDomain: cpu=-1 mem_kb=131204 ssidref=-1 dom=1 [2005-08-05 14:40:53 xend] DEBUG (XendDomainInfo:673) init_domain> Created domain=1 name=ExampleVMXDomain memory=128 [2005-08-05 14:40:53 xend] INFO (XendRoot:126) EVENT> xend.domain.create ['ExampleVMXDomain', 1] [2005-08-05 14:40:53 xend] INFO (image:190) buildDomain os=vmx dom=1 vcpus=1
[2005-08-05 14:40:53 xend] INFO (image:259) VMX device model port: 3
[2005-08-05 14:40:53 xend] WARNING (XendDomainInfo:924) Unknown config field memmap
[2005-08-05 14:40:53 xend] WARNING (XendDomainInfo:924) Unknown config field device_model
[2005-08-05 14:40:53 xend] WARNING (XendDomainInfo:924) Unknown config field boot
[2005-08-05 14:40:53 xend] WARNING (XendDomainInfo:924) Unknown config field vnc
[2005-08-05 14:40:53 xend] WARNING (XendDomainInfo:924) Unknown config field display
[2005-08-05 14:40:53 xend] DEBUG (blkif:24) exception looking up device number for hda: [Errno 2] No such file or directory : '/dev/hda'
[2005-08-05 14:40:53 xend] DEBUG (blkif:449) Destroying blkif domain=1
[2005-08-05 14:40:53 xend] DEBUG (blkif:337) Destroying vbd domain=1 id=0

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

xend dies here <<<

[2005-08-05 14:43:32 xend] INFO (SrvDaemon:300) Xend Daemon started

#3 lore raw
In reply to Arun Sharma

Hi Arun

Quoted 1 line

disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]

Please test the following settings.
disk = [ 'file:/var/images/min-el3-i386.img,hda1,w' ]

And, it is necessary to rewrite /etc/fstab of domU.

Thank,

Akio

#4 lore raw

Re: exception looking up device number for hda

Quoted 9 lines · [email protected] wrote:

Hi Arun

Quoted 1 line

disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]

Please test the following settings. disk = [ 'file:/var/images/min-el3-i386.img,hda1,w' ]

And, it is necessary to rewrite /etc/fstab of domU.

I'm not looking for configuration help for domU.

I was looking for suggestions as to how:

a) IDE hard drives for VMX domains should be configured
b) VBD based devices for VMX domains should be configured

and the bad failure mode for (a) when the user misconfigures it.

-Arun

#5 lore raw

Re: exception looking up device number for hda

Quoted 4 lines

I was looking for suggestions as to how:

a) IDE hard drives for VMX domains should be configured
b) VBD based devices for VMX domains should be configured

Ah, I guess we have to distinguish the two...

Hope about an optional: vbd:/emu: prefix (or similar) on the second part of the triplet for a disk? The default (for non VMX domains) could be "vbd" so existing behaviour would remain the same.

If / when we move over to using "xvd" for VBDs I guess that could subsume this functionality (might still need it for non Linux guests, tho).

Thoughts?

Cheers,
Mark

Quoted 8 lines

and the bad failure mode for (a) when the user misconfigures it.

-Arun

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

#6 lore raw

Re: exception looking up device number for hda

Quoted 9 lines · Mark Williamson
Quoted 4 lines

I was looking for suggestions as to how:

a) IDE hard drives for VMX domains should be configured
b) VBD based devices for VMX domains should be configured

Ah, I guess we have to distinguish the two...

Hope about an optional: vbd:/emu: prefix (or similar) on the second part of the triplet for a disk? The default (for non VMX domains) could be "vbd" so existing behaviour would remain the same.

Sounds good to me. How about:

hda = VBD hda
vbd://hda = VBD hda
ioemu://hda = IDE hda

The VBD patches are not ready yet - so I'd like to propose that we do:

- self.create_configured_devices()
+ if self.image.ostype != 'vmx':
+ self.create_configured_devices()

and

- self.create_blkif()
+ if self.image.ostype != 'vmx':
+ self.create_blkif()

When our VBD patches are ready, we'll revert this.

-Arun

#7 lore raw

Re: exception looking up device number for hda

Quoted 5 lines · Arun Sharma

Sounds good to me. How about:

hda = VBD hda
vbd://hda = VBD hda
ioemu://hda = IDE hda

In URIs the // syntax indicates a global naming authority such as DNS (see RFC 2396 section 3.2). Here the scheme-specific-part is in a local namespace, so it should be just "vbd:hda", for example.

Signature · 1 line
David Hopwood <[email protected]>
#8 lore raw

Re: exception looking up device number for hda

In reply to Arun Sharma
Quoted 9 lines
Quoted 3 lines

Hope about an optional: vbd:/emu: prefix (or similar) on the second part of the triplet for a disk? The default (for non VMX domains) could be "vbd" so existing behaviour would remain the same.

Sounds good to me. How about:

hda = VBD hda
vbd://hda = VBD hda
ioemu://hda = IDE hda

Sounds fine but I think I'd actually ditch the // to fit in with the phy: and
file: syntax we already have. (and as David said in another post, to avoid looking like a URL).

Quoted 12 lines

The VBD patches are not ready yet - so I'd like to propose that we do:

(quoted diff) +2 -1
-            self.create_configured_devices()
+           if self.image.ostype != 'vmx':
+                self.create_configured_devices()

and

(quoted diff) +2 -1
-        self.create_blkif()
+       if self.image.ostype != 'vmx':
+            self.create_blkif()
Quoted 1 line

When our VBD patches are ready, we'll revert this.

Is there still a need for these changes if the ioemu: prefix is implemented?

Cheers,
Mark

#9 lore raw

Re: exception looking up device number for hda

I've already made a patch when I doing para-driver debugging. see the attach patch.
Does it fit the requirement?
It will skip setupping up the loop device for ioemu image files, but by xm vbd-list, it can still see the file bind to hda. so this command is still useful.

Quoted 4 lines · Mark Williamson
Quoted 4 lines
Quoted 3 lines

Hope about an optional: vbd:/emu: prefix (or similar) on the second part of the triplet for a disk? The default (for non VMX domains) could be "vbd" so existing behaviour would remain the same.

Quoted 10 lines
Quoted 5 lines

Sounds good to me. How about:

hda = VBD hda
vbd://hda = VBD hda
ioemu://hda = IDE hda

Sounds fine but I think I'd actually ditch the // to fit in with the phy: and file: syntax we already have. (and as David said in another post, to avoid looking like a URL).

tools/examples/xmexample.vmx +1 -1
diff -r 48aed1403fe3 tools/examples/xmexample.vmx
@@ -46,7 +46,7 @@
 # and MODE is r for read-only, w for read-write.
 
 #disk = [ 'phy:hda1,hda1,r' ]
-disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]
+disk = [ 'ioemu:/var/images/min-el3-i386.img,hda,w' ]
 
 #----------------------------------------------------------------------------
 # Set the kernel command line for the new domain.
tools/python/xen/xend/Blkctl.py +1 -1
diff -r 48aed1403fe3 tools/python/xen/xend/Blkctl.py
@@ -30,7 +30,7 @@
 
     # Special case phy devices - they don't require any (un)binding
     # Parallax also doesn't need script-based binding.
-    if (type == 'phy') or (type == 'parallax'):
+    if (type == 'phy') or (type == 'parallax') or (type == 'ioemu'):
         return dets
     
     if script is None:
tools/python/xen/xend/image.py +4 -2
diff -r 48aed1403fe3 tools/python/xen/xend/image.py
@@ -287,12 +287,14 @@
         device = sxp.child(self.vm.config, 'device')
         vbdinfo = sxp.child(device, 'vbd')
         if not vbdinfo:
-            raise VmError("vmx: missing vbd configuration")
+            continue
         uname = sxp.child_value(vbdinfo, 'uname')
         vbddev = sxp.child_value(vbdinfo, 'dev')
         (vbdtype, vbdparam) = string.split(uname, ':', 1)
         vbddev_list = ['hda', 'hdb', 'hdc', 'hdd']
-        if vbdtype != 'file' or vbddev not in vbddev_list:
+        if vbdtype != 'ioemu':
+            continue
+        if vbddev not in vbddev_list:
             raise VmError("vmx: for qemu vbd type=file&dev=hda~hdd")
         ret.append("-%s" % vbddev)
         ret.append("%s" % vbdparam)
tools/python/xen/xend/server/blkif.py +2 -0
diff -r 48aed1403fe3 tools/python/xen/xend/server/blkif.py
@@ -243,6 +243,8 @@
             pass
         else:
             node = Blkctl.block('bind', self.type, self.params)
+            if self.type == 'ioemu':
+                return
             self.setNode(node)
             self.attachBackend()
         if change:

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

#10 lore raw

Re: exception looking up device number for hda

tools/examples/xmexample.vmx line 49

Quoted 9 lines · Xiaofeng Ling

I've already made a patch when I doing para-driver debugging. see the attach patch.
Does it fit the requirement?
It will skip setupping up the loop device for ioemu image files, but by xm vbd-list, it can still see the file bind to hda. so this command is still useful.

tools/examples/xmexample.vmx +1 -1
-disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]
+disk = [ 'ioemu:/var/images/min-el3-i386.img,hda,w' ]

The ioemu: prefix should be on the second element i.e:

+disk = [ 'file:/var/images/min-el3-i386.img,ioemu:hda,w' ]

and it should allow:

+disk = [ 'phy:hdb,ioemu:hda,w' ]

-Arun

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: exception looking up device number for hda

Quoted 9 lines · Mark Williamson
Quoted 9 lines

The VBD patches are not ready yet - so I'd like to propose that we do:

(quoted diff) +2 -1
-            self.create_configured_devices()
+           if self.image.ostype != 'vmx':
+                self.create_configured_devices()

and

Quoted 8 lines
Quoted 5 lines
(quoted diff) +2 -1
-        self.create_blkif()
+       if self.image.ostype != 'vmx':
+            self.create_blkif()

When our VBD patches are ready, we'll revert this.

Is there still a need for these changes if the ioemu: prefix is implemented?

We'll implement the ioemu prefix ASAP - just trying to make sure that 3.0-testing ships with working VMX support :)

-Arun

#13 lore raw

Re: exception looking up device number for hda

Quoted 5 lines
Quoted 2 lines

Is there still a need for these changes if the ioemu: prefix is implemented?

We'll implement the ioemu prefix ASAP - just trying to make sure that 3.0-testing ships with working VMX support :)

Sure thing :-)

I wouldn't have thought the ioemu: prefix should be too hard to implement. If it looks like taking a while you could try submitting a patch with your workaround before the -testing release.

Cheers,
Mark

#14 lore raw
In reply to Arun Sharma
Quoted 12 lines · Arun Sharma

Hi Mike,

I have the following line in my config file:

disk = [ 'file:/var/images/min-el3-i386.img,hda,w' ]

and my host doesn't have a /dev/hda (it has a SATA disk which shows up as /dev/sda).

But I would like the guest to see a /dev/hda. Sounds reasonable?

Now, when I try to create this domain, I get:

Quoted 7 lines

[2005-08-05 14:40:53 xend] DEBUG (blkif:24) exception looking up device number for hda: [Errno 2] No such file or directory: '/dev/hda'

2005-08-05 14:40:53 xend] DEBUG (blkif:449) Destroying blkif domain=1

[2005-08-05 14:40:53 xend] DEBUG (blkif:337) Destroying vbd domain=1 id=0

The code in util/blkif.py that tries to convert name to device number doesn't seem to be new, but I don't know why it started showing up suddenly.

I worked around by manually creating /dev/hda, but I don't think it's reasonable to expect that host's /dev contains entries for all guest devices.

No, and the blkdev_name_to_number() function should convert names like /dev/hda without the device existing. This code should be trapping the error:

try:
return os.stat(n).st_rdev
except Exception, ex:
log.debug("exception looking up device number for %s: %s", name, ex) pass

The code then uses regexps to analyse the device name (though you will see the debug message in the log).

What xen version are you using?

Quoted 2 lines

Also, the effect of having a bad "disk=" line in xmdefconfig (such as pointing to a non-existent file) results in a xend crash. We probably need to add a few checks at the python level so that the user sees a more useful stack trace.

All errors during domain construction are intended to be trapped and returned to the caller - so maybe something got broken.
Did you see anything in the xend log?
Might be worth causing the error using xend with tracing on (xend trace_start) and having a look at the trace (/var/log/xend.trace).

Mike