Re: [libvirt] Re: OpenVZ : The restriction of domain name should be addressed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 15, 2009 at 03:40:09PM +0900, Yuji NISHIDA wrote:
> Hi Daniel,
> 
> I didn't realize that I even did not follow the manner of XML.
> I have worked with this problem and got a small patch to handle "ID"  
> in OpenVZ functionality.
> I found it is working well with the XML script included "ID" in domain  
> tag.
> 
> I am concerned that I had to edit the common file domain_conf.c.
> I still believe I should keep it away from this problem for  
> compatibility with the others.
> How do you think can I avoid this?

The 'id' value is not intended to be settable by the end user,
which is why the domain_conf.c parser does not parse it by
default. 

So for your usage in OpenVZ, you'll need to auto-assign an 'id'
value when creating a new guest. eg, get a list of existing
OpenVZ guest 'id' values and then pick the first one which is
not used.

> diff --git a/src/openvz_driver.c b/src/openvz_driver.c
> index a8c24ba..c0c1e0f 100644
> --- a/src/openvz_driver.c
> +++ b/src/openvz_driver.c
> @@ -130,6 +131,11 @@ static int openvzDomainDefineCmd(virConnectPtr  
> conn,
>      ADD_ARG_LIT(VZCTL);
>      ADD_ARG_LIT("--quiet");
>      ADD_ARG_LIT("create");
> +
> +    sprintf( str_id, "%d", vmdef->id );
> +    ADD_ARG_LIT(str_id);
> +
> +    ADD_ARG_LIT("--name");
>      ADD_ARG_LIT(vmdef->name);

This is where you need to pull in an auto-assigned ID value
instead of using vmdef->id.


Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]