]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
5 years agoconf: Get rid of "no_memory" labels
Fabiano Fidêncio [Fri, 20 Dec 2019 12:43:11 +0000 (13:43 +0100)]
conf: Get rid of "no_memory" labels

As pointed out by Ján Tomko, "no_memory seems suspicious in the times of
abort()".

As libvirt decided to take the path to not report OOM and simply abort
when it happens, let's get rid of the no_memory labels and simplify the
code around them.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
5 years agonews: document phyp removal
Cole Robinson [Fri, 20 Dec 2019 18:03:22 +0000 (13:03 -0500)]
news: document phyp removal

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoRemove phyp driver
Cole Robinson [Wed, 18 Dec 2019 15:23:34 +0000 (10:23 -0500)]
Remove phyp driver

The phyp driver was added in 2009 and does not appear to have had any
real feature change since 2011. There's virtually no evidence online
of users actually using it. IMO it's time to kill it.

This was discussed a bit in April 2016:
https://www.redhat.com/archives/libvir-list/2016-April/msg01060.html

Final discussion is here:
https://www.redhat.com/archives/libvir-list/2019-December/msg01162.html

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agodocs: rewrite polkit docs generator in Python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
docs: rewrite polkit docs generator in Python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the genaclperms.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agodocs: rewrite hvsupport.html page generator in python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
docs: rewrite hvsupport.html page generator in python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the hvsupport.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

The new impl generates byte-for-byte identical output to the
old impl.

Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: rewrite file access checker in Python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
tests: rewrite file access checker in Python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the check-file-access.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotests: rewrite qemu capability grouper in Python
Daniel P. Berrangé [Fri, 30 Aug 2019 12:22:54 +0000 (13:22 +0100)]
tests: rewrite qemu capability grouper in Python

As part of a goal to eliminate Perl from libvirt build tools,
rewrite the group-qemu-caps.pl tool in Python.

This was a straight conversion, manually going line-by-line to
change the syntax from Perl to Python. Thus the overall structure
of the file and approach is the same.

Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoesx: set vmfs fs type for vmfs-based datastores
Pino Toscano [Fri, 15 Nov 2019 11:51:51 +0000 (12:51 +0100)]
esx: set vmfs fs type for vmfs-based datastores

This way they are correctly represented:
  <source>
    <format type='vmfs'/>
  </source>
... instead of 'auto'.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agostorage: add vmfs filesystem type
Pino Toscano [Fri, 15 Nov 2019 11:45:19 +0000 (12:45 +0100)]
storage: add vmfs filesystem type

It will be used to represent the type of a filesystem pool in ESXi.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoesx: split virtualswitchToNetwork helper
Pino Toscano [Thu, 14 Nov 2019 10:19:13 +0000 (11:19 +0100)]
esx: split virtualswitchToNetwork helper

Move the creation of a virNetworkPtr object from the
esxVI_HostVirtualSwitch object of a virtual switch out of
esxNetworkLookupByName in an own helper. This way it can be used also
in other functions.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoesx: split targetToStoragePool helper
Pino Toscano [Tue, 12 Nov 2019 17:16:48 +0000 (18:16 +0100)]
esx: split targetToStoragePool helper

Move the creation of a virStoragePtr object from the
esxVI_HostInternetScsiHbaStaticTarget object of a target out of
esxStoragePoolLookupByName in an own helper. This way it can be used
also in other functions.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoesx: split datastorePoolType helper
Pino Toscano [Tue, 12 Nov 2019 13:39:32 +0000 (14:39 +0100)]
esx: split datastorePoolType helper

Move the detection of the type of a vmfs pool out of
esxLookupVMFSStoragePoolType in an own helper. This way it can be used
also in other functions.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoesx: split datastoreToStoragePoolPtr helper
Pino Toscano [Mon, 11 Nov 2019 15:34:34 +0000 (16:34 +0100)]
esx: split datastoreToStoragePoolPtr helper

Move the creation of a virStoragePtr object from the esxVI_ObjectContent
object of a datastore out of esxStoragePoolLookupByName in an own
helper. This way it can be used also in other functions.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoadmin: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:41:33 +0000 (10:41 +0100)]
admin: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoadmin: Use g_autofree in getSocketPath()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:40:37 +0000 (10:40 +0100)]
admin: Use g_autofree in getSocketPath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agointerface: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:39:32 +0000 (10:39 +0100)]
interface: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:38:37 +0000 (10:38 +0100)]
locking: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Use g_autofree in virLockDaemonExecRestartStatePath()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:37:20 +0000 (10:37 +0100)]
locking: Use g_autofree in virLockDaemonExecRestartStatePath()

