Skip to contentSkip to conversation

for expanding the vbd devices

PATCH In review Hidetoshi Nishi 2 participants 6 messages Nov 8, 2006 – Nov 30, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 for expanding the vbd devices

Hi all.

I send the following message and patch about two weeks ago. But there is no response.

Is there any problem or no ?

Please let me know.

Thank you, Nishi

-----------------------転送元のメール-----------------------

From:     Hidetoshi Nishi <[email protected]>
To:       [email protected]
Subject:  [Xen-devel] Patch for expanding the vbd devices

Hi all.

My name is Hidetoshi Nishi, work for FUJITSU.

I make a patch for expanding the vbd devices up to 256.

And I tested the patch, I have following problem.

If the guest's kernel has SCSI driver already, guest's kernel gets major number when guest is initialized, even though guest config file not includes sdx device.
And after guest is initialied, I try to attach vbd using block-attach as sdx, attached vbd can't get major number of SCSI, because SCSI driver get the major number already. Then I can't attach vbd.

Accordingly I made SCSI driver to be moduled, and I tried to test the patch.

I try to increse vbd devices up to 120, and it seems be O.K.

Best regards, Nishi

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

# HG changeset patch
# User [email protected]
# Node ID 8f9ad09496f902e22af934c8d35f51722dd5c589 # Parent 34b6073592d9379bdb1655551147e3c26bc0a042 Expand number of VBD Volume

linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c +34 -12
diff -r 34b6073592d9 -r 8f9ad09496f9 linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
@@ -50,7 +50,7 @@
  */
 
 #define NUM_IDE_MAJORS 10
