[lxc-devel] [lxd/master] lxd/instances: Fix virtiofsd for config drive
stgraber on Github
lxc-bot at linuxcontainers.org
Fri Oct 30 01:55:19 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201029/ad343e36/attachment.bin>
-------------- next part --------------
From db04ac666b7ecef2ef0a2d8b3bccded8004f4fbd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 29 Oct 2020 21:47:57 -0400
Subject: [PATCH] lxd/instances: Fix virtiofsd for config drive
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/instance/drivers/driver_qemu.go | 46 +++++++++++++++--------------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index 1de732a6d2..8b59e1ea5b 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -884,35 +884,37 @@ func (vm *qemu) Start(stateful bool) error {
}
}
- // Start the virtiofsd process in non-daemon mode.
- if cmd != "" {
- proc, err := subprocess.NewProcess("/usr/lib/qemu/virtiofsd", []string{fmt.Sprintf("--socket-path=%s", sockPath), "-o", fmt.Sprintf("source=%s", filepath.Join(vm.Path(), "config"))}, "", "")
- if err != nil {
- return err
- }
+ if cmd == "" {
+ return fmt.Errorf("Required binary 'virtiofsd' couldn't be found")
+ }
- err = proc.Start()
- if err != nil {
- return err
- }
+ // Start the virtiofsd process in non-daemon mode.
+ proc, err := subprocess.NewProcess(cmd, []string{fmt.Sprintf("--socket-path=%s", sockPath), "-o", fmt.Sprintf("source=%s", filepath.Join(vm.Path(), "config"))}, "", "")
+ if err != nil {
+ return err
+ }
- revert.Add(func() { proc.Stop() })
+ err = proc.Start()
+ if err != nil {
+ return err
+ }
- pidPath := filepath.Join(vm.LogPath(), "virtiofsd.pid")
+ revert.Add(func() { proc.Stop() })
- err = proc.Save(pidPath)
- if err != nil {
- return err
- }
+ pidPath := filepath.Join(vm.LogPath(), "virtiofsd.pid")
- // Wait for socket file to exist
- for i := 0; i < 10; i++ {
- if shared.PathExists(sockPath) {
- break
- }
+ err = proc.Save(pidPath)
+ if err != nil {
+ return err
+ }
- time.Sleep(50 * time.Millisecond)
+ // Wait for socket file to exist
+ for i := 0; i < 10; i++ {
+ if shared.PathExists(sockPath) {
+ break
}
+
+ time.Sleep(50 * time.Millisecond)
}
// Setup background process.
More information about the lxc-devel
mailing list