Commit Graph

23395 Commits

Author SHA1 Message Date
Ján Tomko
42b4a37d68 Use virDirOpenIfExists
Use it instead of opendir everywhere we need to check for ENOENT.
2016-06-24 14:20:57 +02:00
Ján Tomko
941ccbc174 Add virDirOpenIfExists
Just like virDirOpen, but it returns 0 without reporting an error
on ENOENT.
2016-06-24 14:20:57 +02:00
Ján Tomko
e81de04c10 Use virDirOpen
Switch from opendir to virDirOpen everywhere we need to report an error.
2016-06-24 14:20:57 +02:00
Ján Tomko
f0ced7086a Introduce virDirOpen
A helper that calls opendir and reports an error if it fails.
2016-06-24 14:20:57 +02:00
Cole Robinson
bdb868101b storage: Fix coverity warning
After commit e808d3f227 cbdata is always available here, so the
check is pointless
2016-06-24 07:31:47 -04:00
Martin Kletzander
428d2dfdb8 Don't allow raneming domains to empty strings
It may cause unwanted behaviour (of course, is there any wanted one for
that case?) so we should rather disable the possibility of doing so.

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

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-24 11:14:51 +02:00
Ján Tomko
16d77fc6b5 openvz: split single-line if
Put the 'continue' statement on a separate line.
2016-06-24 10:36:12 +02:00
Andrea Bolognani
3bf9d35bf6 qemu: Use stricter checks in virQEMUCapsFillDomainDeviceDiskCaps()
Unfortunately, we can't just call qemuDomainMachineIsPSeries()
here, because we don't have a virDomainDef instance; that said,
the open-coded check should match said function as closely as
possible.
2016-06-24 10:17:59 +02:00
Andrea Bolognani
177ecaa598 qemu: Introduce qemuDomainMachineIsPSeries()
This new function checks for both the architecture and the
machine type, so we can use it instead of writing the same
checks over and over again.
2016-06-24 10:17:59 +02:00
Andrea Bolognani
210acdb1a5 qemu: Add architecture checks to qemuDomainMachineIsVirt()
Remove all external architecture checks that have been
made redundant by this change.
2016-06-24 10:17:59 +02:00
Andrea Bolognani
0969b5051b qemu: Remove redundant arguments to qemuBuildSerialChrDeviceStr()
Since we're already passing the full virDomainDef, it doesn't
make sense to also pass def->os.arch and def->os.machine as
separate arguments.
2016-06-24 10:17:59 +02:00
Martin Pietsch
d0bef64334 Add support for VirtualBox 5 2016-06-24 09:26:06 +02:00
Ján Tomko
541bd183f7 Rename virNetClient*AddrString
Add SASL at the end to make the format obvious.
2016-06-23 22:31:20 +02:00
Ján Tomko
eaf7ff3873 Rename virNetServerClient*AddrString
Add SASL at the end to make the format obvious.
2016-06-23 22:23:21 +02:00
Ján Tomko
ea537e7b36 Add SASL to virNetSocket{Local,Remote}AddrString
Rename them to virNetSocket{Local,Remote}AddrStringSASL
to make their format more obvious.
2016-06-23 22:23:21 +02:00
Ján Tomko
dbce70b243 virNetSocket: rename AddrStr to AddrStrSASL
Make it more obvious that these are in the SASL format.
2016-06-23 22:23:21 +02:00
Ján Tomko
42362c9166 virnetsockettest: fix error messages 2016-06-23 22:23:21 +02:00
Ján Tomko
23b6559d65 Introduce virNetServerClientRemoteAddrStringURI
Use it in virNetServerClientGetInfo to switch back to using
the URI-format (separated by ':') instead of the SASL format
(separated by ';').

Also use it in the error message reported by virNetServerAddClient.
2016-06-23 22:23:02 +02:00
Ján Tomko
2da6a13e5f Introduce virNetSocketRemoteAddrStringURI
It will return the socket address and port in a URI-like
format: [::1]:1234
Add a test case to virnetsockettest.
2016-06-23 22:21:36 +02:00
Ján Tomko
0f7eeb20ad Revert "virnetsocket: Provide socket address format in a more standard form"
This partially reverts commit 9b45c9f049.

