예제 #1
0
    def test_collect_edd_data(self):
        from blivet.devicelibs import edd

        # test with vda, vdb
        EddTestFS(self, edd).vda_vdb()
        edd_dict = edd.collect_edd_data()
        self.assertEqual(len(edd_dict), 2)
        self.assertEqual(edd_dict[0x80].type, "SCSI")
        self.assertEqual(edd_dict[0x80].scsi_id, 0)
        self.assertEqual(edd_dict[0x80].scsi_lun, 0)
        self.assertEqual(edd_dict[0x80].pci_dev, "00:05.0")
        self.assertEqual(edd_dict[0x80].channel, 0)
        self.assertEqual(edd_dict[0x80].sectors, 16777216)
        self.assertEqual(edd_dict[0x81].pci_dev, "00:06.0")

        # test with sda, vda
        EddTestFS(self, edd).sda_vda()
        edd_dict = edd.collect_edd_data()
        self.assertEqual(len(edd_dict), 2)
        self.assertEqual(edd_dict[0x80].type, "ATA")
        self.assertEqual(edd_dict[0x80].scsi_id, None)
        self.assertEqual(edd_dict[0x80].scsi_lun, None)
        self.assertEqual(edd_dict[0x80].pci_dev, "00:01.1")
        self.assertEqual(edd_dict[0x80].channel, 0)
        self.assertEqual(edd_dict[0x80].sectors, 2097152)
        self.assertEqual(edd_dict[0x80].ata_device, 0)
        self.assertEqual(edd_dict[0x80].mbr_signature, "0x000ccb01")
예제 #2
0
    def test_collect_edd_data_cciss(self):
        from blivet.devicelibs import edd
        EddTestFS(self, edd).sda_cciss()
        edd_dict = edd.collect_edd_data()

        self.assertEqual(edd_dict[0x80].pci_dev, None)
        self.assertEqual(edd_dict[0x80].channel, None)
예제 #3
0
    def test_collect_edd_data_bad_sata_virt(self):
        self._edd_logger.debug("starting test %s", self._testMethodName)
        edd.testdata_log.debug("starting test %s", self._testMethodName)
        # test with sata sda, usb sdb
        fakeedd = {
            0x80: FakeEddEntry(version="0x30", mbr_sig="0x86531966",
                               sectors=10485760,
                               sysfspath="/sys/firmware/edd/int13_dev80/"),
            0x81: FakeEddEntry(version="0x30", mbr_sig="0xe3bf124b",
                               sectors=419432,
                               sysfspath="/sys/firmware/edd/int13_dev81/"),
            0x82: FakeEddEntry(version="0x30", mbr_sig="0x7dfff0db",
                               sectors=209716,
                               sysfspath="/sys/firmware/edd/int13_dev82/"),
        }

        edd_dict = edd.collect_edd_data(root=self.root("bad_sata_virt"))
        self.debug('edd_dict: %s', edd_dict)
        debugs = [
            ("edd: found device 0x%x at %s", 0x80,
             '/sys/firmware/edd/int13_dev80/'),
            ("edd: found device 0x%x at %s", 0x81,
             '/sys/firmware/edd/int13_dev81/'),
            ("edd: found device 0x%x at %s", 0x82,
             '/sys/firmware/edd/int13_dev82/'),
        ]
        self.check_logs(debugs=debugs)
        lib.assertVerboseEqual(fakeedd[0x80], edd_dict[0x80])
        lib.assertVerboseEqual(fakeedd[0x81], edd_dict[0x81])
        lib.assertVerboseEqual(fakeedd[0x82], edd_dict[0x82])
        lib.assertVerboseEqual(len(edd_dict), 3)
