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: {}
Ideally, a VM should be able to have multiple hostDisk disk images in the same directory as long as their filenames differ.
HostDisks is limited to kubevirt, moving it to virt to see how their decision on its fix.
This is a bug in kubevirt. It tries to mount similar host paths at the same location inside the pod. Needs a (simple) bugfix.
https://github.com/kubevirt/kubevirt/pull/2516 Let me know if you decide that this needs a backport.
Let me know if we need a backport to a specific version.
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
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