-#define NUM_SCSI_MAJORS 9
+#define NUM_SCSI_MAJORS 17
 #define NUM_VBD_MAJORS 1
 
 static struct xlbd_type_info xlbd_ide_type = {
@@ -165,8 +165,11 @@ xlbd_get_major_info(int vdevice)
 	case SCSI_DISK1_MAJOR ... SCSI_DISK7_MAJOR:
 		index = 11 + major - SCSI_DISK1_MAJOR;
 		break;
-	case SCSI_CDROM_MAJOR: index = 18; break;
-	default: index = 19; break;
+        case SCSI_DISK8_MAJOR ... SCSI_DISK15_MAJOR:
+                index = 18 + major - SCSI_DISK8_MAJOR;
+                break;
+        case SCSI_CDROM_MAJOR: index = 26; break;
+        default: index = 27; break;
 	}
 
 	mi = ((major_info[index] != NULL) ? major_info[index] :
@@ -227,6 +230,7 @@ xlvbd_alloc_gendisk(int minor, blkif_sec
 	struct xlbd_major_info *mi;
 	int nr_minors = 1;
 	int err = -ENODEV;
+	unsigned int offset;
 
 	BUG_ON(info->gd != NULL);
 	BUG_ON(info->mi != NULL);
@@ -244,15 +248,33 @@ xlvbd_alloc_gendisk(int minor, blkif_sec
 	if (gd == NULL)
 		goto out;
 
-	if (nr_minors > 1)
-		sprintf(gd->disk_name, "%s%c", mi->type->diskname,
-			'a' + mi->index * mi->type->disks_per_major +
-			(minor >> mi->type->partn_shift));
-	else
-		sprintf(gd->disk_name, "%s%c%d", mi->type->diskname,
-			'a' + mi->index * mi->type->disks_per_major +
-			(minor >> mi->type->partn_shift),
-			minor & ((1 << mi->type->partn_shift) - 1));
+	offset =  mi->index * mi->type->disks_per_major +
+			(minor >> mi->type->partn_shift);
+	if (nr_minors > 1) {
+		if (offset < 26) {
+			sprintf(gd->disk_name, "%s%c",
+				 mi->type->diskname, 'a' + offset );
+		}
+		else {
+			sprintf(gd->disk_name, "%s%c%c",
+				mi->type->diskname,
+				'a' + ((offset/26)-1), 'a' + (offset%26) );
+		}
+	}
+	else {
+		if (offset < 26) {
+			sprintf(gd->disk_name, "%s%c%d",
+				mi->type->diskname,
+				'a' + offset,
+				minor & ((1 << mi->type->partn_shift) - 1));
+		}
+		else {
+			sprintf(gd->disk_name, "%s%c%c%d",
+				mi->type->diskname,
+				'a' + ((offset/26)-1), 'a' + (offset%26),
+				minor & ((1 << mi->type->partn_shift) - 1));
+		}
+	}
 
 	gd->major = mi->major;
 	gd->first_minor = minor;
tools/python/xen/util/blkif.py +9 -2
diff -r 34b6073592d9 -r 8f9ad09496f9 tools/python/xen/util/blkif.py
@@ -24,8 +24,15 @@ def blkdev_name_to_number(name):
         log.debug("exception looking up device number for %s: %s", name, ex)
         pass
 
-    if re.match( '/dev/sd[a-p]([1-9]|1[0-5])?', n):
-        return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:] or 0)
+    scsi_major = [ 8, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135 ]
+    if re.match( '/dev/sd[a-z]([1-9]|1[0-5])?$', n):
+        major = scsi_major[(ord(n[7:8]) - ord('a')) / 16]
+        minor = ((ord(n[7:8]) - ord('a')) % 16) * 16 + int(n[8:] or 0)
+        return major * 256 + minor
+    if re.match( '/dev/sd[a-i][a-z]([1-9]|1[0-5])?$', n):
+        major = scsi_major[((ord(n[7:8]) - ord('a') + 1) * 26 + (ord(n[8:9]) - ord('a'))) / 16 ]
+        minor = (((ord(n[7:8]) - ord('a') + 1 ) * 26 + (ord(n[8:9]) - ord('a'))) % 16) * 16 + int(n[9:] or 0)
+        return major * 256 + minor
 
     if re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
         ide_majors = [ 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 ]
tools/python/xen/xend/server/DevController.py +1 -1
diff -r 34b6073592d9 -r 8f9ad09496f9 tools/python/xen/xend/server/DevController.py
@@ -25,7 +25,7 @@ from xen.xend.xenstore.xstransact import
 from xen.xend.xenstore.xstransact import xstransact, complete
 from xen.xend.xenstore.xswatch import xswatch
 
-DEVICE_CREATE_TIMEOUT = 100
+DEVICE_CREATE_TIMEOUT = 600
 HOTPLUG_STATUS_NODE = "hotplug-status"
 HOTPLUG_ERROR_NODE  = "hotplug-error"
 HOTPLUG_STATUS_ERROR = "error"

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

#1 lore raw

Hi all.

Thank you for applying the patch.

I have one question.

The patch I sent includes extending the timer of device creation. But this change is not merged, it has some problem.

If you have some comment, please let me know.

Thanks a lot, Nishi

----------------------------------------------------------------
--- a/tools/python/xen/xend/server/DevController.py Thu Oct 26 18:
03:43 2006 +0900
+++ b/tools/python/xen/xend/server/DevController.py Thu Oct 26 18:
22:09 2006 +0900
@@ -25,7 +25,7 @@ from xen.xend.xenstore.xstransact import
from xen.xend.xenstore.xstransact import xstransact, complete from xen.xend.xenstore.xswatch import xswatch

-DEVICE_CREATE_TIMEOUT = 100
+DEVICE_CREATE_TIMEOUT = 600
HOTPLUG_STATUS_NODE = "hotplug-status"
HOTPLUG_ERROR_NODE = "hotplug-error"
HOTPLUG_STATUS_ERROR = "error"

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

Quoted 39 lines
From:     Hidetoshi Nishi <[email protected]>
To:       [email protected]
Subject:  [Xen-devel] Patch for expanding the vbd devices

Hi all.

My name is Hidetoshi Nishi, work for FUJITSU.

I make a patch for expanding the vbd devices up to 256.

And I tested the patch, I have following problem.

If the guest's kernel has SCSI driver already, guest's kernel gets major number when guest is initialized, even though guest config file not includes sdx device.
And after guest is initialied, I try to attach vbd using block-attach as sdx, attached vbd can't get major number of SCSI, because SCSI driver get the major number already. Then I can't attach vbd.

Accordingly I made SCSI driver to be moduled, and I tried to test the patch.

I try to increse vbd devices up to 120, and it seems be O.K.

Best regards, Nishi

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

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

#2 lore raw
Quoted 2 lines · Hidetoshi Nishi

The patch I sent includes extending the timer of device creation. But this change is not merged, it has some problem.

One and a half minutes is really long enough to wait. Most users will assume a problem has occurred well before that.

-- Keir

#3 lore raw

 Hi Keir,

 I think the extending the timer of device creation is needed for
expanding the vbd devices.
 Because I tested the patch upto 120 device, I had that the domain could not create caused by the timer of domain create expired. Then we need the change of extending the timer.

And I think it is better to add the logic of displaying the progress of domain creating like as sand clock, because user confuse that the sequence of creating is working or not. But I have no action about this.

Thank you Nishi

Quoted 12 lines · Hidetoshi Nishi
Quoted 3 lines

The patch I sent includes extending the timer of device creation. But this change is not merged, it has some problem.

One and a half minutes is really long enough to wait. Most users will assume a problem has occurred well before that.

-- Keir

#4 lore raw
Quoted 10 lines · Hidetoshi Nishi

 I think the extending the timer of device creation is needed for
expanding the vbd devices.
 Because I tested the patch upto 120 device, I had that the domain could not create caused by the timer of domain create expired. Then we need the change of extending the timer.

And I think it is better to add the logic of displaying the progress of domain creating like as sand clock, because user confuse that the sequence of creating is working or not. But I have no action about this.

Without something like that no user is going to wait 10 minutes for a domain to be created. So extending the timeout that far is quite pointless.

It would be interesting to know *why* it takes 10 minutes to set up 120 backend devices. I know there are quite a few steps involved but that is very slow. Perhaps someone could profile the system?

-- Keir

#5 lore raw

 Hi Keir-san,

 I'm very sorry to be late for the response.

 I think we have still porblem for user wish to use many disks. As you say, "there are quite a few steps involved but that is
very slow", I think so too. But Time-Out occurs to create Domain is more important problem.

I think we have two way to fix time-out problem quickly.
- extend the timer value
- be able to set timer value with config file according to number of disks

Please let me know about these.

Thank you Nishi

Quoted 29 lines
Quoted 10 lines · Hidetoshi Nishi

 I think the extending the timer of device creation is needed for
expanding the vbd devices.
 Because I tested the patch upto 120 device, I had that the domain could not create caused by the timer of domain create expired. Then we need the change of extending the timer.

And I think it is better to add the logic of displaying the progress of domain creating like as sand clock, because user confuse that the sequence of creating is working or not. But I have no action about this.

Without something like that no user is going to wait 10 minutes for a domain to be created. So extending the timeout that far is quite pointless.

It would be interesting to know *why* it takes 10 minutes to set up 120 backend devices. I know there are quite a few steps involved but that is very slow. Perhaps someone could profile the system?

-- Keir

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