예제 #4
0
    def test_collect_edd_data_sata_usb(self):
        # test with sata sda, usb sdb
        self._edd_logger.debug("starting test %s", self._testMethodName)
        edd.testdata_log.debug("starting test %s", self._testMethodName)
        fakeedd = {
            0x80: FakeEddEntry(version="0x30", mbr_sig="0x00000000",
                               sectors=312581808, host_bus="PCI", type="SATA",
                               pci_dev="00:1f.2", channel=255, ata_device=1,
                               interface="SATA    \tdevice: 1",
                               sysfspath="/sys/firmware/edd/int13_dev80/"),
            0x81: FakeEddEntry(version="0x21", mbr_sig="0x96a20d28",
                               sectors=31293440, host_bus="PCI", type="USB",
                               pci_dev="ff:ff.255", channel=255,
                               usb_serial=0x30302e31,
                               interface="USB     \tserial_number: 30302e31",
                               sysfspath="/sys/firmware/edd/int13_dev81/"),
        }

        edd_dict = edd.collect_edd_data(root=self.root("sata_usb"))
        self.debug('edd_dict: %s', edd_dict)
        debugs = [
            ("edd: found device 0x%x at %s", 0x80,
             '/sys/firmware/edd/int13_dev80/'),
            ("edd: found device 0x%x at %s", 0x81,
             '/sys/firmware/edd/int13_dev81/'),
        ]
        lib.assertVerboseEqual(len(edd_dict), 2)
        lib.assertVerboseEqual(fakeedd[0x80], edd_dict[0x80])
        lib.assertVerboseEqual(fakeedd[0x81], edd_dict[0x81])
        self.check_logs(debugs=debugs)
예제 #5
0
    def test_bad_device_path(self):
        from blivet.devicelibs import edd
        EddTestFS(self, edd).sda_vda_no_pcidev()
        edd_dict = edd.collect_edd_data()

        analyzer = edd.EddMatcher(edd_dict[0x80])
        path = analyzer.devname_from_pci_dev()
        self.assertEqual(path, None)
예제 #6
0
   def test_edd_entry_str(self):
       from blivet.devicelibs import edd
       EddTestFS(self, edd).sda_vda()
       edd_dict = edd.collect_edd_data()
       expected_output = """\ttype: ATA, ata_device: 0
tchannel: 0, mbr_signature: 0x000ccb01
tpci_dev: 00:01.1, scsi_id: None
tscsi_lun: None, sectors: 2097152"""
       self.assertEqual(str(edd_dict[0x80]), expected_output)
