Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machines: Add LibvirtDBus provider #9240

Merged
merged 8 commits into from
Sep 18, 2018

Conversation

KKoukiou
Copy link
Contributor

@KKoukiou KKoukiou commented May 25, 2018

This patch series is rewriting martinpitt@329e623 and implements a second provider for Libvirt using Libvirt's D-Bus API (https://github.com/libvirt/libvirt-dbus/).
Since there is a lot of code that can be reused from libvirt.es6 file in the new provider, all reusable functions where moved to libvirt-common.es6 file to avoid code duplicity.

Checklist:

  • use DBus in ovirt/provider.es6 if available (so same story as for pkg/machines) (postponed to follow-up)
  • integration tests (refactor recent check-machines and check-ovirt tests to run ones for each of the providers)
  • user documentation to install libvirt-dbus
  • farther refactor to share as much as possible between libvirt.es6 and libvirt-dbus.es6
  • adjust dependencies to libvirt-dbus | libvirt-client ?
  • fix testAddDisk (machines: Robustify testAddDisk #9952 )
  • get fixed libvirt-dbus on fedora-28 (Image refresh for fedora-28 #9972)
  • fix temporary added disks to actually go away on shutdown

pkg/machines/index.es6 Outdated Show resolved Hide resolved
Copy link
Contributor

@mareklibra mareklibra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this effort, moving away from virsh is definately good way in the long-term!
Huray for the just released libvirt-dbus package.

Please correct me, but libvirt-dbus has still long way to pass to become a standard part of the supported distributions (aka debian or RHEL).
It's ok but just to be clear here: we will need to support both virsh and dbus connections in parallel for non-trivial time (even years?).

Adding Checklist to the PR description.

setVirtProvider(LibvirtDbus);
} else {
logDebug("index.es6: Setting virsh as virt provider.");
setVirtProvider(Libvirt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ovirt/provider.es6 will need to use DBus as well, if available.

(ovirt/index.es6, resp. inheritance in ovirt/provider.es6:40)

"ListActivatableNames")
.done(services => {
if (services[0].includes("org.libvirt")) {
logDebug("index.es6: Setting libvirt-dbus as virt provider.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use console.info() for this important decision

logDebug("index.es6: Setting libvirt-dbus as virt provider.");
setVirtProvider(LibvirtDbus);
} else {
logDebug("index.es6: Setting virsh as virt provider.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

pkg/machines/index.es6 Outdated Show resolved Hide resolved
return true;
},

canReset: (vmState) => vmState == 'running' || vmState == 'idle' || vmState == 'paused',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can following be shared?

serialConsoleCommand: ({
vm
}) => vm.displays['pty'] ? [ 'virsh', ...VMS_CONFIG.Virsh.connections[vm.connectionName].params, 'console', vm.name ] : false,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Up to here

const _ = cockpit.gettext;

let clientLibvirt = {
'session': null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to list them here. They will be undefined by default, so same semantics. Their name might vary based on the configuration.

@KKoukiou KKoukiou force-pushed the machines-dbus branch 3 times, most recently from bab41b4 to 8fa488e Compare May 30, 2018 11:04
@KKoukiou KKoukiou force-pushed the machines-dbus branch 2 times, most recently from 94f2ef6 to 8611756 Compare June 14, 2018 12:29
@KKoukiou
Copy link
Contributor Author

@mareklibra @martinpitt @Antique I reposted the patches with some fixes, adjusted the tests to run with both providers and some added info about libvirt-dbus in plugin docs.
Can you please take a look?

The tests are all passing locally, though with the current images they will fail here, because the available libvirt-dbus release is missing some APIs that I am using in these commits. (See more here https://www.redhat.com/archives/libvir-list/2018-June/msg00898.html)

So, although we shouldn't merge this patch series without the new release of libvirt-dbus to be included in the test images, can you please review so that I can get it to a state ready to merge?

Regarding supporting the using the libvirt-dbus in oVirt package, I suggest to keep it in separate PR, since current is already very big. WDYT?

@KKoukiou
Copy link
Contributor Author

Changes from previous push:

},

SET_VCPU_SETTINGS ({ name, connectionName, count, max, sockets, cores, threads, isRunning }) {
logDebug(`${this.name}.SET_VCPU_SETTINGS(${name}):`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to implement this :|
I 'll repost.

@martinpitt
Copy link
Member

#9692 landed, can you please rebase?

@martinpitt martinpitt changed the title RFC: machines: Add LibvirtDBus provider WIP: RFC: machines: Add LibvirtDBus provider Jul 20, 2018
@KKoukiou
Copy link
Contributor Author

Ready for review. Only testAddDisk for libvirt-dbus provider is failing but I am not sure why at this point.

I am afraid that refreshing storagePools here https://github.com/cockpit-project/cockpit/blob/master/pkg/machines/components/diskAdd.jsx#L425 is not actually happening, since the storagePools object it not fetched from this props every time it's updated. (Though I am total beginner with react, feedback would be appreciated)

Copy link
Contributor

@phrdina phrdina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good but there are some minor issues that needs to be addressed.

let providerVal = libvirtDBusavailable ? LibvirtDbus : Libvirt;

client.close();
return providerVal;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nit, this can be simplified by removing providerVal and using this return:
return libvirtDBusavailable ? LibvirtDbus : Libvirt;

And you can change libvirtDBusavailable into libvirtDBusAvailable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return dispatch => {
clientLibvirt[connectionName].call(objPath, 'org.libvirt.Domain', 'GetXMLDesc', [0], TIMEOUT)
.done(domXml => {
let updatedXml = updateNetworkIfaceState(domXml[0], networkMac, state);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updateNetworkIfaceState can return nothing if parsin domXml fails, we should check that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

connectionName
}) {
return dispatch => {
clientLibvirt[connectionName].call(objPath, 'org.libvirt.Domain', 'GetXMLDesc', [0], TIMEOUT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetXMLDesc can fail, shouldn't we check that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is it checked? I don't see a .catch handler here?

pkg/machines/libvirt-dbus.es6 Show resolved Hide resolved
clientLibvirt[connectionName].call(storageVolPath[0], 'org.libvirt.StorageVol', 'Delete', [0], TIMEOUT)
.finally(undefine_synced.bind(null, i + 1));
})
else /* VIR_DOMAIN_UNDEFINE_MANAGED_SAVE */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should use VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA and VIR_DOMAIN_UNDEFINE_NVRAM flags as well, otherwise cockpit would not be able to undefine such domains.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,67 @@
#!/usr/bin/python2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather use python3 for new code, every other verify script uses python3.


def detectLibvirtDbus(self):
m = self.machine
namesList = m.execute("dbus-send --system --dest=org.freedesktop.DBus "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot we use python dbus module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, this code is running on the machine you execute test tests from, m.execute executes the commands inside the VM the tests are going to run inside. If I was using dbus python module I would need to run it from a script that was running inside machine that contains the dbus I want to poll.. Or correct me if I am wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I missed the fact the it is executed on a different machine.

@@ -528,6 +524,8 @@ def testAddDisk(self):
b.wait_present("#vm-subVmTest1-disks") # wait for the tab
b.click("#vm-subVmTest1-disks") # open the "Disks" subtab

time.sleep(2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this change? There is nothing in commit message about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this already, I was debugging something.

access to Libvirtd is wrapped by the <ulink url="https://libvirt.org/virshcmdref.html">virsh</ulink> tool.</para>
access to Libvirtd is wrapped either by the <ulink url="https://libvirt.org/virshcmdref.html">virsh</ulink> tool or
<ulink url="https://libvirt.org/dbus.html">libvirt D-Bus API bindings</ulink>, depending if the latter is installed on
the system. If libvirt-dbus package is not available in your distrubution's software repositories you can follow the instructions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/distrubution/distribution/

@@ -21,6 +25,15 @@
</para>
</section>

<section id="feature-virtualmachines-sessionaccess">
<title>Managing VMs on session connection</title>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Session access is allowed be default, I guess that you mean system access/connection.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@KKoukiou KKoukiou force-pushed the machines-dbus branch 4 times, most recently from 674214d to db27c9a Compare August 8, 2018 14:13
The libvirt-dbus API has `StorageVolLookupByPath` but not by target.
Populate storage list with paths instead of targets to allow easy usage
of the API.

Current usage with `virsh undefine` is still going to work with storage
paths passed to the `--storage` parameter.
A new provider is going to be introduced in followup patch and we need
to clarify from the file name the provider used in each case.
The id parameter is going to be used by followup changes introducing new
provider.
Replace parseXML from jquery with DOMParser.
@KKoukiou
Copy link
Contributor Author

@KKoukiou : I just landed #9945, and now this conflicts. Can you please rebase?

Done

@martinpitt
Copy link
Member

Related test failures:

There are also some failures in the virsh tests, but these are (presumably) not new. But we shouldn't introduce more flakes, it's hard enough to get the tests to green as it is..

@KKoukiou
Copy link
Contributor Author

Related test failures:

* testAddDisk on [debian-testing](https://209.132.184.41:8493/logs/pull-9240-20180917-191010-eb76890f-verify-debian-testing/log.html#104) and [fedora-29](https://209.132.184.41:8493/logs/pull-9240-20180917-191212-eb76890f-verify-fedora-29/log.html#104)

Looks like race condition when tests are executed very fast with state not being up to date.. I added some logs in react code and I can't reproduce locally any more.

* testLibvirt on [fedora-29](https://209.132.184.41:8493/logs/pull-9240-20180917-191212-eb76890f-verify-fedora-29/log.html#111)

Not reproducible locally. I tried 10 times with no error :/

* testCreate on [fedora-i386](https://209.132.184.41:8493/logs/pull-9240-20180917-190909-eb76890f-verify-fedora-i386/log.html#49)

This test can't be affected by this PR because the code for CREATE action is shared 1000% between the two providers.
I tried to clean a bit however the test steps and let's see it it can reappear.

There are also some failures in the virsh tests, but these are (presumably) not new. But we shouldn't introduce more flakes, it's hard enough to get the tests to green as it is..

@martinpitt
Copy link
Member

Hmkay, retrying the tests a few times.

By the way, if you want to add libvirt-dbus to the rhel-x image, now would be a good time for it. I just spent my entire morning yesterday to fix the current regressions, so we got a fresh build yesterday. There's a very high chance that a build today will also succeed :-)

@martinpitt
Copy link
Member

I can locally reproduce this failure on fedora-29 in about one out of three (parallel) runs. Just keeping the log pointer here for now.

@KKoukiou
Copy link
Contributor Author

Reposting with the following diff. (forgot to change some naughy files)

[kkoukiou@localhost cockpit]$ git diff
diff --git a/bots/naughty/rhel-7/7891-selinux-denies-virtlogd-dbus-2 b/bots/naughty/rhel-7/7891-selinux-denies-virtlogd-dbus-2
index cf5808fb7..292a9aa0f 100644
--- a/bots/naughty/rhel-7/7891-selinux-denies-virtlogd-dbus-2
+++ b/bots/naughty/rhel-7/7891-selinux-denies-virtlogd-dbus-2
@@ -1,5 +1,5 @@
 Traceback (most recent call last):
-  File "test/verify/check-machines", line *, in testBasic
+  File "test/verify/machineslib.py", line *, in testBasic
     wait(lambda: "Linux version" in self.machine.execute("cat {0}".format(args["logfile"])), delay=3)
 *
 Error: Condition did not become true.
diff --git a/bots/naughty/rhel-x/7891-selinux-denies-virtlogd-dbus-2 b/bots/naughty/rhel-x/7891-selinux-denies-virtlogd-dbus-2
index cf5808fb7..292a9aa0f 100644
--- a/bots/naughty/rhel-x/7891-selinux-denies-virtlogd-dbus-2
+++ b/bots/naughty/rhel-x/7891-selinux-denies-virtlogd-dbus-2
@@ -1,5 +1,5 @@
 Traceback (most recent call last):
-  File "test/verify/check-machines", line *, in testBasic
+  File "test/verify/machineslib.py", line *, in testBasic
     wait(lambda: "Linux version" in self.machine.execute("cat {0}".format(args["logfile"])), delay=3)
 *
 Error: Condition did not become true.

Using libvirt D-Bus interface from https://github.com/libvirt/libvirt-dbus/

This commit is rewritting
martinpitt@329e623
with the major difference that it's keeping both Libvirt (virsh) and
LibvirtDBus providers.

The new provider at this point has exactly the same behavior and no extra
functionality compared to Libvirt provider.

Note: libvirt-dbus should be used only with libvirt version > v4.3.0 or
making sure that commit v4.2.0-104-g4d7384eb9d is included.

All tests where moved to machineslib.py.
Two new files with test classes were created for the two providers,
both inheriting from the TestMachines class.

Closes cockpit-project#9240
@martinpitt
Copy link
Member

subVmTestCreate15 failure debugging notes:

  • This test case checks creating a VM with an unreasonable amount of memory, which should fail.
  • The screenshot shows one VM in state "in transition". After some time, this goes away, the list is empty in cockpit and in virsh list --all.
  • As per @KKoukiou , the "in transition" state should not happen at all, and it means that virt-install did not fail as it is supposed to.
  • While the b.wait_present("thead tr td") is still going on, logging into cockpit in a separate browser immediately shows an empty VM list. virsh list --all is also empty, and there are no qemu processes. So this looks just like the UI of the tested browser is getting confused. Could it be that the default action that sets "in transition" races with the failure of create_machine.sh, so that the latter is processed after the former?
  • I added set -x to create_machine.sh, and it indeed appears to not have failed: If handle_failure() were called, it should have an exit $?, which clearly does not appear. Instead, the last read FINISH_LINE appears and the rm -f at the bottom of the script.
+ VM_NAME=subVmTestCreate15
+ SOURCE=/var/lib/libvirt/novell.iso
+ OS=macosx10.5
+ MEMORY_SIZE=921600
+ STORAGE_SIZE=0.009765625
+ START_VM=false
++ awk 'BEGIN{ print "0.009765625"<=0 }'
+ COMPARISON=0
+ '[' 0 -eq 1 ']'
+ DISK_OPTIONS=size=0.009765625,format=qcow2
+ GRAPHICS_PARAM='--graphics vnc,listen=127.0.0.1'
+ spiceSupported
++ uname -m
+ ARCH=x86_64
+ case "$ARCH" in
+ QEMU=qemu-system-x86_64
+ type -P qemu-system-x86_64
+ grep -q '"enabled":'
+ qemu-system-x86_64 --qmp stdio --nographic -nodefaults
+ printf '{"execute":"qmp_capabilities"}\n{"execute":"query-spice"}\n{"execute":"quit"}'
+ GRAPHICS_PARAM='--graphics spice,listen=127.0.0.1 --graphics vnc,listen=127.0.0.1'
+ '[' macosx10.5 = other-os -o -z macosx10.5 ']'
++ cut -c 1
++ echo /var/lib/libvirt/novell.iso
+ FIRST_1_SOURCE=/
++ cut -c -3
++ echo /var/lib/libvirt/novell.iso
+ FIRST_3_SOURCE=/va
++ cut -c -4
++ echo /var/lib/libvirt/novell.iso
+ FIRST_4_SOURCE=/var
+ '[' false = true -a / = / -a '!' -f /var/lib/libvirt/novell.iso ']'
+ '[' false = true -a '(' / = / -o /var = http -o /va = ftp -o /va = nfs ')' ']'
+ LOCATION_PARAM=
++ mktemp
+ XMLS_FILE=/tmp/tmp.lXP5thC14u
+ '[' false = true ']'
+ STARTUP_PARAMS=--print-xml
+ HAS_INSTALL_PHASE=true
+ virt-install --name subVmTestCreate15 --os-variant macosx10.5 --memory 921600 --quiet --disk size=0.009765625,format=qcow2 --print-xml --graphics spice,listen=127.0.0.1 --graphics vnc,listen=127.0.0.1
+ '[' false = true ']'
++ grep -n '</domain>' /tmp/tmp.lXP5thC14u
+ DOMAIN_MATCHES='63:</domain>'
++ wc -l
++ echo '63:</domain>'
+ LAST_STEP=1
+ CURRENT_STEP=1
+ START_LINE=1
+ read -r FINISH_LINE
+ sed 's/[^0-9]//g'
+ echo '63:</domain>'
++ expr 63 + 1
+ QUIT_LINE=64
+ '[' 1 = 1 ']'
+ sed -n -i '1,63p;64q' /tmp/tmp.lXP5thC14u
++ sed 's/[^0-9]//g'
++ grep -n '</metadata>' /tmp/tmp.lXP5thC14u
+ METADATA_LINE=
+ METADATA='    <cockpit_machines:data xmlns:cockpit_machines="https://github.com/cockpit-project/cockpit/tree/master/pkg/machines"> \
      <cockpit_machines:has_install_phase>true</cockpit_machines:has_install_phase> \
      <cockpit_machines:install_source>/var/lib/libvirt/novell.iso</cockpit_machines:install_source> \
      <cockpit_machines:os_variant>macosx10.5</cockpit_machines:os_variant> \
    </cockpit_machines:data>'
+ '[' -z '' ']'
++ wc -l
++ cat /tmp/tmp.lXP5thC14u
+ METADATA_LINE=63
+ METADATA='\ \ <metadata> \
    <cockpit_machines:data xmlns:cockpit_machines="https://github.com/cockpit-project/cockpit/tree/master/pkg/machines"> \
      <cockpit_machines:has_install_phase>true</cockpit_machines:has_install_phase> \
      <cockpit_machines:install_source>/var/lib/libvirt/novell.iso</cockpit_machines:install_source> \
      <cockpit_machines:os_variant>macosx10.5</cockpit_machines:os_variant> \
    </cockpit_machines:data> \
  </metadata>'
+ virsh -q define /dev/stdin
+ sed '63i \ \ <metadata> \
    <cockpit_machines:data xmlns:cockpit_machines="https://github.com/cockpit-project/cockpit/tree/master/pkg/machines"> \
      <cockpit_machines:has_install_phase>true</cockpit_machines:has_install_phase> \
      <cockpit_machines:install_source>/var/lib/libvirt/novell.iso</cockpit_machines:install_source> \
      <cockpit_machines:os_variant>macosx10.5</cockpit_machines:os_variant> \
    </cockpit_machines:data> \
  </metadata>' /tmp/tmp.lXP5thC14u
+ read -r FINISH_LINE
+ rm -f /tmp/tmp.lXP5thC14u

warning: GetXMLDesc method failed for path /org/libvirt/QEMU/domain/_ae181dd8_d548_4f7f_88b9_dde6b5ac1b7f 
warning: ERROR    internal error: qemu unexpectedly closed the monitor: 2018-09-18T12:56:12.128864Z qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///session start subVmTestCreate15
otherwise, please restart your installation.

@martinpitt
Copy link
Member

martinpitt commented Sep 18, 2018

I now added set + to install_machine.sh, which is the one that is supposed to fail. And it does:

warning: GetXMLDesc method failed for path /org/libvirt/QEMU/domain/_2998e19d_220f_4d9c_8be8_b473b0dbdd58 
warning: + VM_NAME=subVmTestCreate15
+ SOURCE=/var/lib/libvirt/novell.iso
+ OS=macosx10.5
+ MEMORY_SIZE=921600
+ VCPUS=1
+ DISKS='path=/home/admin/.local/share/libvirt/images/subVmTestCreate15.qcow2,device=disk,bus=ide,readonly=off,shareable=off,driver_name=qemu,driver_type=qcow2
'
+ DISPLAYS='type=spice,listen=127.0.0.1
type=vnc,listen=127.0.0.1,port=-1

'
+ '[' -z macosx10.5 ']'
+ '[' -z 'path=/home/admin/.local/share/libvirt/images/subVmTestCreate15.qcow2,device=disk,bus=ide,readonly=off,shareable=off,driver_name=qemu,driver_type=qcow2
' ']'
+ createOptions 'path=/home/admin/.local/share/libvirt/images/subVmTestCreate15.qcow2,device=disk,bus=ide,readonly=off,shareable=off,driver_name=qemu,driver_type=qcow2
' --disk
+ CREATE_OPTIONS_RESULT=
+ IFS=
+ read -r PARAM
+ '[' -n '    path=/home/admin/.local/share/libvirt/images/subVmTestCreate15.qcow2,device=disk,bus=ide,readonly=off,shareable=off,driver_name=qemu,driver_type=qcow2' ']'
+ CREATE_OPTIONS_RESULT=' --disk     path=/home/admin/.local/share/libvirt/images/subVmTestCreate15.qcow2,device=disk,bus=ide,readonly=off,shareable=off,driver_name=qemu,driver_type=qcow2'
+ IFS=
+ read -r PARAM
+ '[' -n '' ']'
+ IFS=
+ read -r PARAM
+ DISKS_PARAM=' --disk     path=/home/admin/.local/share/libvirt/images/subVmTestCreate15.qcow2,device=disk,bus=ide,readonly=off,shareable=off,driver_name=qemu,driver_type=qcow2'
+ '[' -z 'type=spice,listen=127.0.0.1
type=vnc,listen=127.0.0.1,port=-1

' ']'
+ createOptions 'type=spice,listen=127.0.0.1
type=vnc,listen=127.0.0.1,port=-1

' --graphics
+ CREATE_OPTIONS_RESULT=
+ IFS=
+ read -r PARAM
+ '[' -n '    type=spice,listen=127.0.0.1' ']'
+ CREATE_OPTIONS_RESULT=' --graphics     type=spice,listen=127.0.0.1'
+ IFS=
+ read -r PARAM
+ '[' -n type=vnc,listen=127.0.0.1,port=-1 ']'
+ CREATE_OPTIONS_RESULT=' --graphics     type=spice,listen=127.0.0.1 --graphics type=vnc,listen=127.0.0.1,port=-1'
+ IFS=
+ read -r PARAM
+ '[' -n '' ']'
+ IFS=
+ read -r PARAM
+ '[' -n '' ']'
+ IFS=
+ read -r PARAM
+ GRAPHICS_PARAM=' --graphics     type=spice,listen=127.0.0.1 --graphics type=vnc,listen=127.0.0.1,port=-1'
++ cut -c 1
++ echo /var/lib/libvirt/novell.iso
+ FIRST_1_SOURCE=/
++ cut -c -3
++ echo /var/lib/libvirt/novell.iso
+ FIRST_3_SOURCE=/va
++ cut -c -4
++ echo /var/lib/libvirt/novell.iso
+ FIRST_4_SOURCE=/var
+ '[' / = / -a '!' -f /var/lib/libvirt/novell.iso ']'
+ '[' / = / -o /var = http -o /va = ftp -o /va = nfs ']'
+ LOCATION_PARAM='--cdrom /var/lib/libvirt/novell.iso'
++ mktemp
+ DOMAIN_FILE=/tmp/tmp.z6auzHq3sj
+ virsh -q destroy subVmTestCreate15
+ virsh -q dumpxml subVmTestCreate15
+ virsh -q undefine subVmTestCreate15 --managed-save
+ virt-install --name subVmTestCreate15 --os-variant macosx10.5 --memory 921600 --vcpus 1 --quiet --wait -1 --noautoconsole --noreboot --disk path=/home/admin/.local/share/libvirt/images/subVmTestCreate15.qcow2,device=disk,bus=ide,readonly=off,shareable=off,driver_name=qemu,driver_type=qcow2 --cdrom /var/lib/libvirt/novell.iso --graphics type=spice,listen=127.0.0.1 --graphics type=vnc,listen=127.0.0.1,port=-1
ERROR    internal error: qemu unexpectedly closed the monitor: 2018-09-18T13:26:46.201467Z qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
  virsh --connect qemu:///session start subVmTestCreate15
otherwise, please restart your installation.
+ EXIT_STATUS=1
+ '[' 1 -eq 0 ']'
+ vmExists subVmTestCreate15
+ grep -q --line-regexp --fixed-strings subVmTestCreate15
+ virsh list --all
+ awk '{print $2}'
+ virsh -q define /tmp/tmp.z6auzHq3sj
+ rm -f /tmp/tmp.z6auzHq3sj
+ exit 1

I noticed someting interesting in the journal:

Sep 18 09:28:07 localhost.localdomain systemd-coredump[3728]: Process 1640 (libvirtd) of user 1000 dumped core.

That might or might not be related. Are these tests covering system or user qemu?

Update: I got another failed test run without this crash, so it's unrelated.

@martinpitt
Copy link
Member

Not fully perfect yet, but this looks so much better, thanks!

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and it only took 165 conversation comments and 59 force-pushes!

🎉

@martinpitt martinpitt merged commit 1034b8f into cockpit-project:master Sep 18, 2018
martinpitt pushed a commit that referenced this pull request Sep 18, 2018
Using libvirt D-Bus interface from https://github.com/libvirt/libvirt-dbus/

This commit is rewritting
martinpitt@329e623
with the major difference that it's keeping both Libvirt (virsh) and
LibvirtDBus providers.

The new provider at this point has exactly the same behavior and no extra
functionality compared to Libvirt provider.

Note: libvirt-dbus should be used only with libvirt version > v4.3.0 or
making sure that commit v4.2.0-104-g4d7384eb9d is included.

All tests where moved to machineslib.py.
Two new files with test classes were created for the two providers,
both inheriting from the TestMachines class.

Closes #9240
@KKoukiou KKoukiou mentioned this pull request Aug 8, 2018
garrett pushed a commit to garrett/cockpit that referenced this pull request Oct 17, 2018
Using libvirt D-Bus interface from https://github.com/libvirt/libvirt-dbus/

This commit is rewritting
martinpitt@329e623
with the major difference that it's keeping both Libvirt (virsh) and
LibvirtDBus providers.

The new provider at this point has exactly the same behavior and no extra
functionality compared to Libvirt provider.

Note: libvirt-dbus should be used only with libvirt version > v4.3.0 or
making sure that commit v4.2.0-104-g4d7384eb9d is included.

All tests where moved to machineslib.py.
Two new files with test classes were created for the two providers,
both inheriting from the TestMachines class.

Closes cockpit-project#9240
@KKoukiou KKoukiou deleted the machines-dbus branch November 29, 2018 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants