Mageia Bugzilla – Attachment 2304 Details for
Bug 5865
Installation process cant find xen virtual harddrive
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
add support for Xen disks
5865.diff (text/plain), 2.28 KB, created by
Thierry Vignaud
on 2012-05-14 11:08:09 CEST
(
hide
)
Description:
add support for Xen disks
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2012-05-14 11:08:09 CEST
Size:
2.28 KB
patch
obsolete
>diff --git a/mdk-stage1/mount.c b/mdk-stage1/mount.c >index 6c180d8..918f5d1 100644 >--- a/mdk-stage1/mount.c >+++ b/mdk-stage1/mount.c >@@ -72,6 +72,18 @@ int ensure_dev_exists(const char * dev) > } > } else if (name[3]) > minor += (name[3] - '0'); >+ } else if (ptr_begins_static_str(name, "xvd")) { >+ /* Virtual disks */ >+ major = 202; >+ minor = (name[2] - 'a') << 4; >+ if (name[4] && name[5]) { >+ minor += 10 + (name[5] - '0'); >+ if (name[4] > 1 || name[5] > 5) { >+ log_message("I don't know how to create device %s, please post bugreport to me!", dev); >+ return -1; >+ } >+ } else if (name[4]) >+ minor += (name[4] - '0'); > } else if (ptr_begins_static_str(name, "hd")) { > /* IDE disks/cd's */ > if (name[2] == 'a') >diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm >index d560322..cafc82e 100644 >--- a/perl-install/detect_devices.pm >+++ b/perl-install/detect_devices.pm >@@ -33,7 +33,7 @@ sub get() { > #- 2. The first SCSI device if SCSI exists. Or > #- 3. The first RAID device if RAID exists. > >- getIDE(), getSCSI(), getVirtIO(), getDAC960(), getCompaqSmartArray(), getATARAID(); >+ getIDE(), getSCSI(), getXenBlk(), getVirtIO(), getDAC960(), getCompaqSmartArray(), getATARAID(); > } > sub hds() { grep { may_be_a_hd($_) } get() } > sub tapes() { grep { $_->{media_type} eq 'tape' } get() } >@@ -386,6 +386,14 @@ sub getATARAID() { > values %l; > } > >+sub getXenBlk() { >+ -d '/sys/bus/xen/devices' or return; >+ map { >+ s/block://; >+ { device => basename($_), info => "Xen block device", media_type => 'xvd', bus => 'xen' }; >+ } glob("/sys/bus/xen/devices/*/block*"); >+} >+ > sub getVirtIO() { > -d '/sys/bus/virtio/devices' or return; > map { >diff --git a/perl-install/devices.pm b/perl-install/devices.pm >index 3810f1f..9e67042 100644 >--- a/perl-install/devices.pm >+++ b/perl-install/devices.pm >@@ -212,7 +212,7 @@ sub make($) { > > sub simple_partition_scan { > my ($part) = @_; >- $part->{device} =~ /([hsv]d[a-z])(\d+)$/; >+ $part->{device} =~ /((?:[hsv]|xv)d[a-z])(\d+)$/; > } > sub part_number { > my ($part) = @_; >@@ -230,7 +230,7 @@ sub prefix_for_dev { > > sub should_prefer_UUID { > my ($dev) = @_; >- $dev =~ /^([hsv]d)/; >+ $dev =~ /^((?:[hsv]|xv)d)/; > } > > sub symlink_now_and_register {
diff --git a/mdk-stage1/mount.c b/mdk-stage1/mount.c index 6c180d8..918f5d1 100644 --- a/mdk-stage1/mount.c +++ b/mdk-stage1/mount.c @@ -72,6 +72,18 @@ int ensure_dev_exists(const char * dev) } } else if (name[3]) minor += (name[3] - '0'); + } else if (ptr_begins_static_str(name, "xvd")) { + /* Virtual disks */ + major = 202; + minor = (name[2] - 'a') << 4; + if (name[4] && name[5]) { + minor += 10 + (name[5] - '0'); + if (name[4] > 1 || name[5] > 5) { + log_message("I don't know how to create device %s, please post bugreport to me!", dev); + return -1; + } + } else if (name[4]) + minor += (name[4] - '0'); } else if (ptr_begins_static_str(name, "hd")) { /* IDE disks/cd's */ if (name[2] == 'a') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index d560322..cafc82e 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -33,7 +33,7 @@ sub get() { #- 2. The first SCSI device if SCSI exists. Or #- 3. The first RAID device if RAID exists. - getIDE(), getSCSI(), getVirtIO(), getDAC960(), getCompaqSmartArray(), getATARAID(); + getIDE(), getSCSI(), getXenBlk(), getVirtIO(), getDAC960(), getCompaqSmartArray(), getATARAID(); } sub hds() { grep { may_be_a_hd($_) } get() } sub tapes() { grep { $_->{media_type} eq 'tape' } get() } @@ -386,6 +386,14 @@ sub getATARAID() { values %l; } +sub getXenBlk() { + -d '/sys/bus/xen/devices' or return; + map { + s/block://; + { device => basename($_), info => "Xen block device", media_type => 'xvd', bus => 'xen' }; + } glob("/sys/bus/xen/devices/*/block*"); +} + sub getVirtIO() { -d '/sys/bus/virtio/devices' or return; map { diff --git a/perl-install/devices.pm b/perl-install/devices.pm index 3810f1f..9e67042 100644 --- a/perl-install/devices.pm +++ b/perl-install/devices.pm @@ -212,7 +212,7 @@ sub make($) { sub simple_partition_scan { my ($part) = @_; - $part->{device} =~ /([hsv]d[a-z])(\d+)$/; + $part->{device} =~ /((?:[hsv]|xv)d[a-z])(\d+)$/; } sub part_number { my ($part) = @_; @@ -230,7 +230,7 @@ sub prefix_for_dev { sub should_prefer_UUID { my ($dev) = @_; - $dev =~ /^([hsv]d)/; + $dev =~ /^((?:[hsv]|xv)d)/; } sub symlink_now_and_register {
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 5865
: 2304