예제 #7
0
 def test_collect_edd_data_absurd_virt(self):
     self._edd_logger.debug("starting test %s", self._testMethodName)
     edd.testdata_log.debug("starting test %s", self._testMethodName)
     # siiiigh - this is actually the data out of sysfs on a virt I have
     # created.  Apparently even qemu claims 3.0 sometimes and gives us
     # bad data.
     fakeedd = {
         0x80: FakeEddEntry(version="0x30", mbr_sig="0x86531966",
                            sectors=10485760, host_bus="PCI", type="SCSI",
                            pci_dev="00:07.0", channel=0, scsi_id=0,
                            scsi_lun=0, interface="SCSI    \tid: 0  lun: 0",
                            sysfspath="/sys/firmware/edd/int13_dev80/"),
         0x81: FakeEddEntry(version="0x30", mbr_sig="0x7dfff0db",
                            sectors=209716, host_bus="PCI", type="ATA",
                            pci_dev="00:01.1", channel=0,
                            interface="ATA     \tdevice: 1", ata_device=1,
                            sysfspath="/sys/firmware/edd/int13_dev81/"),
         0x82: FakeEddEntry(version="0x30", mbr_sig="0xe3bf124b",
                            sectors=419432,
                            sysfspath="/sys/firmware/edd/int13_dev82/"),
         0x83: FakeEddEntry(version="0x30", mbr_sig="0xfa0a111d",
                            sectors=629146,
                            sysfspath="/sys/firmware/edd/int13_dev83/"),
         0x84: FakeEddEntry(version="0x30", mbr_sig="0x63f1d7d8",
                            sectors=838862, host_bus="PCI", type="SCSI",
                            pci_dev="00:0b.0", channel=0, scsi_id=0,
                            scsi_lun=0, interface="SCSI    \tid: 0  lun: 0",
                            sysfspath="/sys/firmware/edd/int13_dev84/"),
         0x85: FakeEddEntry(version="0x30", mbr_sig="0xee331b19",
                            sectors=1258292,
                            sysfspath="/sys/firmware/edd/int13_dev85/"),
     }
     edd_dict = edd.collect_edd_data(root=self.root('absurd_virt'))
     self.debug('edd_dict: %s', edd_dict)
     lib.assertVerboseEqual(len(edd_dict), 6)
     lib.assertVerboseEqual(fakeedd[0x80], edd_dict[0x80])
     lib.assertVerboseEqual(fakeedd[0x81], edd_dict[0x81])
     lib.assertVerboseEqual(fakeedd[0x82], edd_dict[0x82])
     lib.assertVerboseEqual(fakeedd[0x83], edd_dict[0x83])
     lib.assertVerboseEqual(fakeedd[0x84], edd_dict[0x84])
     lib.assertVerboseEqual(fakeedd[0x85], edd_dict[0x85])
     debugs = [
         ("edd: found device 0x%x at %s", 0x80,
          '/sys/firmware/edd/int13_dev80/'),
         ("edd: found device 0x%x at %s", 0x81,
          '/sys/firmware/edd/int13_dev81/'),
         ("edd: found device 0x%x at %s", 0x82,
          '/sys/firmware/edd/int13_dev82/'),
         ("edd: found device 0x%x at %s", 0x83,
          '/sys/firmware/edd/int13_dev83/'),
         ("edd: found device 0x%x at %s", 0x84,
          '/sys/firmware/edd/int13_dev84/'),
         ("edd: found device 0x%x at %s", 0x85,
          '/sys/firmware/edd/int13_dev85/'),
     ]
     self.check_logs(debugs=debugs)
예제 #8
0
    def test_bad_host_bus(self):
        from blivet.devicelibs import edd
        EddTestFS(self, edd).sda_vda_no_host_bus()

        edd_dict = edd.collect_edd_data()

        # 0x80 entry is basted so fail without an exception
        analyzer = edd.EddMatcher(edd_dict[0x80])
        devname = analyzer.devname_from_pci_dev()
        self.assertEqual(devname, None)

        # but still succeed on 0x81
        analyzer = edd.EddMatcher(edd_dict[0x81])
        devname = analyzer.devname_from_pci_dev()
        self.assertEqual(devname, "vda")