Together with the change, let's also simplify the function and get rid
of the goto.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Use g_autofree in virLockDaemonUnixSocketPaths()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:35:57 +0000 (10:35 +0100)]
locking: Use g_autofree in virLockDaemonUnixSocketPaths()

Together with the change, let's also simplify the function and get rid
of the goto.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Use g_autofree in virLockManagerLockDaemonPath()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:34:16 +0000 (10:34 +0100)]
locking: Use g_autofree in virLockManagerLockDaemonPath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agologging: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:29:28 +0000 (10:29 +0100)]
logging: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agologging: Use g_autofree in virLogDaemonExecRestartStatePath()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:31:39 +0000 (10:31 +0100)]
logging: Use g_autofree in virLogDaemonExecRestartStatePath()

Together with the change, let's also simplify the function and get rid
of the goto.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agologging: Use g_autofree in virLogDaemonUnixSocketPaths()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:30:34 +0000 (10:30 +0100)]
logging: Use g_autofree in virLogDaemonUnixSocketPaths()

Together with the change, let's also simplify the function and get rid
of the goto.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agologging: Use g_autofree in virLogManagerDaemonPath()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:29:01 +0000 (10:29 +0100)]
logging: Use g_autofree in virLogManagerDaemonPath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonetwork: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:27:49 +0000 (10:27 +0100)]
network: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonode_device: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:23:14 +0000 (10:23 +0100)]
node_device: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:22:16 +0000 (10:22 +0100)]
qemu: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoremote: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:21:40 +0000 (10:21 +0100)]
remote: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agorpc: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:19:25 +0000 (10:19 +0100)]
rpc: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agosecret: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:18:31 +0000 (10:18 +0100)]
secret: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agostorage: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:17:11 +0000 (10:17 +0100)]
storage: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Don't check the output of virGetUserRuntimeDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:16:21 +0000 (10:16 +0100)]
util: Don't check the output of virGetUserRuntimeDirectory()

virGetUserRuntimeDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:43:51 +0000 (09:43 +0100)]
locking: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agolocking: Use g_autofree in virLockDaemonConfigFilePath()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:42:57 +0000 (09:42 +0100)]
locking: Use g_autofree in virLockDaemonConfigFilePath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agologging: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:41:45 +0000 (09:41 +0100)]
logging: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agologging: Use g_autofree in virLogDaemonConfigFilePath()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:41:11 +0000 (09:41 +0100)]
logging: Use g_autofree in virLogDaemonConfigFilePath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agonetwork: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:27:05 +0000 (10:27 +0100)]
network: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:39:26 +0000 (09:39 +0100)]
qemu: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoremote: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:38:30 +0000 (09:38 +0100)]
remote: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoremote: Use g_autofree in daemonConfigFilePath()
Fabiano Fidêncio [Thu, 19 Dec 2019 22:47:30 +0000 (23:47 +0100)]
remote: Use g_autofree in daemonConfigFilePath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agorpc: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:37:51 +0000 (09:37 +0100)]
rpc: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Don't check the output of virGetUserCacheDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:14:31 +0000 (10:14 +0100)]
qemu: Don't check the output of virGetUserCacheDirectory()

virGetUserCacheDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Don't check the output of virGetUserCacheDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:12:56 +0000 (10:12 +0100)]
util: Don't check the output of virGetUserCacheDirectory()

virGetUserCacheDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Use g_autofree in virLogSetDefaultOutputToFile()
Fabiano Fidêncio [Thu, 19 Dec 2019 09:11:49 +0000 (10:11 +0100)]
util: Use g_autofree in virLogSetDefaultOutputToFile()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovbox: Don't check the output of virGetUserCacheDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:50:34 +0000 (09:50 +0100)]
vbox: Don't check the output of virGetUserCacheDirectory()

virGetUserCacheDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovbox: Use g_autofree in vboxDomainScreenshot()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:48:05 +0000 (09:48 +0100)]
vbox: Use g_autofree in vboxDomainScreenshot()

This also fixes a cacheDir's leak when g_mkstep_full() fails.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotools: Don't check the output of virGetUserCacheDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:45:52 +0000 (09:45 +0100)]
tools: Don't check the output of virGetUserCacheDirectory()

virGetUserCacheDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agosecret: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:44:40 +0000 (09:44 +0100)]
secret: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agostorage: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:36:22 +0000 (09:36 +0100)]
storage: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Don't check the output of virGetUserConfigDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:33:54 +0000 (09:33 +0100)]
util: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoutil: Use g_autofree in virConfLoadConfigPath()
Fabiano Fidêncio [Thu, 19 Dec 2019 17:30:33 +0000 (18:30 +0100)]
util: Use g_autofree in virConfLoadConfigPath()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoqemu: Don't check the output of virGetUserDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:32:11 +0000 (09:32 +0100)]
qemu: Don't check the output of virGetUserDirectory()

virGetUserDirectory() *never* *ever* returns NULL, making the checks for
it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agorpc: Don't check the output of virGetUserDirectory()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:23:58 +0000 (09:23 +0100)]
rpc: Don't check the output of virGetUserDirectory()

virGetUserDirectory() *never* *ever* returns NULL, making the checks for
it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agorpc: Use g_autofree in virNetClientNewLibssh()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:22:16 +0000 (09:22 +0100)]
rpc: Use g_autofree in virNetClientNewLibssh()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agorpc: Use g_autofree in virNetClientNewLibSSH2()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:21:10 +0000 (09:21 +0100)]
rpc: Use g_autofree in virNetClientNewLibSSH2()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agovbox: Don't leak virGetUserDirectory()'s output
Fabiano Fidêncio [Thu, 19 Dec 2019 08:13:00 +0000 (09:13 +0100)]
vbox: Don't leak virGetUserDirectory()'s output

On vboxStorageVolCreateXML(), virGetUserDirectory() was called without
freeing its content later on.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agotools: Use g_autofree in cmdCd()
Fabiano Fidêncio [Thu, 19 Dec 2019 08:09:02 +0000 (09:09 +0100)]
tools: Use g_autofree in cmdCd()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
5 years agoAUTHORS: Add Fabiano Fidêncio
Ján Tomko [Mon, 16 Jul 2018 14:31:53 +0000 (16:31 +0200)]
AUTHORS: Add Fabiano Fidêncio

$ git log --committer=fidencio --pretty=oneline | wc -l
12

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
5 years agovirsh: Adjust logic checks in virshUpdateDiskXML
John Ferlan [Tue, 17 Dec 2019 15:43:24 +0000 (10:43 -0500)]
virsh: Adjust logic checks in virshUpdateDiskXML

Make it clearer that what we're trying to do is find @source and
@target_node so that the unattentive or code analysis utility
doesn't believe 'source' and 'target' could be found in the same
node element.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agovbox: Reset @ret after xmlFreeNode
John Ferlan [Mon, 16 Dec 2019 12:36:32 +0000 (07:36 -0500)]
vbox: Reset @ret after xmlFreeNode

In the error path, if we xmlFreeNode @ret, then the return ret;
a few lines later returns something that's already been free'd
and could be reused, so let's reinit it.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoconf: Fix ATTRIBUTE_NONNULL usages
John Ferlan [Sat, 14 Dec 2019 15:37:57 +0000 (10:37 -0500)]
conf: Fix ATTRIBUTE_NONNULL usages

Recent changes removed the virCapsPtr, but didn't adjust/remove the
corresponding ATTRIBUTE_NONNULL resulting in a build failure to build
in my Coverity environment.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: Remove VIR_FILE_*_SEPARATOR*
Fabiano Fidêncio [Wed, 18 Dec 2019 20:13:16 +0000 (21:13 +0100)]
util: Remove VIR_FILE_*_SEPARATOR*

None of those are used and we should prefer using the ones provided by
GLib, as G_DIR_SEPARATOR, G_DIR_SEPARATOR_S, G_SEARCHPATH_SEPARATOR, and
G_SEARCHPATH_SEPARATOR_S.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoutil: Use G_DIR_SEPARATOR instead of VIR_FILE_DIR_SEPARATOR
Fabiano Fidêncio [Wed, 18 Dec 2019 20:11:43 +0000 (21:11 +0100)]
util: Use G_DIR_SEPARATOR instead of VIR_FILE_DIR_SEPARATOR

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoutil: Remove VIR_FILE_IS_DIR_SEPARATOR
Fabiano Fidêncio [Wed, 18 Dec 2019 19:45:50 +0000 (20:45 +0100)]
util: Remove VIR_FILE_IS_DIR_SEPARATOR

