29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/ssh.rb', line 29
def self.setup_virtio_filesystem(name)
VM.new(name) do |vm|
Net::SSH.start(vm.ip, 'dabo', port: vm.ssh_port, keys: [File.expand_path('~/.ssh/id_ed25519')]) do |ssh|
Susi::debug "Setting up virtio filesystem..."
output = ssh.exec!("echo 'susi_virtio_share /mnt/susi 9p trans=virtio,version=9p2000.L,rw 0 0' | sudo tee -a /etc/fstab")
Susi::debug "Adding virtio share to /etc/fstab: #{output}"
output = ssh.exec!("sudo mkdir -p /mnt/susi")
Susi::debug "Creating mount point: #{output}"
output = ssh.exec!("sudo systemctl daemon-reload")
Susi::debug "Reloading systemd: #{output}"
output = ssh.exec!("sudo mount -a")
Susi::debug "Mounting all filesystems: #{output}"
output = ssh.exec!("mount | grep susi_virtio_share")
if output.empty?
Susi::debug "Warning: virtio share mount not found. Checking dmesg for errors..."
dmesg_output = ssh.exec!("dmesg | tail -n 20")
Susi::debug "Recent dmesg output: #{dmesg_output}"
else
Susi::debug "Virtio share mounted successfully: #{output}"
end
Susi::debug "Virtio filesystem setup complete."
end
end
end
|