Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1513190 - Cannot Create Domain using vz Hypervisor
Summary: Cannot Create Domain using vz Hypervisor
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt-php
Version: unspecified
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Michal Privoznik
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-14 22:47 UTC by drewwynne
Modified: 2017-12-10 06:40 UTC (History)
2 users (show)

Fixed In Version: libvirt-php-0.5.5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-12-10 06:40:34 UTC


Attachments (Terms of Use)

Description drewwynne 2017-11-14 22:47:35 UTC
Description of problem:
When trying to us libvirt_domain_new() with vz, it links through to virDomainCreateXML() which is not supported by libvirt for vz looking at the matrix (https://libvirt.org/hvsupport.html), but virDomainCreateWithFlags() is.

Version-Release number of selected component (if applicable):
3.6 I have tried to have a look and see if there is a fix for this in the master branch but doesn't appear to be.

How reproducible:
libvirt_domain_new();

Steps to Reproduce:
1.Try and create a domain using the vz hypervisor.
2.$uri="vz:///system";
3.$conn = libvirt_connect($uri);
4.libvirt_domain_new($conn, 'vm2', 'x86_64', 512, 512, 1, $iso_image, $disks, $networks, 1);

Actual results:
libvirt_domain_new(): this function is not supported by the connection driver: virDomainCreateXML

Expected results:
To remap to virDomainCreateWithFlags() for vz hypervisor

Additional info:

Comment 1 Michal Privoznik 2017-12-07 09:49:58 UTC
Patches proposed on the upstream list:

https://www.redhat.com/archives/libvir-list/2017-December/msg00231.html

Comment 2 Michal Privoznik 2017-12-10 06:40:34 UTC
I've pushed the patches upstream:

commit 19cf16f570bb25da3c8874efce10ebfefd37fa89
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Thu Dec 7 10:18:40 2017 +0100
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Sat Dec 9 15:58:49 2017 +0100

    src: Use VIR_FREE instead of free
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: Erik Skultety <eskultet@redhat.com>

commit 70c95d0ee725f364cbe314c72d8f35763b74cf3f
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Thu Dec 7 09:55:54 2017 +0100
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Sat Dec 9 15:58:28 2017 +0100

    installation_get_xml: Resolve couple of memleaks
    
    There are still some, but it's definitely better now.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

commit 36d6411e485ef42970f0e66fa018066b6092c1de
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Thu Dec 7 09:55:30 2017 +0100
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Sat Dec 9 15:58:21 2017 +0100

    libvirt_domain_new: Resolve couple of memleaks
    
    There are still some, but it's definitely better now.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: Erik Skultety <eskultet@redhat.com>

commit 8382a2e3aa41d93e5aff6f47c15f43f312bebb3a
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Thu Dec 7 09:31:49 2017 +0100
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Sat Dec 9 15:56:31 2017 +0100

    util: Introduce VIR_FREE
    
    Just like libvirt has it. After freeing pointer set it to NULL to
    avoid double frees.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: Erik Skultety <eskultet@redhat.com>

commit 5f01d8d130400b2c06ff6f857cb115223382ae68
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Wed Nov 29 11:38:23 2017 +0100
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Sat Dec 9 15:56:14 2017 +0100

    installation_get_xml: Don't override defaults of <on_reboot/> and friends
    
    We don't really need to override the defaults because libvirt
    chooses sane ones.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: Erik Skultety <eskultet@redhat.com>

commit 9d969bbd4098113acd14f7ed4c3c76def8dc6a46
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Wed Nov 15 10:48:43 2017 +0100
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Sat Dec 9 15:53:48 2017 +0100

    Rework libvirt_domain_new a bit
    
    Firstly, this API is creating $domName-install for installation
    and at the same time it defines $domName (but never runs it).
    This is not very optimal - libvirt can handle two definitions for
    a single domain (active and inactive ones).
    
    Secondly, this function is leaking domain objects on any error.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: Erik Skultety <eskultet@redhat.com>

commit 24e065275e9c470ef0b4812a54a5fe641b2f2361
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Wed Nov 15 10:14:14 2017 +0100
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Sat Dec 9 14:47:02 2017 +0100

    Make installation_get_xml hurt my eyes less.
    
    This function has a lot of problems. Fix some of them:
    
    1) long lines
    2) useless argument @step
    3) unclear domain XML
    4) unclear difference in generated XMLs for step 1 and step 2
    5) static 32KB buffer(!)
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: Erik Skultety <eskultet@redhat.com>


Note You need to log in before you can comment on or make changes to this bug.