The define is not used since virFileIsAbsPath() has been dropped.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoutil: Remove virFileIsAbsPath()
Fabiano Fidêncio [Wed, 18 Dec 2019 19:43:25 +0000 (20:43 +0100)]
util: Remove virFileIsAbsPath()

The function is no longer used since commit faf2d811f3e9a4.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoutil: Remove virFileSkipRoot()
Fabiano Fidêncio [Wed, 18 Dec 2019 19:40:39 +0000 (20:40 +0100)]
util: Remove virFileSkipRoot()

The function is no longer used since commit faf2d811f3e9a4.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agodocs: Only distribute sanlock manpage if WITH_SANLOCK
Cole Robinson [Wed, 18 Dec 2019 19:46:16 +0000 (14:46 -0500)]
docs: Only distribute sanlock manpage if WITH_SANLOCK

This fixes mingw-libvirt RPM build

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
5 years agoutil: Simplify Windows version of virGetUserDirectoryByUID()
Fabiano Fidêncio [Tue, 17 Dec 2019 21:44:12 +0000 (22:44 +0100)]
util: Simplify Windows version of virGetUserDirectoryByUID()

Let's just use the plain g_get_home_dir(), from GLib, instead of
maintaining a code adapted from the GLib's one.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agonews.xml: add address type='unassigned' entry
Daniel Henrique Barboza [Tue, 17 Dec 2019 20:35:05 +0000 (17:35 -0300)]
news.xml: add address type='unassigned' entry

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoformatdomain.html.in: document <address type='unassigned'/>
Daniel Henrique Barboza [Tue, 17 Dec 2019 20:35:04 +0000 (17:35 -0300)]
formatdomain.html.in: document <address type='unassigned'/>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: handle unassigned PCI hostdevs in command line
Daniel Henrique Barboza [Tue, 17 Dec 2019 20:35:03 +0000 (17:35 -0300)]
qemu: handle unassigned PCI hostdevs in command line

Previous patch made it possible for the QEMU driver to check if
a given PCI hostdev is unassigned, by checking if dev->info->type is
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED, meaning that this device
shouldn't be part of the actual guest launch.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoIntroducing new address type='unassigned' for PCI hostdevs
Daniel Henrique Barboza [Tue, 17 Dec 2019 20:35:02 +0000 (17:35 -0300)]
Introducing new address type='unassigned' for PCI hostdevs

This patch introduces a new PCI hostdev address type called
'unassigned'. This new type gives users the option to add
PCI hostdevs to the domain XML in an 'unassigned' state, meaning
that the device exists in the domain, is managed by Libvirt
like any regular PCI hostdev, but the guest does not have
access to it.

This adds extra options for managing PCI device binding
inside Libvirt, for example, making all the managed PCI hostdevs
declared in the domain XML to be detached from the host and bind
to the chosen driver and, at the same time, allowing just a
subset of these devices to be usable by the guest.

Next patch will use this new address type in the QEMU driver to
avoid adding unassigned devices to the QEMU launch command line.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: command: move validation of vmcoreinfo to qemu_domain.c
Daniel Henrique Barboza [Wed, 18 Dec 2019 00:36:03 +0000 (21:36 -0300)]
qemu: command: move validation of vmcoreinfo to qemu_domain.c

Move the validation of vmcoreinfo from qemuBuildVMCoreInfoCommandLine()
to qemuDomainDefValidateFeatures(), allowing for validation
at domain define time.

qemuxml2xmltest.c was changed to account for this caps being
now validated at this earlier stage.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: command: move qemuBuildSmartcardCommandLine validation to qemu_domain.c
Daniel Henrique Barboza [Wed, 18 Dec 2019 00:36:02 +0000 (21:36 -0300)]
qemu: command: move qemuBuildSmartcardCommandLine validation to qemu_domain.c

Move smartcard validation being done by qemuBuildSmartcardCommandLine()
to the existing qemuDomainSmartcardDefValidate() function. This
function is called by qemuDomainDeviceDefValidate(), allowing smartcard
validation in domain define time.

Tests were adapted to consider the new caps being needed in
this earlier stage.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: command: move qemuBuildGraphicsEGLHeadlessCommandLine validation to qemu_domain.c
Daniel Henrique Barboza [Wed, 18 Dec 2019 00:36:01 +0000 (21:36 -0300)]
qemu: command: move qemuBuildGraphicsEGLHeadlessCommandLine validation to qemu_domain.c

