Skip to content

Commit

Permalink
Merge pull request #3460 from brauner/2017-06-28/check_whether_disk_d…
Browse files Browse the repository at this point in the history
…evice_exists_in_container_devices

container_lxc: check whether disk device exists
  • Loading branch information
stgraber authored Jun 27, 2017
2 parents ceaabb6 + 1ff8664 commit ccf78e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lxd/container_lxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6299,6 +6299,11 @@ func (c *containerLXC) removeDiskDevice(name string, m types.Device) error {
devName := fmt.Sprintf("disk.%s", strings.Replace(tgtPath, "/", "-", -1))
devPath := filepath.Join(c.DevicesPath(), devName)

// The dsk device doesn't exist and cannot be mounted.
if !shared.PathExists(devPath) {
return nil
}

// Remove the bind-mount from the container
if c.FileExists(tgtPath) == nil {
err := c.removeMount(m["path"])
Expand Down

0 comments on commit ccf78e1

Please sign in to comment.