It changed the default format of socket address from the one SASL
requires, but did not adjust all the callers.

It also removed the test coverage for it.

Revert most of the changes except the virSocketAddrFormatFull support
for URI-formatted strings.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1345743 while
reverting the format used by virt-admin's client-info command from
the URI one to the SASL one.

https://bugzilla.redhat.com/show_bug.cgi?id=1345743
2016-06-23 22:15:06 +02:00
Ján Tomko
6d7ba87359 Do not skip files starting with a dot in leases directory
'.' and '..' are skipped by virDirRead already.
2016-06-23 21:58:38 +02:00
Ján Tomko
5217fe3db4 Allow configs to start with a dot
This fixes the disappearance of domains and networks starting with a
dot.

https://bugzilla.redhat.com/show_bug.cgi?id=1333248
2016-06-23 21:58:38 +02:00
Ján Tomko
dad2f010b0 Do not skip hidden entries when looking for a stable path
The device names are unlikely to start with a dot.
'.' and '..' are already skipped by virDirRead.
2016-06-23 21:58:38 +02:00
Ján Tomko
70a033ab42 Do not ignore hidden files in /sys and /proc
The directories we iterate over are unlikely to contain any entries
starting with a dot, other than '.' and '..' which is already skipped
by virDirRead.
2016-06-23 21:58:38 +02:00
Ján Tomko
852cd39830 Fix comment in virStorageBackendFileSystemRefresh
'.' and '..' are now skipped by virDirRead, there's no need to mention
them in the comment.
2016-06-23 21:58:38 +02:00
Ján Tomko
fe79c3f2c1 Do not check for '.' and '..' after virDirRead
It skips those directory entries.
2016-06-23 21:58:38 +02:00
Ján Tomko
7cecfba139 Skip '.' and '..' in virDirRead
All of the callers either skip these explicitly, skip all entries
starting with a dot or match the entry name against stricter patterns.
2016-06-23 21:58:38 +02:00
Ján Tomko
a4e6f1eb9c Introduce VIR_DIR_CLOSE
Introduce a helper that only calls closedir if DIR* is non-NULL
and sets it to NULL afterwards.
2016-06-23 21:58:33 +02:00
Ján Tomko
44f5b3f869 Do not check the return value of closedir
The only possible error is EBADFD.
Since we only use the directory stream returned by opendir,
this should never happen.
2016-06-23 21:57:45 +02:00
Ján Tomko
b914530d62 Do not save errno in virUSBDeviceSearch
The virUSBDeviceFind* callers do not check errno after calling
this function.
2016-06-23 21:37:32 +02:00
Peter Krempa
cb049b9ad4 tests: utils: Fail XML file comparison if input file doesn't exist
In cases where we expect parse failure of the test input file the
testsuite can't differentiate if the parser failed when parsing or when
opening the file. Add a call to virFileExists and error out on missing
input files.

Missing output files are partially expected when regenerating test
output.
2016-06-23 21:11:32 +02:00
Peter Krempa
dabf1c5b12 tests: genericxml2xml: Fix test file name
Commit b1fc6a7b added a test file but used a different name in the
actual test.
2016-06-23 21:11:32 +02:00
John Ferlan
dc428f450a qemu: Add new secret info type
Add 'encinfo' to the extended disk structure. This will contain the
encryption secret (if present).

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
42510c5199 util: Introduce virSecretLookupFormatSecret
Add utility to format the virSecretLookupTypeDefPtr in XML

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
ecd45ced0e util: Move and rename virStorageAuthDefParseSecret
Move to virsecret.c and rename to virSecretLookupParseSecret. Also convert
to usage xmlNodePtr and virXMLPropString rather than virXPathString.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:28 -04:00
John Ferlan
1eca5f6581 secret: Move virStorageSecretType and rename
Move the enum into a new src/util/virsecret.h, rename it to be
virSecretLookupType. Add a src/util/virsecret.h in order to perform
a couple of simple operations on the secret XML and virSecretLookupTypeDef
for clearing and copying.