Move EGL Headless validation from qemuBuildGraphicsEGLHeadlessCommandLine()
to qemuDomainDeviceDefValidateGraphics(). This function is called by
qemuDomainDefValidate(), validating the graphics parameters in domain
define time.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: command: move NVDIMM validation to qemu_domain.c
Daniel Henrique Barboza [Wed, 18 Dec 2019 00:36:00 +0000 (21:36 -0300)]
qemu: command: move NVDIMM validation to qemu_domain.c

Move the NVDIMM validation from qemuBuildMachineCommandLine()
to a new function in qemu_domain.c, qemuDomainDeviceDefValidateMemory(),
which is called by qemuDomainDeviceDefValidate(). This allows
NVDIMM validation to occur in domain define time.

It also increments memory hotplug validation, which can be seen
by the failures in the hotplug tests in qemuxml2xmltest.c that
needed to be adjusted after the move.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoutil: Rewrite virGetUserRuntimeDirectory() using g_get_user_runtime_dir()
Fabiano Fidêncio [Tue, 17 Dec 2019 15:42:09 +0000 (16:42 +0100)]
util: Rewrite virGetUserRuntimeDirectory() using g_get_user_runtime_dir()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoutil: Rewrite virGetUserCacheDirectory() using g_get_user_cache_dir()
Fabiano Fidêncio [Tue, 17 Dec 2019 15:34:28 +0000 (16:34 +0100)]
util: Rewrite virGetUserCacheDirectory() using g_get_user_cache_dir()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoutil: Rewrite virGetUserConfigDirectory() using g_get_user_config_dir()
Fabiano Fidêncio [Tue, 17 Dec 2019 15:31:11 +0000 (16:31 +0100)]
util: Rewrite virGetUserConfigDirectory() using g_get_user_config_dir()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoutil: Rewrite virGetUserDirectory() using g_get_home_dir()
Fabiano Fidêncio [Tue, 17 Dec 2019 15:24:38 +0000 (16:24 +0100)]
util: Rewrite virGetUserDirectory() using g_get_home_dir()

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agoconf: fix populating of fake NUMA in multi-node hosts
Daniel P. Berrangé [Wed, 18 Dec 2019 11:31:53 +0000 (06:31 -0500)]
conf: fix populating of fake NUMA in multi-node hosts

If the host OS doesn't have NUMA present, we fallback to
populating fake NUMA info and the code thus assumes only a
single NUMA node.

Unfortunately we also fallback to fake NUMA if numactl-devel
was not present, and in this case we can still have multiple
NUMA nodes. In this case we create all CPUs, but only the
CPUs in the first node have any data filled in, resulting in
capabilities like:

    <topology>
      <cells num='1'>
        <cell id='0'>
          <memory unit='KiB'>15977572</memory>
          <cpus num='48'>
            <cpu id='0' socket_id='0' core_id='0' siblings='0'/>
            <cpu id='1' socket_id='0' core_id='0' siblings='1'/>
            <cpu id='2' socket_id='0' core_id='1' siblings='2'/>
            <cpu id='3' socket_id='0' core_id='1' siblings='3'/>
            <cpu id='4' socket_id='0' core_id='2' siblings='4'/>
            <cpu id='5' socket_id='0' core_id='2' siblings='5'/>
            <cpu id='6' socket_id='0' core_id='3' siblings='6'/>
            <cpu id='7' socket_id='0' core_id='3' siblings='7'/>
            <cpu id='8' socket_id='0' core_id='4' siblings='8'/>
            <cpu id='9' socket_id='0' core_id='4' siblings='9'/>
            <cpu id='10' socket_id='0' core_id='5' siblings='10'/>
            <cpu id='11' socket_id='0' core_id='5' siblings='11'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
            <cpu id='0'/>
          </cpus>
        </cell>
      </cells>
    </topology>

