Bug 1726766 - A single VM cannot have multiple disks in the same directory when using hostdisk
Summary: A single VM cannot have multiple disks in the same directory when using hostdisk
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Container Native Virtualization (CNV)
Classification: Red Hat
Component: Virtualization
Version: 1.4
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 2.1.0
Assignee: Fabian Deutsch
QA Contact: Denys Shchedrivyi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-03 17:01 UTC by joherr
Modified: 2019-10-31 14:09 UTC (History)
7 users (show)

Fixed In Version: hco-bundle-registry-container-v2.1.0-34
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
OCP 3.11 and CNV 1.4 1 LB, 3 masters, 3 workers Local storage on workers /dev/sdb1 mounted under /srv A directory created to hold VM disk images (/srv/vms)
Last Closed: 2019-10-31 14:08:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2019:3282 0 None None None 2019-10-31 14:09:01 UTC

Description joherr 2019-07-03 17:01:45 UTC
Description of problem:
Errors are reported when trying to use two hostDisk volumes on a VM that point to the same directory. The VM does not start.

The events from the VMI are:
  Warning  FailedCreate  2m               virtualmachine-controller  Error creating pod: Pod "virt-launcher-vm-hostdisk-5-bktxl" is invalid: [spec.containers[0].volumeMounts[4].mountPath: Invalid value: "/srv/vms": must be unique, spec.containers[0].volumeMounts[5].mountPath: Invalid value: "/srv/vms": must be unique]

Images from multiple VMs can exist in the same local directory and the error is not reported and the VMs start. But a single VM cannot put multiple images into the same directory.

I tried adding the shared option, set to both true and false, to the hostDisk definitions and the issue remained.


Version-Release number of selected component (if applicable):


How reproducible:
always

Steps to Reproduce:
1. create a directory to hold virtual machine disk images
2. create a virtualMachine that uses hostDisk for its disks. each hostDisk points to a seperate image file in the same directory
3.

Actual results:
VM will not start

Expected results:
disk images are created in the shared directory and the VM starts.

Additional info:
The following is the VM definition.


apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
  creationTimestamp: 2019-07-03T15:35:22Z
  generation: 1
  labels:
    kubevirt.io/vm: vm-hostdisk-5
  name: vm-hostdisk-5
  namespace: host-disk-test
  resourceVersion: "3190108"
  selfLink: /apis/kubevirt.io/v1alpha3/namespaces/host-disk-test/virtualmachines/vm-hostdisk-5
  uid: 2beba160-9da8-11e9-88af-120000002442
spec:
  running: false
  template:
    metadata:
      creationTimestamp: null
      labels:
        kubevirt.io/vm: vm-hostdisk-5
    spec:
      domain:
        cpu:
          cores: 2
        devices:
          disks:
          - bootOrder: 2
            disk:
              bus: virtio
            name: os-disk
          - disk:
              bus: virtio
            name: data1-disk
          - disk:
              bus: virtio
            name: data2-disk
          interfaces:
          - bootOrder: 1
            bridge: {}
            macAddress: "02:12:00:12:12:14"
            name: multus-br
        machine:
          type: ""
        resources:
          requests:
            cpu: "2"
            memory: 8Gi
      networks:
      - multus:
          networkName: multus-br
        name: multus-br
      terminationGracePeriodSeconds: 0
      volumes:
      - hostDisk:
          capacity: 100Gi
          path: /srv/vms/vm-hostdisk-5-os.img
          shared: true
          type: DiskOrCreate
        name: os-disk
      - hostDisk:
          capacity: 10Gi
          path: /srv/vms/vm-hostdisk-5-data1.img
          shared: true
          type: DiskOrCreate
        name: data1-disk
      - hostDisk:
          capacity: 10Gi
          path: /srv/vms/vm-hostdisk-5-data2.img
          shared: true
          type: DiskOrCreate
        name: data2-disk
status: {}

Comment 1 joherr 2019-07-03 17:09:28 UTC
Ideally, a VM should be able to have multiple hostDisk disk images in the same directory as long as their filenames differ.

Comment 2 Ying Cui 2019-07-16 12:29:13 UTC
HostDisks is limited to kubevirt, moving it to virt to see how their decision on its fix.

Comment 5 Roman Mohr 2019-07-19 08:44:28 UTC
This is a bug in kubevirt. It tries to mount similar host paths at the same location inside the pod. Needs a (simple) bugfix.

Comment 6 Roman Mohr 2019-07-22 10:18:33 UTC
https://github.com/kubevirt/kubevirt/pull/2516

Let me know if you decide that this needs a backport.

Comment 7 Roman Mohr 2019-07-31 08:40:22 UTC
Let me know if we need a backport to a specific version.

Comment 10 Denys Shchedrivyi 2019-09-23 21:41:20 UTC
Verified on hco-bundle-registry:v2.1.0-62, bug fixed


$ oc get vmi
NAME          AGE       PHASE     IP            NODENAME
vm-hostdisk   84s       Running   10.130.0.72   host-172-16-0-34


$ oc describe vmi
Name:         vm-hostdisk
.
Spec:
.
  Volumes:
    Host Disk:
      Capacity:  1Gi
      Path:      /srv/vms/hostdisk-1.img
      Shared:    true
      Type:      DiskOrCreate
    Name:        disk1
    Host Disk:
      Capacity:  1Gi
      Path:      /srv/vms/hostdisk-2.img
      Shared:    true
      Type:      DiskOrCreate
    Name:        disk2
    Host Disk:
      Capacity:  1Gi
      Path:      /srv/vms/hostdisk-3.img
      Shared:    true
      Type:      DiskOrCreate
    Name:        disk3


### files on the node:
[core@host-172-16-0-34 ~]$ ls -la /srv/vms/
.
-rw-r--r--. 1  107  107 1073741824 Sep 23 21:32 hostdisk-1.img
-rw-r--r--. 1  107  107 1073741824 Sep 23 21:32 hostdisk-2.img
-rw-r--r--. 1  107  107 1073741824 Sep 23 21:33 hostdisk-3.img

Comment 12 errata-xmlrpc 2019-10-31 14:08:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2019:3282


Note You need to log in before you can comment on or make changes to this bug.