mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-21 16:39:30 +00:00
506069061b
The name of the volume of a node, and the bus of a file-backed disk, could come from a match made by a routine on the call path. A riscv64 node breaks on it: a leaked value that is neither scsi nor virtio gives the node an hd* volume, and the riscv64 virt machine has no IDE controller for that disk. createstorage and build_diskstruct in xCAT-server/lib/xcat/plugins/kvm.pm read the model of the disk out of the vmstorage value with s/=(.*)//, then read $1. The substitution is allowed to fail, because most vmstorage values state no model, and a failed match leaves $1 as the last successful capture. dohyp gives every node the storage model scsi before mkvm runs, and a captured value takes priority over it, so a leaked value can only replace the default that keeps a riscv64 node on sd*. The leak follows the call path, not the history of the process. Perl restores $1 when the block that set it ends, so a match made in a routine that has returned cannot reach createstorage; only a match still live in an enclosing block can, and a later successful match without a group empties $1 again. A long-running xcatd is not what makes this happen, and looking for one is a wrong turn. Both routines now read $1 only when their own substitution matches. A vmstorage value that states a model, and vmstoragemodel, name the volume as before. The default itself moves into default_storagemodel, which dohyp calls, so a test can hold it. It sat inline with a comment, and changing it to ide left every assertion passing. kvm_createstorage_model.t runs each node twice, once with a capture left live in the calling block, because a case that leaves $1 empty passes against the defect. Five of its eleven assertions fail without this change, and a sixth fails if the default changes. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>