]> git.proxmox.com Git - qemu-server.git/commitdiff
correctly return and use device type in scsi_inquiry
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 15 Jul 2013 11:19:54 +0000 (13:19 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 15 Jul 2013 11:46:41 +0000 (13:46 +0200)
PVE/QemuServer.pm

index f1369279c14ef96dddeb280f39961bc71d95362b..321f6a982a9859b25523c1f942b296f9166e77d8 100644 (file)
@@ -1017,9 +1017,12 @@ sub scsi_inquiry {
     }
 
     my $res = {};
-    ($res->{device}, $res->{removable}, $res->{venodor},
+    (my $byte0, my $byte1, $res->{vendor},
      $res->{product}, $res->{revision}) = unpack("C C x6 A8 A16 A4", $buf);
 
+    $res->{removable} = $byte1 & 128 ? 1 : 0;
+    $res->{type} = $byte0 & 31;
+
     return $res;
 }
 
@@ -1060,7 +1063,13 @@ sub print_drivedevice_full {
              if($path =~ m/^iscsi\:\/\//){
                  $devicetype = 'generic';
              } else {
-                 $devicetype = 'block' if path_is_scsi($path);
+                 if (my $info = path_is_scsi($path)) {
+                     if ($info->{type} == 0) {
+                         $devicetype = 'block';
+                     } elsif ($info->{type} == 1) { # tape
+                         $devicetype = 'generic';
+                     }
+                 }
              }
          }