예제 #9
0
    def test_collect_edd_data_mostly_fixed_virt(self):
        # test with sata sda, usb sdb
        self._edd_logger.debug("starting test %s", self._testMethodName)
        edd.testdata_log.debug("starting test %s", self._testMethodName)
        fakeedd = {
            0x80: FakeEddEntry(version="0x30", mbr_sig="0x86531966",
                               sectors=10485760, host_bus="PCI", type="SCSI",
                               pci_dev="00:07.0", channel=255, scsi_id=0xffff,
                               scsi_lun=281474976645120,
                               interface="SCSI    \tid: 65535  lun: 281474976645120",
                               sysfspath="/sys/firmware/edd/int13_dev80/"),
            0x81: FakeEddEntry(version="0x30", mbr_sig="0xe3bf124b",
                               sectors=419432, host_bus="PCI", type="SATA",
                               pci_dev="00:03.0", channel=255, ata_device=0,
                               interface="SATA    \tdevice: 0",
                               sysfspath="/sys/firmware/edd/int13_dev81/"),
            0x82: FakeEddEntry(version="0x30", mbr_sig="0x7dfff0db",
                               sectors=209716, host_bus="PCI", type="SATA",
                               pci_dev="00:0c.0", channel=255, ata_device=3,
                               interface="SATA    \tdevice: 3",
                               sysfspath="/sys/firmware/edd/int13_dev82/"),
            0x83: FakeEddEntry(version="0x30", mbr_sig="0x648873aa",
                               sectors=0,
                               sysfspath="/sys/firmware/edd/int13_dev83/"),
        }

        edd_dict = edd.collect_edd_data(root=self.root('mostly_fixed_virt'))
        self.debug('edd_dict: %s', edd_dict)
        debugs = [
            ("edd: found device 0x%x at %s", 0x80,
             '/sys/firmware/edd/int13_dev80/'),
            ("edd: found device 0x%x at %s", 0x81,
             '/sys/firmware/edd/int13_dev81/'),
            ("edd: found device 0x%x at %s", 0x82,
             '/sys/firmware/edd/int13_dev82/'),
            ("edd: found device 0x%x at %s", 0x83,
             '/sys/firmware/edd/int13_dev83/'),
        ]
        self.check_logs(debugs=debugs)
        lib.assertVerboseEqual(fakeedd[0x80], edd_dict[0x80])
        lib.assertVerboseEqual(fakeedd[0x81], edd_dict[0x81])
        lib.assertVerboseEqual(fakeedd[0x82], edd_dict[0x82])
        lib.assertVerboseEqual(fakeedd[0x83], edd_dict[0x83])
        lib.assertVerboseEqual(len(edd_dict), 4)
예제 #10
0
    def test_collect_edd_data_sata_usb(self):
        # test with sata sda, usb sdb
        self._edd_logger.debug("starting test %s", self._testMethodName)
        edd.testdata_log.debug("starting test %s", self._testMethodName)
        fakeedd = {
            0x80:
            FakeEddEntry(version="0x30",
                         mbr_sig="0x00000000",
                         sectors=312581808,
                         host_bus="PCI",
                         type="SATA",
                         pci_dev="00:1f.2",
                         channel=255,
                         ata_device=1,
                         interface="SATA    \tdevice: 1",
                         sysfspath="/sys/firmware/edd/int13_dev80/"),
            0x81:
            FakeEddEntry(version="0x21",
                         mbr_sig="0x96a20d28",
                         sectors=31293440,
                         host_bus="PCI",
                         type="USB",
                         pci_dev="ff:ff.255",
                         channel=255,
                         usb_serial=0x30302e31,
                         interface="USB     \tserial_number: 30302e31",
                         sysfspath="/sys/firmware/edd/int13_dev81/"),
        }

        edd_dict = edd.collect_edd_data(root=self.root("sata_usb"))
        self.edd_debug('edd_dict: %s', edd_dict)
        debugs = [
            ("edd: found device 0x%x at %s", 0x80,
             '/sys/firmware/edd/int13_dev80/'),
            ("edd: found device 0x%x at %s", 0x81,
             '/sys/firmware/edd/int13_dev81/'),
        ]
        lib.assertVerboseEqual(len(edd_dict), 2)
        lib.assertVerboseEqual(fakeedd[0x80], edd_dict[0x80])
        lib.assertVerboseEqual(fakeedd[0x81], edd_dict[0x81])
        self.check_logs(debugs=debugs)
