On Fri, Aug 21, 2009 at 11:08:05AM +0900, Yuji NISHIDA wrote:
>> 2009/7/24 Daniel P. Berrange <berrange(a)redhat.com>
>>> We should make use of this --name parameter then - I guess it didn't
>>> exist when we first wrote the driver. It is useful to users to have
>>> separate ID vs Name parameters - and in fact the current reusing of
>>> 'ID' for the name, causes a little confusion in virsh's lookup
>>> routines
>>> because it can't tell whether the parameter its given is a name or
>>> an
>>> ID, since they are identical.
>>
>> There is still a question of how to specify both a name and CTID in
>> XML
>> description.
>> By default, CTID can be obtained as openvzGimmeFirstUnusedCTID(), but
>> actually
>> I think that there exists a number of persons interested in giving
>> CTIDs
>> manually.
>
> Well, can <domain id=''> be used for CTID remaining <name> for
> alphabetical domain name?
I worte a small patch and tried with following XML setting.
### Patch ###
--- a/src/openvz_driver.c
+++ b/src/openvz_driver.c
@@ -130,9 +130,6 @@
ADD_ARG_LIT(VZCTL);
ADD_ARG_LIT("--quiet");
ADD_ARG_LIT("create");
- ADD_ARG_LIT(vmdef->id);
-
- ADD_ARG_LIT("--name");
ADD_ARG_LIT(vmdef->name);
### XML ###
<domain id='100'>
<name>abc</name>
I found the type of id was identified as number( obj->type ==
XPATH_NUMBER ) in virXPathLongBase,
but it is clearly string before converted.
I think correct path is to go in the first if context( obj->type ==
XPATH_STRING ) and run strtol.
the id of domain must be a number, that's a requirement of libvirt
so when parsing we expect a number value.
Then I tried with following XML.
### XML ###
<domain id=100>
<name>abc</name>
I got following error.
AttValue: " or ' expected
yes, that's not XML ! you need ' or " around attributes, normal too.
I'm not sure from which function should return this result.
I'm not sure what you're trying to do but as is the behaviour of
libvirt looks fine from your report.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/