With this new code we get something slightly less broken

    <topology>
      <cells num='4'>
        <cell id='0'>
          <memory unit='KiB'>15977572</memory>
          <cpus num='12'>
            <cpu id='0' socket_id='0' core_id='0' siblings='0-1'/>
            <cpu id='1' socket_id='0' core_id='0' siblings='0-1'/>
            <cpu id='2' socket_id='0' core_id='1' siblings='2-3'/>
            <cpu id='3' socket_id='0' core_id='1' siblings='2-3'/>
            <cpu id='4' socket_id='0' core_id='2' siblings='4-5'/>
            <cpu id='5' socket_id='0' core_id='2' siblings='4-5'/>
            <cpu id='6' socket_id='0' core_id='3' siblings='6-7'/>
            <cpu id='7' socket_id='0' core_id='3' siblings='6-7'/>
            <cpu id='8' socket_id='0' core_id='4' siblings='8-9'/>
            <cpu id='9' socket_id='0' core_id='4' siblings='8-9'/>
            <cpu id='10' socket_id='0' core_id='5' siblings='10-11'/>
            <cpu id='11' socket_id='0' core_id='5' siblings='10-11'/>
          </cpus>
        </cell>
        <cell id='0'>
          <memory unit='KiB'>15977572</memory>
          <cpus num='12'>
            <cpu id='12' socket_id='0' core_id='0' siblings='12-13'/>
            <cpu id='13' socket_id='0' core_id='0' siblings='12-13'/>
            <cpu id='14' socket_id='0' core_id='1' siblings='14-15'/>
            <cpu id='15' socket_id='0' core_id='1' siblings='14-15'/>
            <cpu id='16' socket_id='0' core_id='2' siblings='16-17'/>
            <cpu id='17' socket_id='0' core_id='2' siblings='16-17'/>
            <cpu id='18' socket_id='0' core_id='3' siblings='18-19'/>
            <cpu id='19' socket_id='0' core_id='3' siblings='18-19'/>
            <cpu id='20' socket_id='0' core_id='4' siblings='20-21'/>
            <cpu id='21' socket_id='0' core_id='4' siblings='20-21'/>
            <cpu id='22' socket_id='0' core_id='5' siblings='22-23'/>
            <cpu id='23' socket_id='0' core_id='5' siblings='22-23'/>
          </cpus>
        </cell>
      </cells>
    </topology>

The topology at least now reflects what 'virsh nodeinfo' reports.
The main bug is that the CPU "id" values won't match what the Linux
host actually uses.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoconf: avoid mem leak re-allocating fake NUMA capabilities
Daniel P. Berrangé [Tue, 17 Dec 2019 16:29:03 +0000 (11:29 -0500)]
conf: avoid mem leak re-allocating fake NUMA capabilities

The 'caps' object is already allocated when the fake NUMA
initialization takes place.

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu_command: tidy up qemuBuildHostdevCommandLine loop
Daniel Henrique Barboza [Wed, 18 Dec 2019 09:28:39 +0000 (06:28 -0300)]
qemu_command: tidy up qemuBuildHostdevCommandLine loop

The current 'for' loop with 5 consecutive 'ifs' inside
qemuBuildHostdevCommandLine can be a bit smarter:

- all 5 'ifs' fails if hostdev->mode is not equal to
VIR_DOMAIN_HOSTDEV_MODE_SUBSYS. This check can be moved to the
start of the loop, failing to the next element immediately
in case it fails;

- all 5 'ifs' checks for a specific subsys->type to build the proper
command line argument (virHostdevIsSCSIDevice and virHostdevIsMdevDevice
do that but within a helper). Problem is that the code will keep
checking for matches even if one was already found, and there is
no way a hostdev will fit more than one 'if' (i.e. a hostdev can't
have 2+ different types). This means that a SUBSYS_TYPE_USB will
create its command line argument in the first 'if', then all other
conditionals will surely fail but will end up being checked anyway.

All of this can be avoided by moving the hostdev->mode comparing
to the start of the loop and using a switch statement with
subsys->type to execute the proper code for a given hostdev
type.

Suggested-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoevent: add API for requiring an event loop impl to be registered
Daniel P. Berrangé [Thu, 23 May 2019 10:51:48 +0000 (11:51 +0100)]
event: add API for requiring an event loop impl to be registered

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoaccess: report an error if no access manager is present
Daniel P. Berrangé [Fri, 17 May 2019 11:28:27 +0000 (12:28 +0100)]
access: report an error if no access manager is present

The code calling this method expects it to have reported an error on
failure.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agoqemu: Don't leak hostcpu or hostnuma on driver cleanup
Michal Privoznik [Tue, 17 Dec 2019 18:34:41 +0000 (19:34 +0100)]
qemu: Don't leak hostcpu or hostnuma on driver cleanup