예제 #11
0
    def test_collect_edd_data_bad_sata_virt(self):
        self._edd_logger.debug("starting test %s", self._testMethodName)
        edd.testdata_log.debug("starting test %s", self._testMethodName)
        # test with sata sda, usb sdb
        fakeedd = {
            0x80:
            FakeEddEntry(version="0x30",
                         mbr_sig="0x86531966",
                         sectors=10485760,
                         sysfspath="/sys/firmware/edd/int13_dev80/"),
            0x81:
            FakeEddEntry(version="0x30",
                         mbr_sig="0xe3bf124b",
                         sectors=419432,
                         sysfspath="/sys/firmware/edd/int13_dev81/"),
            0x82:
            FakeEddEntry(version="0x30",
                         mbr_sig="0x7dfff0db",
                         sectors=209716,
                         sysfspath="/sys/firmware/edd/int13_dev82/"),
        }

        edd_dict = edd.collect_edd_data(root=self.root("bad_sata_virt"))
        self.edd_debug('edd_dict: %s', edd_dict)
        debugs = [
            ("edd: found device 0x%x at %s", 0x80,
             '/sys/firmware/edd/int13_dev80/'),
            ("edd: found device 0x%x at %s", 0x81,
             '/sys/firmware/edd/int13_dev81/'),
            ("edd: found device 0x%x at %s", 0x82,
             '/sys/firmware/edd/int13_dev82/'),
        ]
        self.check_logs(debugs=debugs)
        lib.assertVerboseEqual(fakeedd[0x80], edd_dict[0x80])
        lib.assertVerboseEqual(fakeedd[0x81], edd_dict[0x81])
        lib.assertVerboseEqual(fakeedd[0x82], edd_dict[0x82])
        lib.assertVerboseEqual(len(edd_dict), 3)
예제 #12
0
    def test_collect_edd_data_mostly_fixed_virt(self):
        # test with sata sda, usb sdb
        self._edd_logger.debug("starting test %s", self._testMethodName)
        edd.testdata_log.debug("starting test %s", self._testMethodName)
        fakeedd = {
            0x80:
            FakeEddEntry(version="0x30",
                         mbr_sig="0x86531966",
                         sectors=10485760,
                         host_bus="PCI",
                         type="SCSI",
                         pci_dev="00:07.0",
                         channel=255,
                         scsi_id=0xffff,
                         scsi_lun=281474976645120,
                         interface="SCSI    \tid: 65535  lun: 281474976645120",
                         sysfspath="/sys/firmware/edd/int13_dev80/"),
            0x81:
            FakeEddEntry(version="0x30",
                         mbr_sig="0xe3bf124b",
                         sectors=419432,
                         host_bus="PCI",
                         type="SATA",
                         pci_dev="00:03.0",
                         channel=255,
                         ata_device=0,
                         interface="SATA    \tdevice: 0",
                         sysfspath="/sys/firmware/edd/int13_dev81/"),
            0x82:
            FakeEddEntry(version="0x30",
                         mbr_sig="0x7dfff0db",
                         sectors=209716,
                         host_bus="PCI",
                         type="SATA",
                         pci_dev="00:0c.0",
                         channel=255,
                         ata_device=3,
                         interface="SATA    \tdevice: 3",
                         sysfspath="/sys/firmware/edd/int13_dev82/"),
            0x83:
            FakeEddEntry(version="0x30",
                         mbr_sig="0x648873aa",
                         sectors=0,
                         sysfspath="/sys/firmware/edd/int13_dev83/"),
        }

        edd_dict = edd.collect_edd_data(root=self.root('mostly_fixed_virt'))
        self.edd_debug('edd_dict: %s', edd_dict)
        debugs = [
            ("edd: found device 0x%x at %s", 0x80,
             '/sys/firmware/edd/int13_dev80/'),
            ("edd: found device 0x%x at %s", 0x81,
             '/sys/firmware/edd/int13_dev81/'),
            ("edd: found device 0x%x at %s", 0x82,
             '/sys/firmware/edd/int13_dev82/'),
            ("edd: found device 0x%x at %s", 0x83,
             '/sys/firmware/edd/int13_dev83/'),
        ]
        self.check_logs(debugs=debugs)
        lib.assertVerboseEqual(fakeedd[0x80], edd_dict[0x80])
        lib.assertVerboseEqual(fakeedd[0x81], edd_dict[0x81])
        lib.assertVerboseEqual(fakeedd[0x82], edd_dict[0x82])
        lib.assertVerboseEqual(fakeedd[0x83], edd_dict[0x83])
        lib.assertVerboseEqual(len(edd_dict), 4)
