Description of problem:
A fairly typical configuration is a guest which has a
read-only CD-ROM ISO file attached.
However if you open this guest with
guestfish --rw -d GuestName
or equivalently with guestfs_add_domain (without the
readonly flag) then libguestfs tries to open the CD-ROM
file for writes.
It's not completely clear what we should be doing. Possibly
one of:
(a) open the disk read-only, even if the readonly flag is not set
(b) error if the readonly flag is not set and a disk is <readonly/>
(c) (b) + an extra flag to select fallback mode (a)
Version-Release number of selected component (if applicable):
1.13.21
How reproducible:
100%

I don't think there's any perfect answer here.
You have a guest XML with 2 (or more) disks
1. Primary disk, read-write
2. Secondary disk, marked read-only
Then, if you run guestfish --rw, there are two possible desirable outcomes
a. Both disks opened read-write.
b. Primary disk opened read-write, secondary disk read-only
I think 'b' makes sense as the default, since that is honouring the guest definition, however, I could see a very occasional need to do 'a'. eg if the read-only disk, was in fact some shared HD that the guests normally share read-only, but you want to make some changes to now.

Fixed upstream in libguestfs 1.13.26.
** Dan **:
A useful feature for the libvirt test:/// XML would be the
ability to start off a test domain in a state other than
"running", ie. shut off.
At the moment it's hard to create automated tests for this
feature because libguestfs prevents you from trying to open
a domain for write when it thinks it is running.
See:
http://git.annexia.org/?p=libguestfs.git;a=blob;f=regressions/test-add-domain.sh;hb=HEAD

@rjones: while you can't make the test driver open with an existing shutoff domain, you can make it open with no existing domains, and then just use virDomainDefineXML to create yourself a shutoff guest. Use test:///path/to/node.xml - see examples/xml/test/testnode.xml for an example of syntax

Sure, I realized that (or conversely: start with a running
domain and call virDomainShutdown on it).
However if you look at the test (comment 2) you'll see I'm
not in a position to make libvirt API calls. It would be nice
if it was directly available in the XML.

Note

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