2008-01-30 06:55:56 +00:00
|
|
|
#include <config.h>
|
2008-01-29 18:36:00 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2011-11-18 21:21:54 +00:00
|
|
|
#include <sys/utsname.h>
|
2008-01-29 18:36:00 +00:00
|
|
|
|
|
|
|
#include "stats_linux.h"
|
|
|
|
#include "internal.h"
|
Move xen driver code into src/xen/ directory
* src/Makefile.am, src/proxy_internal.c, src/proxy_internal.h
src/sexpr.c, src/sexpr.h, src/xen_unified.c, src/xen_unified.h,
src/xen_internal.c, src/xen_internal.h, src/xen_inotify.c,
src/xen_inotify.h, src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h, src/xs_internal.c,
src/xs_internal.h: Move to src/xen/ directory
* proxy/Makefile.am, proxy/libvirt_proxy.c, src/Makefile.am,
src/libvirt.c, tests/sexpr2xmltest.c, tests/statstest.c,
tests/xencapstest.c, tests/xmconfigtest.c, tests/xml2sexprtest.c:
Adapt to changed xen location
* src/stats_linux.h, src/stats_linux.c: Remove xen specific block
stats APIs
* src/qemu_driver.c, src/uml_driver.c: Add missing sys/un.h include
uncovered after change to stats_linux.h
* src/xen/block_stats.h, src/xen/block_stats.c: Add xen specific
block stats APIs
2009-09-15 15:38:33 +00:00
|
|
|
#include "xen/block_stats.h"
|
2008-04-18 15:28:33 +00:00
|
|
|
#include "testutils.h"
|
2011-07-07 21:53:41 +00:00
|
|
|
#include "command.h"
|
2008-04-18 15:28:33 +00:00
|
|
|
|
2008-02-22 12:33:47 +00:00
|
|
|
static void testQuietError(void *userData ATTRIBUTE_UNUSED,
|
|
|
|
virErrorPtr error ATTRIBUTE_UNUSED)
|
2008-01-29 18:36:00 +00:00
|
|
|
{
|
|
|
|
/* nada */
|
|
|
|
}
|
|
|
|
|
|
|
|
static int testDevice(const char *path, int expect)
|
|
|
|
{
|
2011-07-07 16:15:05 +00:00
|
|
|
int actual = xenLinuxDomainDeviceID(1, path);
|
2008-01-29 18:36:00 +00:00
|
|
|
|
|
|
|
if (actual == expect) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
2009-11-30 19:01:31 +00:00
|
|
|
if (virTestGetDebug())
|
2008-04-18 15:28:33 +00:00
|
|
|
fprintf(stderr, "Expect %-6d Actual %-6d\n", expect, actual);
|
2008-01-29 18:36:00 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
2008-04-18 15:28:33 +00:00
|
|
|
|
|
|
|
struct testInfo
|
|
|
|
{
|
|
|
|
const char *dev;
|
|
|
|
int num;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int testDeviceHelper(const void *data)
|
|
|
|
{
|
|
|
|
const struct testInfo *info = data;
|
|
|
|
return testDevice(info->dev, info->num);
|
|
|
|
}
|
|
|
|
|
2008-05-29 15:31:49 +00:00
|
|
|
static int
|
2011-04-29 16:21:20 +00:00
|
|
|
mymain(void)
|
2008-01-29 18:36:00 +00:00
|
|
|
{
|
|
|
|
int ret = 0;
|
2011-07-07 21:53:41 +00:00
|
|
|
int status;
|
|
|
|
virCommandPtr cmd;
|
2011-11-18 21:21:54 +00:00
|
|
|
struct utsname ut;
|
2011-07-07 21:53:41 +00:00
|
|
|
|
2011-11-18 21:21:54 +00:00
|
|
|
/* Skip test if xend is not running. Calling xend on a non-xen
|
|
|
|
kernel causes some versions of xend to issue a crash report, so
|
|
|
|
we first probe uname results. */
|
|
|
|
uname(&ut);
|
|
|
|
if (strstr(ut.release, "xen") == NULL)
|
|
|
|
return EXIT_AM_SKIP;
|
2011-07-07 21:53:41 +00:00
|
|
|
cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL);
|
|
|
|
if (virCommandRun(cmd, &status) != 0 || status != 0) {
|
|
|
|
virCommandFree(cmd);
|
|
|
|
return EXIT_AM_SKIP;
|
|
|
|
}
|
|
|
|
virCommandFree(cmd);
|
|
|
|
|
|
|
|
/* Some of our tests deliberately test failure cases, so
|
2008-01-29 18:36:00 +00:00
|
|
|
* register a handler to stop error messages cluttering
|
|
|
|
* up display
|
|
|
|
*/
|
2009-11-30 19:01:31 +00:00
|
|
|
if (!virTestGetDebug())
|
2008-01-29 18:36:00 +00:00
|
|
|
virSetErrorFunc(NULL, testQuietError);
|
|
|
|
|
2010-10-14 12:22:18 +00:00
|
|
|
#define DO_TEST(dev, num) \
|
2008-04-18 15:28:33 +00:00
|
|
|
do { \
|
|
|
|
struct testInfo info = { dev, num }; \
|
|
|
|
if (virtTestRun("Device " dev " -> " # num, \
|
|
|
|
1, testDeviceHelper, &info) < 0) \
|
|
|
|
ret = -1; \
|
|
|
|
} while (0)
|
|
|
|
|
2008-01-29 18:36:00 +00:00
|
|
|
/********************************
|
|
|
|
* Xen paravirt disks
|
|
|
|
********************************/
|
|
|
|
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
DO_TEST("xvd", -1);
|
|
|
|
|
2008-01-29 18:36:00 +00:00
|
|
|
/* first valid disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("xvda", 51712);
|
|
|
|
DO_TEST("xvda1", 51713);
|
|
|
|
DO_TEST("xvda15", 51727);
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* Last non-extended disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("xvdp", 51952);
|
|
|
|
DO_TEST("xvdp1", 51953);
|
|
|
|
DO_TEST("xvdp15", 51967);
|
2008-01-29 18:36:00 +00:00
|
|
|
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* First extended disk */
|
|
|
|
DO_TEST("xvdq", 268439552);
|
|
|
|
DO_TEST("xvdq1", 268439553);
|
|
|
|
DO_TEST("xvdq15", 268439567);
|
|
|
|
/* Last extended disk */
|
|
|
|
DO_TEST("xvdiz", 268501760);
|
|
|
|
DO_TEST("xvdiz1", 268501761);
|
|
|
|
DO_TEST("xvdiz15", 268501775);
|
|
|
|
|
|
|
|
/* Disk letter too large */
|
|
|
|
DO_TEST("xvdja", -1);
|
|
|
|
|
2008-01-29 18:36:00 +00:00
|
|
|
/* missing disk letter */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("xvd1", -1);
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* partition too large */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("xvda16", -1);
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* partition too small */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("xvda0", -1);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* leading zeros */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("xvda01", -1);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* leading + */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("xvda+1", -1);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* leading - */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("xvda-1", -1);
|
2008-01-29 18:36:00 +00:00
|
|
|
|
|
|
|
/********************************
|
|
|
|
* IDE disks
|
|
|
|
********************************/
|
|
|
|
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
DO_TEST("hd", -1);
|
|
|
|
|
|
|
|
/* first numbered disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("hda", 768);
|
|
|
|
DO_TEST("hda1", 769);
|
|
|
|
DO_TEST("hda63", 831);
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* second numbered disk */
|
|
|
|
DO_TEST("hdb", 832);
|
|
|
|
DO_TEST("hdb1", 833);
|
|
|
|
DO_TEST("hdb63", 895);
|
|
|
|
/* third numbered disk */
|
|
|
|
DO_TEST("hdc", 5632);
|
|
|
|
DO_TEST("hdc1", 5633);
|
|
|
|
DO_TEST("hdc63", 5695);
|
|
|
|
/* fourth numbered disk */
|
|
|
|
DO_TEST("hdd", 5696);
|
|
|
|
DO_TEST("hdd1", 5697);
|
|
|
|
DO_TEST("hdd63", 5759);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* last valid disk */
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
DO_TEST("hdt", 23360);
|
|
|
|
DO_TEST("hdt1", 23361);
|
|
|
|
DO_TEST("hdt63", 23423);
|
2008-01-29 18:36:00 +00:00
|
|
|
|
|
|
|
/* Disk letter to large */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("hdu", -1);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* missing disk letter */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("hd1", -1);
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* partition too large */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("hda64", -1);
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* partition too small */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("hda0", -1);
|
2008-01-29 18:36:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************
|
|
|
|
* SCSI disks
|
|
|
|
********************************/
|
|
|
|
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
DO_TEST("sd", -1);
|
|
|
|
|
2008-01-29 18:36:00 +00:00
|
|
|
/* first valid disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sda", 2048);
|
|
|
|
DO_TEST("sda1", 2049);
|
|
|
|
DO_TEST("sda15", 2063);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* last valid disk of first SCSI major number */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sdp", 2288);
|
|
|
|
DO_TEST("sdp1", 2289);
|
|
|
|
DO_TEST("sdp15", 2303);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* first valid disk of second SCSI major number */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sdq", 16640);
|
|
|
|
DO_TEST("sdq1", 16641);
|
|
|
|
DO_TEST("sdq15", 16655);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* last valid single letter disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sdz", 16784);
|
|
|
|
DO_TEST("sdz1", 16785);
|
|
|
|
DO_TEST("sdz15", 16799);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* first valid dual letter disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sdaa", 16800);
|
|
|
|
DO_TEST("sdaa1", 16801);
|
|
|
|
DO_TEST("sdaa15", 16815);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* second valid dual letter disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sdab", 16816);
|
|
|
|
DO_TEST("sdab1", 16817);
|
|
|
|
DO_TEST("sdab15", 16831);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* first letter of second sequence of dual letter disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sdba", 17216);
|
|
|
|
DO_TEST("sdba1", 17217);
|
|
|
|
DO_TEST("sdba15", 17231);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* last valid dual letter disk */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sdiv", 34800);
|
|
|
|
DO_TEST("sdiv1", 34801);
|
|
|
|
DO_TEST("sdiv15", 34815);
|
2008-01-29 18:36:00 +00:00
|
|
|
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* Disk letter too large */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sdix", -1);
|
2008-01-29 18:36:00 +00:00
|
|
|
/* missing disk letter */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sd1", -1);
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* partition too large */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sda16", -1);
|
Recently upstream Xen added support for having xvd devices > 16. For the most
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2008-08-05 16:38:49 +00:00
|
|
|
/* partition too small */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("sda0", -1);
|
2008-01-29 18:36:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Path stripping */
|
2008-04-18 15:28:33 +00:00
|
|
|
DO_TEST("/dev", -1);
|
|
|
|
DO_TEST("/dev/", -1);
|
|
|
|
DO_TEST("/dev/xvd", -1);
|
|
|
|
DO_TEST("/dev/xvda", 51712);
|
|
|
|
DO_TEST("/dev/xvda1", 51713);
|
|
|
|
DO_TEST("/dev/xvda15", 51727);
|
2008-01-29 18:36:00 +00:00
|
|
|
|
2012-03-22 11:33:35 +00:00
|
|
|
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
2008-01-29 18:36:00 +00:00
|
|
|
}
|
2008-05-29 15:31:49 +00:00
|
|
|
|
|
|
|
VIRT_TEST_MAIN(mymain)
|