This includes quite a bit of collateral damage, but the goal is to remove
the "virStorage*" and replace with the virSecretLookupType so that it's
easier to to add new lookups that aren't necessarily storage pool related.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-06-23 12:30:27 -04:00
Cole Robinson
e808d3f227 storage: Remove redundant refreshPool check
Every driver provides a refreshPool impl, and many other critical
places in the code unconditionally call it without checking if
it exists, so this check is pointless
2016-06-23 09:29:54 -04:00
Cole Robinson
7490fdec92 qemu: command: Error on accel2d
qemu doesn't have any accel2d support wired up. Explicitly error
if a user tries it out, or typos the accel3d option
2016-06-23 09:29:18 -04:00
Cole Robinson
9a4703a3f0 qemu: command: Error on accel3d with non-virtio
We should be raising an error if accel3d is present for any
non-virtio video as well, incase someone tries it for say 'qxl'
2016-06-23 09:29:18 -04:00
Nikolay Shirokovskiy
6606ea96a1 qemu: make monitor command API available during async jobs
One can not issue monitor commands manually during async calls thru
designated API while this could be useful for testing/debugging purposes.
qemuDomainQemuMonitorCommand uses job of type QEMU_JOB_MODIFY and any async
call disable parallel execution of this type of job. The only state that is
changed is taint variable. AFAIU the only place we can mess is resetting
taint flag in qemuProcessStop routine under some async job. But this can not
happen thanx to both virDomainObjIsActive check in qemuDomainQemuMonitorCommand
and resetting active status in qemuProcessStop before taint flag.

  Change job type to QEMU_JOB_QUERY and thus make the API call available for
most of async jobs.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-23 15:18:31 +02:00
Ján Tomko
43d2b6f2aa prohibit-duplicate-header: print file name and line
This way :make syntax-check in ViM will point you at the offending line.
2016-06-23 12:48:40 +02:00
Ján Tomko
a9179d78bf syntax-check: rewrite prohibit-duplicate-header in perl
Invoke the script only once instead of once for every file.
2016-06-23 12:48:40 +02:00
Peter Krempa
dfeb19ff60 Allow virDomain(SG)etGuestVcpus on read-write connection only
Guest agent interaction is considered privileged.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1349272
2016-06-23 09:41:52 +02:00
Ján Tomko
21b56a6055 Do not ignore perl scripts in build-aux
Also remove the duplicate build-aux entry from .gitignore.
2016-06-23 09:38:13 +02:00
Ján Tomko
8b04ce598d Add newDomain parameter to qemuDomainAssignAddresses
Pass 'true' if we are not dealing with a migration.
2016-06-23 07:45:31 +02:00
Ján Tomko
b3ee621e94 Add a USB hub to controller order test
The test has too many USB devices.
2016-06-23 07:45:31 +02:00
Cole Robinson
03ce132808 conf: Remove dead console compat formatting
This code was attempting to handle some implicit <console> XML
formatting for manually assembled DomainDef, since previously the
console<->serial compat copying was only done at XML parse time.

Nowadays it's done via virDomainDefPostParse ->
virDomainDefAddConsoleCompat, which all manual DomainDef builders
already call, so we can drop this workaround.
2016-06-22 20:14:31 -04:00
Jim Fehlig
76d5871648 libxl: use serial device for console when targetType is serial
When domXML contains only <console type='pty'> and no corresponding
<serial>, the console is "stolen" [1] and used as the first <serial>
device. When this "stolen" console is accessed from the libxl driver
(in libxlConsoleCallback and libxlDomainOpenConsole), check if the
targetType is VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL, and use the
"stolen" device in def->serials[0] instead. Prior to this change,
creating a domain with input XML containing only a <console> device
and subsequently attempting to access its console with
'virsh console' would fail

error: internal error: character device <null> is not using a PTY

[1] See comments associated with virDomainDefAddConsoleCompat() in
    $LIBVIRT-SRC/src/conf/domain_conf.c:
2016-06-22 15:06:27 -06:00
Ján Tomko
a921699ad9 Use for instead of code duplication when parsing USB port
We are done if the string ends and move to another nesting
level if we find a dot.
2016-06-22 21:33:57 +02:00
Ján Tomko
0956d9b2a3 Split out USB port parsing
Make rewriting it easier.
2016-06-22 21:33:57 +02:00