fix(chv): 79-chv-cell.network 改回 root:root 644(构建 #5 驱动实证)

virt-customize --copy-in 保留构建宿主 uid/mode,79 文件在客机
落盘成 chv:chv 640,networkd 不认它、改配 80-container-ve.network、
刷掉 10.200.0.1,cell _iface_has_ip 复核失败、codex --help rc=1。
构建时显式 chown root:root + chmod 644 并断言属主与权限;
回归测试 BuildWiringTest.test_build_sh_fixes_cell_network_file_owner。
This commit is contained in:
host committed 2026-11-08 09:45:00 +00:00
1 parent 1cbaf7c1d5
commit 42adbd047f
2 files changed
+27 -1

No files matched your search

+20
View File
@@ -431,6 +431,26 @@ class BuildWiringTest(unittest.TestCase):
self.assertLess(cfg_line.index("chv-data-mount >>"),
cfg_line.index("chv-sync boot"))
def test_build_sh_fixes_cell_network_file_owner(self):
# 构建 #5 教训:virt-customize --copy-in 保留宿主 uid/mode,
# 79 文件在客机落盘成 chv:chv 640,networkd 不认它、改配
# 80-container-ve.network、刷掉 10.200.0.1,cell 复核失败。
# build.sh 须显式改回 root:root 644 并断言属主与权限。
with open(_repo("chv-guest", "build.sh")) as fh:
text = fh.read()
self.assertIn(
"chown root:root /etc/systemd/network/79-chv-cell.network",
text)
self.assertIn(
"chmod 644 /etc/systemd/network/79-chv-cell.network",
text)
self.assertIn(
'stat -c %U /etc/systemd/network/79-chv-cell.network',
text)
self.assertIn(
'stat -c %a /etc/systemd/network/79-chv-cell.network',
text)
def test_lockfile_and_buildinfo_declare_services(self):
spec = importlib.util.spec_from_file_location(
"stage2_buildinfo",