예제 #13
0
 def test_collect_edd_data_absurd_virt(self):
     self._edd_logger.debug("starting test %s", self._testMethodName)
     edd.testdata_log.debug("starting test %s", self._testMethodName)
     # siiiigh - this is actually the data out of sysfs on a virt I have
     # created.  Apparently even qemu claims 3.0 sometimes and gives us
     # bad data.
     fakeedd = {
         0x80:
         FakeEddEntry(version="0x30",
                      mbr_sig="0x86531966",
                      sectors=10485760,
                      host_bus="PCI",
                      type="SCSI",
                      pci_dev="00:07.0",
                      channel=0,
                      scsi_id=0,
                      scsi_lun=0,
                      interface="SCSI    \tid: 0  lun: 0",
                      sysfspath="/sys/firmware/edd/int13_dev80/"),
         0x81:
         FakeEddEntry(version="0x30",
                      mbr_sig="0x7dfff0db",
                      sectors=209716,
                      host_bus="PCI",
                      type="ATA",
                      pci_dev="00:01.1",
                      channel=0,
                      interface="ATA     \tdevice: 1",
                      ata_device=1,
                      sysfspath="/sys/firmware/edd/int13_dev81/"),
         0x82:
         FakeEddEntry(version="0x30",
                      mbr_sig="0xe3bf124b",
                      sectors=419432,
                      sysfspath="/sys/firmware/edd/int13_dev82/"),
         0x83:
         FakeEddEntry(version="0x30",
                      mbr_sig="0xfa0a111d",
                      sectors=629146,
                      sysfspath="/sys/firmware/edd/int13_dev83/"),
         0x84:
         FakeEddEntry(version="0x30",
                      mbr_sig="0x63f1d7d8",
                      sectors=838862,
                      host_bus="PCI",
                      type="SCSI",
                      pci_dev="00:0b.0",
                      channel=0,
                      scsi_id=0,
                      scsi_lun=0,
                      interface="SCSI    \tid: 0  lun: 0",
                      sysfspath="/sys/firmware/edd/int13_dev84/"),
         0x85:
         FakeEddEntry(version="0x30",
                      mbr_sig="0xee331b19",
                      sectors=1258292,
                      sysfspath="/sys/firmware/edd/int13_dev85/"),
     }
     edd_dict = edd.collect_edd_data(root=self.root('absurd_virt'))
     self.edd_debug('edd_dict: %s', edd_dict)
     lib.assertVerboseEqual(len(edd_dict), 6)
     lib.assertVerboseEqual(fakeedd[0x80], edd_dict[0x80])
     lib.assertVerboseEqual(fakeedd[0x81], edd_dict[0x81])
     lib.assertVerboseEqual(fakeedd[0x82], edd_dict[0x82])
     lib.assertVerboseEqual(fakeedd[0x83], edd_dict[0x83])
     lib.assertVerboseEqual(fakeedd[0x84], edd_dict[0x84])
     lib.assertVerboseEqual(fakeedd[0x85], edd_dict[0x85])
     debugs = [
         ("edd: found device 0x%x at %s", 0x80,
          '/sys/firmware/edd/int13_dev80/'),
         ("edd: found device 0x%x at %s", 0x81,
          '/sys/firmware/edd/int13_dev81/'),
         ("edd: found device 0x%x at %s", 0x82,
          '/sys/firmware/edd/int13_dev82/'),
         ("edd: found device 0x%x at %s", 0x83,
          '/sys/firmware/edd/int13_dev83/'),
         ("edd: found device 0x%x at %s", 0x84,
          '/sys/firmware/edd/int13_dev84/'),
         ("edd: found device 0x%x at %s", 0x85,
          '/sys/firmware/edd/int13_dev85/'),
     ]
     self.check_logs(debugs=debugs)