Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora/Linux Management Tools (http://www.linux-archive.org/fedora-linux-management-tools/)
-   -   Allow naming disk storage elements with an id and use that to reference them from the boot descriptor (http://www.linux-archive.org/fedora-linux-management-tools/12521-allow-naming-disk-storage-elements-id-use-reference-them-boot-descriptor.html)

David Lutterkort 12-04-2007 11:44 PM

Allow naming disk storage elements with an id and use that to reference them from the boot descriptor
 
diff -r 11d9412efc34 -r ea7588e72c26 doc/image.rng
--- a/doc/image.rng Tue Dec 04 15:17:12 2007 -0800
+++ b/doc/image.rng Tue Dec 04 15:17:48 2007 -0800
@@ -150,8 +150,12 @@
<define name="storage">
<oneOrMore>
<!-- A disk for mapping into a virtual machine
- file: file name (file must be in the same dir as the
- image descriptor)
+ id: a shorthand for referencing the disk. If this is missing,
+ the value of the file attribute is used to reference the
+ disk
+ file: file name, must be a legal Unix path name. Only relative
+ paths are allowed, and they are interpreted relative to the
+ location of the image descriptor.
use: only important for updating existing images
through replacement of entire disks
size: size of the disk in MB, needed only for user and scratch
@@ -161,6 +165,9 @@
iso for an ISO
-->
<element name="disk">
+ <optional>
+ <attribute name="id"><data type="ID"/></attribute>
+ </optional>
<attribute name="file"><ref name="relFilePath"/></attribute>
<attribute name="use">
<choice>
diff -r 11d9412efc34 -r ea7588e72c26 virtinst/ImageParser.py
--- a/virtinst/ImageParser.py Tue Dec 04 15:17:12 2007 -0800
+++ b/virtinst/ImageParser.py Tue Dec 04 15:17:48 2007 -0800
@@ -46,11 +46,12 @@ class Image:
for d in node.xpathEval("storage/disk"):
disk = Disk(d)
if disk.file is None:
+ disk.id = "disk%d.img" % len(self.storage)
disk.file = "disk%d.img" % (len(self.storage) + 1)
- if self.storage.has_key(disk.file):
+ if self.storage.has_key(disk.id):
raise ParserException("Disk file '%s' defined twice"
% disk.file)
- self.storage[disk.file] = disk
+ self.storage[disk.id] = disk
lm = node.xpathEval("domain")
if len(lm) == 1:
self.domain = Domain(lm[0])
@@ -176,6 +177,7 @@ class Disk:
USE_SCRATCH = "scratch"

def __init__(self, node = None):
+ self.id = None
self.file = None
self.format = None
self.size = None
@@ -185,6 +187,7 @@ class Disk:

def parseXML(self, node):
self.file = xpathString(node, "@file")
+ self.id = xpathString(node, "@id", self.file)
self.format = xpathString(node, "@format", Disk.FORMAT_RAW)
self.size = xpathString(node, "@size")
self.use = xpathString(node, "@use", Disk.USE_SYSTEM)

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

"Daniel P. Berrange" 12-04-2007 11:52 PM

Allow naming disk storage elements with an id and use that to reference them from the boot descriptor
 
[s..nip...]
ACK.

Dan
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@redhat.com
https://www.redhat.com/mailman/listinfo/et-mgmt-tools


All times are GMT. The time now is 11:46 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.