When freeing qemu driver struct members, we forgot to free
@hostcpu and @hostnuma members.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agoqemu: Reorder cleanup in qemuStateCleanup()
Michal Privoznik [Wed, 18 Dec 2019 05:39:09 +0000 (06:39 +0100)]
qemu: Reorder cleanup in qemuStateCleanup()

This function is supposed to clean up virQEMUDriver structure and
free individual members. However, it's doing that in random order
which makes it hard to track which members are being freed and
which are not. Do the free in reverse order than the structure
definition - assuming that the most important members (like
mutex) are declared first and freed last.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agovirCapabilitiesHostNUMAUnref: Accept NULL
Michal Privoznik [Wed, 18 Dec 2019 06:40:17 +0000 (07:40 +0100)]
virCapabilitiesHostNUMAUnref: Accept NULL

Fortunately, this is not causing any problems now because glib
does this check for us when calling this function via attribute
cleanup. But in a future commit we will explicitly call this
function over a struct member that might be NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agotestutilsxen: Avoid double free of driver caps
Michal Privoznik [Wed, 11 Dec 2019 09:17:30 +0000 (10:17 +0100)]
testutilsxen: Avoid double free of driver caps

In testXLInitDriver() a dummy driver structure is filled and it
is freed later in testXLFreeDriver(). However, it is sufficient
to unref just driver->config because that results in
libxlDriverConfigDispose() being called which unrefs
driver->config->caps. There is no need to unref it again in
testXLFreeDriver() - in fact it's undesired.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agodomaincapstest: Don't leak cpu definitions
Michal Privoznik [Wed, 11 Dec 2019 09:13:15 +0000 (10:13 +0100)]
domaincapstest: Don't leak cpu definitions

When generating domain capabilities, we need to fake host CPU to
get reproducible result. We do this by copying a pre-existent CPU
config and setting VIR_TEST_MOCK_FAKE_HOST_CPU env variable which
is then consumed by qemucpumock. However, we forget to free the
CPU copy afterwards.

 2,196 (2,016 direct, 180 indirect) bytes in 18 blocks are definitely lost in loss record 291 of 297
    at 0x4838B86: calloc (vg_replace_malloc.c:762)
    by 0x57CB6A0: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.6000.7)
    by 0x4A0F72D: virCPUDefNew (cpu_conf.c:87)
    by 0x4A0FAC7: virCPUDefCopyWithoutModel (cpu_conf.c:235)
    by 0x4A0FBBE: virCPUDefCopy (cpu_conf.c:273)
    by 0x10E3C0: testUtilsHostCpusGetDefForArch (testutilshostcpus.h:157)
    by 0x10E3C0: fakeHostCPU (domaincapstest.c:61)
    by 0x10E3C0: fillQemuCaps (domaincapstest.c:86)
    by 0x10E3C0: test_virDomainCapsFormat (domaincapstest.c:234)
    by 0x10F4BC: virTestRun (testutils.c:146)
    by 0x10DE93: doTestQemuInternal (domaincapstest.c:301)
    by 0x10E13D: doTestQemu (domaincapstest.c:332)
    by 0x1124CF: testQemuCapsIterate (testutilsqemu.c:635)
    by 0x10DCE3: mymain (domaincapstest.c:435)
    by 0x10FD8B: virTestMain (testutils.c:916)

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
5 years agosrc: warn against virNodeGetInfo() API call due to inaccurate info
Daniel P. Berrangé [Mon, 16 Dec 2019 10:35:50 +0000 (10:35 +0000)]
src: warn against virNodeGetInfo() API call due to inaccurate info

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
5 years agotest: qemucaps: Refresh x86_64 caps probe data for the qemu-4.2 release
Peter Krempa [Wed, 18 Dec 2019 08:48:00 +0000 (09:48 +0100)]
test: qemucaps: Refresh x86_64 caps probe data for the qemu-4.2 release

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
5 years agokbase: Add document outlining backing chain XML config and troubleshooting
Peter Krempa [Tue, 17 Dec 2019 17:50:18 +0000 (18:50 +0100)]
kbase: Add document outlining backing chain XML config and troubleshooting

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoutil: storage: Don't treat files with missing backing store format as 'raw'
Peter Krempa [Tue, 17 Dec 2019 16:04:04 +0000 (17:04 +0100)]
util: storage: Don't treat files with missing backing store format as 'raw'

