Huay-Yong Wang
2008-Sep-15 21:02 UTC
Libvirt APIs for relative paths [PSARC/2008/577 FastTrack timeout 09/22/2008]
<resending to psarc-ext> I am sponsoring this project for Ryan Scott. The timer for this fasttrack is set to expire 9/22/08. libvirt Relative Paths ===================== 1. Background A domU under xVM can be effectively described by an XML file describing the machine, and a disk image containing the root disk. Libvirt and virsh(1M) provide (among other services) printing the XML description of the domU and defining a new domU based on that API. These descriptions currently provide the full path to the root disk. While this works well with a single domU, the problem comes when trying to copy a domU to a different path on a machine or to a separate machine. The path to the root disk often must change. Currently, this requires manually editing the XML description. 2. Relative Paths This RFE will introduce two libvirt APIs to allow relative paths in the XML description, as well as a base path for the relative paths. 3. Library Interfaces char *virDomainGetRelativeXMLDesc(virDomainPtr domain, int flags, const char *relPath); Similar to virDomainGetXMLDesc(), except with a new relPath argument. All disk descriptions in the XML will be relative to this path. virDomainPtr virDomainDefineRelativeXML(virConnectPtr conn, const char *xml, const char *relPath); Similar to virDomainDefineRelativeXML(), but the relPath argument is new. When creating a domain, xml may contain relative paths, which will be defined relative to relPath. 4. virsh(1M) Command Line Changes Both ''virsh dumpxml'' and ''virsh define'' will grow --relative-path arguments: # virsh dumpxml --relative-path /export/guests >file.xml # virsh define file.xml --relative-path /expor/guests Example usage: # virsh dumpxml solaris-pv-0 [snip] <disk type=''file'' device=''disk''> <driver name=''file''/> <source file=''/export/guests/disks/solaris-pv-0.img''/> <target dev=''0''/> </disk> [snip] # virsh dumpxml solaris-pv-0 --relative-path /export/guests/ [snip] <disk type=''file'' device=''disk''> <driver name=''file''/> <source file=''./disks/solaris-pv-0.img''/> <target dev=''0''/> </disk> [snip] # virsh define /export/guests/xml/solaris-pv-0.xml.rel --relative-path /export/guests Domain solaris-pv-0 defined from /export/guests/xml/solaris-pv-0.xml.rel # virsh dumpxml solaris-pv-0 [snip] <disk type=''file'' device=''disk''> <driver name=''file''/> <source file=''/export/guests/disks/solaris-pv-0.img''/> <target dev=''0''/> </disk> [snip] Diffs to virsh(1M) will be deposited in the case directory. 5. Interface Stability ------------------------------------------------------------------------- | Interface | Stability | Comments | +-------------------------------+---------------+-----------------------+ | virDomainGetRelativeXMLDesc | Committed | | | virDomainDefineRelativeXML | Committed | | | virsh(1M) --relative-path | Committed | | | options | | | +-------------------------------+---------------+-----------------------+ 6. Manual pages Diffs of new virsh.1m proposed. *** virsh.1m.orig Tue Sep 9 13:28:10 2008 --- virsh.1m.new Tue Sep 9 13:52:29 2008 *************** *** 175,184 **** Directly editing XML configuration is not recommended. ! define file Define (but do not start) a domain from the specified ! XML file. destroy domain --- 175,186 ---- Directly editing XML configuration is not recommended. ! define file [--relative-path <path>] Define (but do not start) a domain from the specified ! XML file. If the disk paths in the XML contain relative ! paths, the domain will be created with those paths relative ! to <path>, if provided. destroy domain *************** *** 236,247 **** file specified by file for analysis. ! dumpxml domain Output the configuration of the given domain in XML for- mat. Captured in a file, this data can be used as the argument to a subsequent create subcommand. list [domain...] --- 238,252 ---- file specified by file for analysis. ! dumpxml domain [--relative-path <path>] Output the configuration of the given domain in XML for- mat. Captured in a file, this data can be used as the argument to a subsequent create subcommand. + By default, all paths in the XML will be absolute. Adding + the --relative-path option will make all disk paths relative + to <path>. list [domain...] 6. Resources and Schedule 6.4. Steering Committee requested information 6.4.1. Consolidation C-team Name: ON 6.5. ARC review type: FastTrack 6.6. ARC Exposure: open
Rich Teer
2008-Sep-15 21:10 UTC
Re: Libvirt APIs for relative paths [PSARC/2008/577 FastTrack timeout 09/22/2008]
On Mon, 15 Sep 2008, Huay-Yong Wang wrote:> 3. Library Interfaces > > char *virDomainGetRelativeXMLDesc(virDomainPtr domain, int flags, > const char *relPath); > > Similar to virDomainGetXMLDesc(), except with a new relPath argument. All > disk descriptions in the XML will be relative to this path. > > virDomainPtr virDomainDefineRelativeXML(virConnectPtr conn, const char *xml, > const char *relPath);A great idea, but can we put a stop to function names with mixed case identifiers, please? Let''s stick with all lower case with underscores between "words". I''m probably too late for this type of comment, but it doesn''t hurt to try... -- Rich Teer, SCSA, SCNA, SCSECA CEO, My Online Home Inventory URLs: http://www.rite-group.com/rich http://www.linkedin.com/in/richteer http://www.myonlinehomeinventory.com
Ryan Scott
2008-Sep-15 21:22 UTC
Re: Libvirt APIs for relative paths [PSARC/2008/577 FastTrack timeout 09/22/2008]
Rich Teer wrote:> On Mon, 15 Sep 2008, Huay-Yong Wang wrote: > >> 3. Library Interfaces >> >> char *virDomainGetRelativeXMLDesc(virDomainPtr domain, int flags, >> const char *relPath); >> >> Similar to virDomainGetXMLDesc(), except with a new relPath argument. All >> disk descriptions in the XML will be relative to this path. >> >> virDomainPtr virDomainDefineRelativeXML(virConnectPtr conn, const char *xml, >> const char *relPath); > > A great idea, but can we put a stop to function names with mixed > case identifiers, please? Let''s stick with all lower case with > underscores between "words". I''m probably too late for this type > of comment, but it doesn''t hurt to try...We want to keep the naming convention consistent in libvirt, and we inherited the rest from upstream, so it can''t be changed in this case. -Ryan>
Huay-Yong Wang
2008-Sep-23 18:18 UTC
Re: Libvirt APIs for relative paths [PSARC/2008/577 FastTrack timeout 09/22/2008]
The timer for this case has expired. I am marking this fasttrack closed and approved.
Kais Belgaied
2008-Sep-24 02:25 UTC
Re: Libvirt APIs for relative paths [PSARC/2008/577 FastTrack timeout 09/22/2008]
On 09/15/08 14:22, Ryan Scott wrote:> Rich Teer wrote: > >> On Mon, 15 Sep 2008, Huay-Yong Wang wrote: >> >> >>> 3. Library Interfaces >>> >>> char *virDomainGetRelativeXMLDesc(virDomainPtr domain, int flags, >>> const char *relPath); >>> >>> Similar to virDomainGetXMLDesc(), except with a new relPath argument. All >>> disk descriptions in the XML will be relative to this path. >>> >>> virDomainPtr virDomainDefineRelativeXML(virConnectPtr conn, const char *xml, >>> const char *relPath); >>> >> A great idea, but can we put a stop to function names with mixed >> case identifiers, please? Let''s stick with all lower case with >> underscores between "words". I''m probably too late for this type >> of comment, but it doesn''t hurt to try... >> > > We want to keep the naming convention consistent in libvirt, and we > inherited the rest from upstream, so it can''t be changed in this case. >yep. When in Rome do what Romans don. BTW, this is my +1 for this case. Kais> -Ryan > > > > _______________________________________________ > xen-discuss mailing list > xen-discuss@opensolaris.org > >