Opened 11 years ago
Last modified 5 years ago
#11857 new defect
medium type "dvddrive" cannot be used via a readonly iscsi target
| Reported by: | rshaw | Owned by: | |
|---|---|---|---|
| Component: | virtual disk | Version: | VirtualBox 4.2.12 |
| Keywords: | iscsi readonly dvddrive dvd | Cc: | |
| Guest type: | all | Host type: | Linux |
Description
ISO mediums exposed in a dvddrive cannot be used over iSCSI when the target is readonly.
According to documentation, CD/DVD images are created read-only, but this doesn't seem to be the case, at least with iSCSI. I need access to a series of readonly iscsi targets that are exposing ISOs, but this does not seem possible unless I start snapshotting guests after the medium is added, and before it is turned on.
A sample target I am trying to connect to
ryan@TehDualLinux:~$ sudo tgtadm --lld iscsi --mode target --op show
Target 2: iqn.2001-04.com.TehDualLinux-2260f94a-90f3-4147-9e32-39c773f7095b
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00020000
SCSI SN: beaf20
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00020001
SCSI SN: beaf21
Size: 1013 MB, Block size: 512
Online: Yes
Removable media: No
Readonly: Yes
Backing store type: rdwr
Backing store path: /usr/local/storage/linuxmint-14.1-mate-dvd32bit.iso
Backing store flags:
Account information:
ACL information:
ALL
Adding the above target to VirtualBox
VBoxManage storageattach "NewPasswordWindowsReadOnly2" --storagectl "MyController" --port 1 --device 0 --type dvddrive --medium iscsi --server localhost --target "iqn.2001-04.com.TehDualLinux-2260f94a-90f3-4147-9e32-39c773f7095b" --lun 1 --tport 3260
It was added successfully.
vboxmanage list hdds ... UUID: 2d4790e0-678b-4fc0-b529-32aebfec6f97 Parent UUID: base Format: iSCSI Location: localhost|iqn.2001-04.com.TehDualLinux-2260f94a-90f3-4147-9e32-39c773f7095b|1 State: created Type: normal Usage: NewPasswordWindowsReadOnly2 (UUID: e86ffe75-2412-4aa6-9b36-3a0c0f3e4780) ...
After we try and turn the machine on, it fails with:
Failed to open a session for the virtual machine NewPasswordWindowsReadOnly2. VD: error VERR_VD_IMAGE_READ_ONLY opening image file 'localhost|iqn.2001-04.com.TehDualLinux-2260f94a-90f3-4147-9e32-39c773f7095b|1' (VERR_VD_IMAGE_READ_ONLY). Failed to open image 'localhost|iqn.2001-04.com.TehDualLinux-2260f94a-90f3-4147-9e32-39c773f7095b|1' in read-write mode rc=VERR_VD_IMAGE_READ_ONLY (VERR_VD_IMAGE_READ_ONLY). Failed to attach driver below us! Image is read-only. (VERR_VD_IMAGE_READ_ONLY). AHCI: Failed to attach drive to Port1 (VERR_VD_IMAGE_READ_ONLY).
Steps to replicate:
- Make an iSCSI target with any iSCSI software and make it readonly
- Add the target to your guest via vboxmanage stoargeattach and do not take snapshots
- Turn on the guest.
Summary:
- If you remove the readonly flag on the iscsi target everything works perfectly (even through VirutalBox does not need write on this medium)
- If you take a snapshot (thus a differencing medium is created), everything works perfectly
- If you add the DVD as multiattach instead of "normal", it creates a differencing medium, and everything works perfectly.
- If you add the medium normally, even though VirtualBox's documentation claims it is readonly, it tries to access the medium as read/write.


I had the same VERR_VD_IMAGE_READ_ONLY with the following code: "VBoxManage.exe: error: Failed to open image FILE for writing due to wrong permissions (VERR_VD_IMAGE_READ_ONLY). VBoxManage.exe: error: AHCI: Failed to attach drive to Port0 (VERR_VD_IMAGE_READ_ONLY) VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole"
I am using Windows as the host computer so the modes/attributes came out to -arh--
Took the file off of readonly (changed modes/attributes to -a-h--) seems to boot up.
Thank you for your time.
Squ!d