Red Hat Bugzilla – Bug 747290
libguestfs ignores <readonly/> in libvirt XML
Last modified: 2011-10-27 04:14:56 EDT
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
(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):
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.
@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.