Skip to content

Commit

Permalink
ci: add VENDOR field
Browse files Browse the repository at this point in the history
    - we need this field to create the same WWN but different VENDOR
      device

Signed-off-by: Vicente Cheng <[email protected]>
  • Loading branch information
Vicente-Cheng committed Jul 3, 2024
1 parent 08ab2c7 commit e8a08dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions pkg/utils/virt.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Disk struct {
Source Source `xml:"source"`
Target Target `xml:"target"`
WWN string `xml:"wwn"`
VENDOR string `xml:"vendor"`
}

type Driver struct {
Expand Down
9 changes: 3 additions & 6 deletions tests/integration/test_1_disk_hotplug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func (s *HotPlugTestSuite) Test_2_HotPlugAddDisk() {
_, _, err := doCommand(cmd)
require.Equal(s.T(), err, nil, "Running command `virsh attach-device` should not get error")

// wait for controller handling
time.Sleep(5 * time.Second)
// wait for controller handling, the device will be changed need more time to wait for the controller handling
time.Sleep(30 * time.Second)

// check disk status
require.NotEqual(s.T(), s.targetDiskName, "", "target disk name should not be empty before we start hotplug (add) test")
Expand All @@ -150,7 +150,6 @@ func (s *HotPlugTestSuite) Test_2_HotPlugAddDisk() {
require.Equal(s.T(), err, nil, "Get Blockdevices should not get error")

require.Equal(s.T(), curBlockdevice.Status.State, diskv1.BlockDeviceActive, "Disk status should be inactive after we add disk")
s.curBusPath = curBlockdevice.Status.DeviceStatus.Details.BusPath
}

func (s *HotPlugTestSuite) Test_3_AddDuplicatedWWNDsik() {
Expand All @@ -168,6 +167,7 @@ func (s *HotPlugTestSuite) Test_3_AddDuplicatedWWNDsik() {
require.Equal(s.T(), err, nil, "Read xml file should not get error")
disk.Source.File = duplicatedDeviceRaw
disk.Target.Dev = "sdb"
disk.VENDOR = "HARV"
err = utils.XMLWriter(duplicatedDeviceXML, disk)
require.Equal(s.T(), err, nil, "Write xml file should not get error")

Expand All @@ -184,9 +184,6 @@ func (s *HotPlugTestSuite) Test_3_AddDuplicatedWWNDsik() {
blockdeviceList, err := bdi.List(context.TODO(), v1.ListOptions{})
require.Equal(s.T(), err, nil, "Get BlockdevicesList should not get error")
require.Equal(s.T(), 1, len(blockdeviceList.Items), "We should have one disks because duplicated wwn should not added")
curBlockdevice, err := bdi.Get(context.TODO(), s.targetDiskName, v1.GetOptions{})
require.Equal(s.T(), err, nil, "Get Blockdevices should not get error")
require.Equal(s.T(), s.curBusPath, curBlockdevice.Status.DeviceStatus.Details.BusPath, "Disk path should not replace by duplicated wwn disk")

// cleanup this disk
cmd = fmt.Sprintf("virsh detach-disk %s %s --live", hotplugTargetNodeName, "sdb")
Expand Down

0 comments on commit e8a08dc

Please sign in to comment.