Assuming that the backing image format is raw is wrong when doing image
detection:

1) In -drive mode qemu will still probe the image format of the backing
   image. This means it will try to open a backing file of the image
   which will fail if a more advanced security model is in use.

2) In blockdev mode the image will be opened as raw actually which is
   wrong since it might be qcow. Not opening the backing images will
   also end up in the guest seeing corrupted data.

Rather than attempt to solve various corner cases when us assuming the
storage file being raw and actually being right forbid startup when the
guest image doesn't have the format specified in the metadata.

https://bugzilla.redhat.com/show_bug.cgi?id=1588373

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: storage: Remove unused test modes
Peter Krempa [Tue, 17 Dec 2019 16:49:36 +0000 (17:49 +0100)]
tests: storage: Remove unused test modes

EXP_WARN and ALLOW_PROBE flags for the testStorageChain cases are no
longer used so we can remove them.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agotests: storage: Use strict version of virStorageFileGetMetadata
Peter Krempa [Tue, 17 Dec 2019 16:46:18 +0000 (17:46 +0100)]
tests: storage: Use strict version of virStorageFileGetMetadata

Pass in 'true' as '@report_broken' of virStorageFileGetMetadata to make
it fail in the tests. The most important code paths (when starting the
VM) expect this function to fail rather than silently return partial
data. Switch the test to exercise this more important code path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoqemu: homogenize MAC address in live & config when hotplugging a netdev
Laine Stump [Tue, 17 Dec 2019 15:24:00 +0000 (10:24 -0500)]
qemu: homogenize MAC address in live & config when hotplugging a netdev

Prior to commit 55ce6564634 (first in libvirt 4.6.0), the XML sent to
virDomainAttachDeviceFlags() was parsed only once, and the results of
that parse were inserted into both the live object of the running
domain and into the persistent config. Thus, if MAC address was
omitted from in XML for a network device (<interface>), both the live
and config object would have the same MAC address.

Commit 55ce6564634 changed the code to parse the incoming XML twice -
once for live and once for config. This does eliminate the problem of
PCI (/scsi/sata) address conflicts caused by allocating an address
based on existing devices in live object, but then inserting the
result into the config (which may already have a device using that
address), BUT it also means that when the MAC address of a network
device hasn't been specified in the XML, each copy will get a
different auto-generated MAC address.

This results in the MAC address of the device changing the next time
the domain is shutdown and restarted, which creates havoc with the
guest OS's network config.

There have been several discussions about this in the last > 1 year,
attempting to find the ideal solution to this problem that makes MAC
addresses consistent and accounts for all sorts of corner cases with
PCI/scsi/sata addresses. All of these discussions fizzled out because
every proposal was either too difficult to implement or failed to fix
some esoteric case someone thought up.

So, in the interest of solving the MAC address problem while not
making the "other address" situation any worse than before, this patch
simply adds a qemuDomainAttachDeviceLiveAndConfigHomogenize() function
that (for now) copies the MAC address from the config object to the
live object (if the original xml had <mac address='blah'/> then this
will be an effective NOP (as the macs already match)).

Any downstream libvirt containing upstream commit
55ce6564634 should have this patch as well.

https://bugzilla.redhat.com/1783411

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
5 years agoget_nonnull_domain: Drop useless comment
Michal Privoznik [Tue, 3 Dec 2019 17:11:32 +0000 (18:11 +0100)]
get_nonnull_domain: Drop useless comment

The intent of get_nonnull_domain() is not to validate virDomain
as sent by the client but just to construct the virDomain
structure. The validation is then done in each API when looking
up the domain in our internal hash tables.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agolxc: Cleanup virConnectPtr usage
Michal Privoznik [Wed, 4 Dec 2019 08:08:17 +0000 (09:08 +0100)]
lxc: Cleanup virConnectPtr usage

There are some functions which pass virConnectPtr around for one
reason and one reason only: to obtain virLXCDriverPtr in the end.
Might replace the argument and pass a pointer to the driver right
from the start.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
5 years agolibxlGetDHCPInterfaces: Switch to GLib
Michal Privoznik [Wed, 4 Dec 2019 09:26:58 +0000 (10:26 +0100)]
libxlGetDHCPInterfaces: Switch to GLib

If we use glib alloc functions, we can drop the 'cleanup' label
and @rv variable and also simplify the code a bit.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>