[Kimchi-devel] [PATCH] Make VMs for tests auto-destroy'd and transient
Christy Perez
christy at linux.vnet.ibm.com
Thu Feb 5 22:16:31 UTC 2015
Ah. I didn't check the error log, so I didn't see these messages. I just
ran the tests and things came out fine. It looks like we'll have to come
up with a better way to make sure that these VMs don't hang around. Or a
better way to test that libvirt support each protocol for streaming...
Thanks.
- Christy
On 02/05/2015 12:54 PM, Aline Manera wrote:
>
> After applying this patch I got several error when starting up the
> Kimchi server.
> Please, check below.
>
> Also the Capabilities API is returning a different result with/without
> this patch:
>
> *with* this patch:
>
> alinefm at alinefm:~/kimchi$ curl -u <user:password> -H "Content-Type:
> application/json" -H "Accept: application/json" -k
> https://localhst:8001/config/capabilities
> {
> "kernel_vfio":true,
> "repo_mngt_tool":"deb",
> "qemu_spice":true,
> "screenshot":null,
> "system_report_tool":true,
> "update_tool":true,
> "qemu_stream":true,
> "libvirt_stream_protocols":[],
> "auth":"pam",
> "federation":"off"
> }
>
> *without* this patch:
>
> alinefm at alinefm:~/kimchi$ curl -u <user:password> -H "Content-Type:
> application/json" -H "Accept: application/json" -k
> https://localhost:8001/config/capabilities
> {
> "kernel_vfio":true,
> "repo_mngt_tool":"deb",
> "qemu_spice":true,
> "screenshot":null,
> "system_report_tool":true,
> "update_tool":true,
> "qemu_stream":true,
> "libvirt_stream_protocols":[
> "http",
> "https",
> "ftp",
> "ftps",
> "tftp"
> ],
> "auth":"pam",
> "federation":"off"
> }
>
> alinefm at alinefm:~/kimchi$ sudo python src/kimchid --environment=development
> Loading AptUpdate features.
> [05/Feb/2015:16:48:47] ENGINE Listening for SIGHUP.
> [05/Feb/2015:16:48:47] ENGINE Listening for SIGTERM.
> [05/Feb/2015:16:48:47] ENGINE Listening for SIGUSR1.
> [05/Feb/2015:16:48:47] ENGINE Bus STARTING
> [05/Feb/2015:16:48:47] ENGINE Started monitor thread 'Autoreloader'.
> [05/Feb/2015:16:48:47] ENGINE Serving on http://127.0.0.1:8010
> *** Running feature tests ***
> 127.0.0.1 - - [05/Feb/2015:16:48:47] "HEAD /images/icon-fedora.png
> HTTP/1.1" 200 4449 "" ""
> 127.0.0.1 - - [05/Feb/2015:16:48:47] "GET /images/icon-fedora.png
> HTTP/1.1" 206 4449 "" ""
> 127.0.0.1 - - [05/Feb/2015:16:48:47] "HEAD /images/icon-fedora.png
> HTTP/1.1" 200 4449 "" ""
> 127.0.0.1 - - [05/Feb/2015:16:48:47] "GET /images/icon-fedora.png
> HTTP/1.1" 206 4449 "" ""
> libvirt: error : internal error: Child process (/sbin/showmount
> --no-headers --exports localhost) unexpected exit status 1: clnt_create:
> RPC: Program not registered
> internal error: Child process (/sbin/showmount --no-headers --exports
> localhost) unexpected exit status 1: clnt_create: RPC: Program not
> registered
>
> libvirt: QEMU Driver error : internal error: early end of file from
> monitor: possible problem:
> p11-kit: couldn't list directory: /usr/share/p11-kit/modules: Permission
> denied
> 2015-02-05T18:48:49.906991Z qemu-system-x86_64: -drive
> file=http://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image http://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
> internal error: early end of file from monitor: possible problem:
> p11-kit: couldn't list directory: /usr/share/p11-kit/modules: Permission
> denied
> 2015-02-05T18:48:49.906991Z qemu-system-x86_64: -drive
> file=http://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image http://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
>
> libvirt: QEMU Driver error : internal error: process exited while
> connecting to monitor: p11-kit: couldn't list directory:
> /usr/share/p11-kit/modules: Permission denied
> 2015-02-05T18:48:51.067337Z qemu-system-x86_64: -drive
> file=https://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image https://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
> internal error: process exited while connecting to monitor: p11-kit:
> couldn't list directory: /usr/share/p11-kit/modules: Permission denied
> 2015-02-05T18:48:51.067337Z qemu-system-x86_64: -drive
> file=https://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image https://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
>
> libvirt: QEMU Driver error : internal error: process exited while
> connecting to monitor: p11-kit: couldn't list directory:
> /usr/share/p11-kit/modules: Permission denied
> 2015-02-05T18:48:52.208882Z qemu-system-x86_64: -drive
> file=ftp://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image ftp://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
> internal error: process exited while connecting to monitor: p11-kit:
> couldn't list directory: /usr/share/p11-kit/modules: Permission denied
> 2015-02-05T18:48:52.208882Z qemu-system-x86_64: -drive
> file=ftp://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image ftp://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
>
> libvirt: QEMU Driver error : internal error: process exited while
> connecting to monitor: p11-kit: couldn't list directory:
> /usr/share/p11-kit/modules: Permission denied
> 2015-02-05T18:48:53.354543Z qemu-system-x86_64: -drive
> file=ftps://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image ftps://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
> internal error: process exited while connecting to monitor: p11-kit:
> couldn't list directory: /usr/share/p11-kit/modules: Permission denied
> 2015-02-05T18:48:53.354543Z qemu-system-x86_64: -drive
> file=ftps://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image ftps://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
>
> libvirt: QEMU Driver error : internal error: process exited while
> connecting to monitor: p11-kit: couldn't list directory:
> /usr/share/p11-kit/modules: Permission denied
> 2015-02-05T18:48:54.532055Z qemu-system-x86_64: -drive
> file=tftp://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image tftp://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
> internal error: process exited while connecting to monitor: p11-kit:
> couldn't list directory: /usr/share/p11-kit/modules: Permission denied
> 2015-02-05T18:48:54.532055Z qemu-system-x86_64: -drive
> file=tftp://host.name:1234/url/path/to/iso/file,if=none,id=drive-ide0-1-0,readonly=on,format=raw:
> could not open disk image tftp://host.name:1234/url/path/to/iso/file:
> CURL: Error opening file: Could not resolve host: host.name
>
> *** Feature tests completed ***
> [05/Feb/2015:16:48:54] ENGINE Bus STARTED
> [05/Feb/2015:16:49:26] ENGINE Started monitor thread 'Session cleanup'.
> 127.0.0.1 - - [05/Feb/2015:16:49:26] "GET /plugins HTTP/1.0" 200 2 ""
> "curl/7.37.1"
> 127.0.0.1 - - [05/Feb/2015:16:49:31] "GET /config HTTP/1.0" 200 69 ""
> "curl/7.37.1"
> 127.0.0.1 - - [05/Feb/2015:16:49:35] "GET /config/capabilities HTTP/1.0"
> 200 236 "" "curl/7.37.1"
> ^C[05/Feb/2015:16:49:39] ENGINE Keyboard Interrupt: shutting down bus
> [05/Feb/2015:16:49:39] ENGINE Bus STOPPING
> [05/Feb/2015:16:49:39] ENGINE HTTP Server
> cherrypy._cpwsgi_server.CPWSGIServer(('127.0.0.1', 8010)) shut down
> [05/Feb/2015:16:49:39] ENGINE Stopped thread 'Autoreloader'.
> [05/Feb/2015:16:49:39] ENGINE Stopped thread 'Session cleanup'.
> [05/Feb/2015:16:49:39] ENGINE Bus STOPPED
> [05/Feb/2015:16:49:39] ENGINE Bus EXITING
> [05/Feb/2015:16:49:39] ENGINE Bus EXITED
> [05/Feb/2015:16:49:39] ENGINE Waiting for child threads to terminate...
>
>
> On 03/02/2015 17:57, Christy Perez wrote:
>> If Kimchi's startup is interrupted for some reason, a VM created
>> during the feature tests may be left defined. When this happens,
>> the next time Kimchi is started it will fail with an error that
>> the domain already exists (for example, "libvirtError: operation
>> failed: domain 'A_SIMPLE_VM' already exists with uuid
>> e6fccea8-f7ed-4320-a4cb-b85217d23985").
>>
>> About the new flag:
>> "If the VIR_DOMAIN_START_AUTODESTROY flag is set, the guest
>> domain will be automatically destroyed when the virConnectPtr
>> object is finally released. This will also happen if the
>> client application crashes / loses its connection to the
>> libvirtd daemon. Any domains marked for auto destroy will
>> block attempts at migration, save-to-file, or snapshots."
>>
>> This patch also changes the memory in the test VMs, due to the fact
>> that the domain will be started, and some platforms (Power is a known
>> example) require at least 128M of memory for a guest.
>>
>> Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
>> ---
>> src/kimchi/kvmusertests.py | 5 ++---
>> src/kimchi/model/featuretests.py | 14 ++++++++------
>> 2 files changed, 10 insertions(+), 9 deletions(-)
>>
>> diff --git a/src/kimchi/kvmusertests.py b/src/kimchi/kvmusertests.py
>> index 408706d..3abf148 100644
>> --- a/src/kimchi/kvmusertests.py
>> +++ b/src/kimchi/kvmusertests.py
>> @@ -54,9 +54,8 @@ def probe_user(cls):
>> with RollbackContext() as rollback:
>> conn = libvirt.open(None)
>> rollback.prependDefer(conn.close)
>> - dom = conn.defineXML(xml)
>> - rollback.prependDefer(dom.undefine)
>> - dom.create()
>> + dom = conn.createXML(xml,
>> +
>> flags=libvirt.VIR_DOMAIN_START_AUTODESTROY)
>> rollback.prependDefer(dom.destroy)
>> with open('/var/run/libvirt/qemu/%s.pid' % vm_name) as f:
>> pidStr = f.read()
>> diff --git a/src/kimchi/model/featuretests.py
>> b/src/kimchi/model/featuretests.py
>> index 5a45990..ef7dcc5 100644
>> --- a/src/kimchi/model/featuretests.py
>> +++ b/src/kimchi/model/featuretests.py
>> @@ -58,7 +58,7 @@
>> SIMPLE_VM_XML = """
>> <domain type='%(domain)s'>
>> <name>A_SIMPLE_VM</name>
>> - <memory unit='KiB'>10240</memory>
>> + <memory unit='KiB'>131072</memory>
>> <os>
>> <type arch='%(arch)s'>hvm</type>
>> <boot dev='hd'/>
>> @@ -109,8 +109,9 @@ def libvirt_supports_iso_stream(conn, protocol):
>> 'arch': arch}
>> try:
>> FeatureTests.disable_libvirt_error_logging()
>> - dom = conn.defineXML(xml)
>> - dom.undefine()
>> + dom = conn.createXML(xml,
>> +
>> flags=libvirt.VIR_DOMAIN_START_AUTODESTROY)
>> + dom.destroy()
>> return True
>> except libvirt.libvirtError, e:
>> kimchi_log.error(e.message)
>> @@ -196,9 +197,10 @@ def has_metadata_support(conn):
>> domain_type = 'test' if conn.getType().lower() == 'test'
>> else 'kvm'
>> arch = 'ppc64' if platform.machine() == 'ppc64le' \
>> else platform.machine()
>> - dom = conn.defineXML(SIMPLE_VM_XML % {'domain': domain_type,
>> - 'arch': arch})
>> - rollback.prependDefer(dom.undefine)
>> + dom = conn.createXML(SIMPLE_VM_XML % {'domain': domain_type,
>> + 'arch': arch},
>> +
>> flags=libvirt.VIR_DOMAIN_START_AUTODESTROY)
>> + rollback.prependDefer(dom.destroy)
>> try:
>> dom.setMetadata(libvirt.VIR_DOMAIN_METADATA_ELEMENT,
>> "<metatest/>", KIMCHI_NAMESPACE,
>
More information about the Kimchi-devel
mailing list