Bug 747290 - libguestfs ignores <readonly/> in libvirt XML
libguestfs ignores <readonly/> in libvirt XML
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Richard W.M. Jones
Depends On:
  Show dependency treegraph
Reported: 2011-10-19 07:34 EDT by Richard W.M. Jones
Modified: 2011-10-27 04:14 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-10-26 14:35:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2011-10-19 07:34:05 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
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):


How reproducible:

Comment 1 Daniel Berrange 2011-10-19 07:43:52 EDT
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.
Comment 2 Richard W.M. Jones 2011-10-26 14:35:29 EDT
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.

Comment 3 Daniel Berrange 2011-10-27 04:08:58 EDT
@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
Comment 4 Richard W.M. Jones 2011-10-27 04:14:56 EDT
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.