]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
10 years agostorage: Add duplicate source pool for Gluster pool def
John Ferlan [Thu, 2 Apr 2015 16:48:04 +0000 (12:48 -0400)]
storage: Add duplicate source pool for Gluster pool def

Check the proposed pool source host XML definition against existing gluster
pools to ensure the incoming definition doesn't use the same source dir and
soure host XML definition as an existing pool.

10 years agostorage: Add duplicate host check for Sheepdog pool def
John Ferlan [Thu, 2 Apr 2015 16:46:00 +0000 (12:46 -0400)]
storage: Add duplicate host check for Sheepdog pool def

Check the proposed pool source host XML definition against existing sheepdog
pools to ensure the incoming definition doesn't use the same source host XML
definition as an existing pool.

10 years agostorage: Remove default from switch in virStoragePoolSourceFindDuplicate
John Ferlan [Thu, 2 Apr 2015 16:39:27 +0000 (12:39 -0400)]
storage: Remove default from switch in virStoragePoolSourceFindDuplicate

So that we can cover all the cases.

10 years agostorage: Use virStoragePoolSourceMatchSingleHost for NETFS
John Ferlan [Wed, 1 Apr 2015 18:09:05 +0000 (14:09 -0400)]
storage: Use virStoragePoolSourceMatchSingleHost for NETFS

Rather than have duplicate code doing the same check, have the netfs
matching processing code use the new virStoragePoolSourceMatchSingleHost.

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agostorage: Add check for different ports for host duplicate matching
John Ferlan [Mon, 13 Apr 2015 21:11:53 +0000 (17:11 -0400)]
storage: Add check for different ports for host duplicate matching

In virStoragePoolSourceMatchSingleHost, add a comparison for port number
being different prior to checking the 'name' field.

10 years agostorage: Create virStoragePoolSourceMatchSingleHost
John Ferlan [Wed, 1 Apr 2015 18:05:54 +0000 (14:05 -0400)]
storage: Create virStoragePoolSourceMatchSingleHost

Split out the nhost == 1 and hosts[0].name logic into a separate routine

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agostorage: Refactor iSCSI Source matching
John Ferlan [Mon, 30 Mar 2015 23:59:26 +0000 (19:59 -0400)]
storage: Refactor iSCSI Source matching

Create a separate iSCSI Source matching subroutine. Makes the calling
code a bit cleaner as well as sets up for future patches which need to
do better source hosts[0].name processing/checking.

As part of the effort the logic will be inverted from a multi-level
if statement to a series of single level checks for better readability
and further separation

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agosanlock: Use VIR_ERR_RESOURCE_BUSY if sanlock_acquire fails
Jiri Denemark [Tue, 14 Apr 2015 14:27:37 +0000 (16:27 +0200)]
sanlock: Use VIR_ERR_RESOURCE_BUSY if sanlock_acquire fails

When acquiring resource via sanlock fails, we would report it as
VIR_ERR_INTERNAL_ERROR, which is not very friendly to applications using
libvirt. Moreover, the lockd driver would report the same failure as
VIR_ERR_RESOURCE_BUSY, which looks better.

Unfortunately, in sanlock driver we don't really know if acquiring the
resource failed because it was already locked or there was another
reason behind. But the end result is the same and I think using
VIR_ERR_RESOURCE_BUSY reason for all acquire failures is still better
than what we have now.

https://bugzilla.redhat.com/show_bug.cgi?id=1165119
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
10 years agobuild: provide virNetDevSysfsFile on non-Linux
Eric Blake [Tue, 14 Apr 2015 19:53:04 +0000 (13:53 -0600)]
build: provide virNetDevSysfsFile on non-Linux

Commit 49ed6cff is broken on mingw and other non-linux platforms:

  CCLD     libvirt.la
  Cannot export virNetDevSysfsFile: symbol not defined
  collect2: error: ld returned 1 exit status

* src/util/virnetdev.c: Provide virNetDevSysfsFile fallback.

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agobuild: include correct header for time()
Eric Blake [Tue, 14 Apr 2015 19:15:06 +0000 (13:15 -0600)]
build: include correct header for time()

Found by ./autobuild.sh during a mingw cross-compile:

Commit 8a96e87 was not innocuous - glibc happens to leak the
definition of time() through other headers, so that even without
<sys/select.h>, virrandom.c compiled just fine.  But on mingw,
we were not so lucky; <sys/select.h> was important for its side
effect of dragging in <time.h>, and we now have nothing providing
the declaration of time():

../../src/util/virrandom.c: In function 'virRandomOnceInit':
../../src/util/virrandom.c:65:5: error: implicit declaration of function 'time' [-Werror=implicit-function-declaration]
     unsigned int seed = time(NULL) ^ getpid();
          ^
  ../../src/util/virrandom.c:65:5: error: nested extern declaration of 'time' [-Werror=nested-externs]

Signed-off-by: Eric Blake <eblake@redhat.com>
10 years agoIntroduce virnetdevtest
Michal Privoznik [Wed, 11 Jun 2014 13:05:00 +0000 (15:05 +0200)]
Introduce virnetdevtest

This is yet another test for check of basic functionality of our
NIC state handling code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agocfg: Disallow usage of 'index' as variable name
John Ferlan [Tue, 14 Apr 2015 11:37:41 +0000 (07:37 -0400)]
cfg: Disallow usage of 'index' as variable name

Since we've run afoul of the Xen-devel build for shadowing a global
declaration of 'index', just disallow using index for a variable name

10 years agonwfilter: Change 'index' to 'idx'
John Ferlan [Tue, 14 Apr 2015 11:36:23 +0000 (07:36 -0400)]
nwfilter: Change 'index' to 'idx'

Forthcoming syntax check rule will disallow usage of 'int index', so
change it for nwfilter

10 years agosnapshot: Change 'index' to 'idx'
John Ferlan [Tue, 14 Apr 2015 11:35:29 +0000 (07:35 -0400)]
snapshot: Change 'index' to 'idx'

Forthcoming syntax check rule will disallow usage of 'int index', so
change it for snapshot

10 years agoutil: Use 'idx' instead of 'index'
John Ferlan [Tue, 14 Apr 2015 11:34:24 +0000 (07:34 -0400)]
util: Use 'idx' instead of 'index'

Impending syntax checker will disallow 'int index', so change it here.

10 years agoqemu: Adjust the prototype to match the function
John Ferlan [Tue, 14 Apr 2015 11:28:57 +0000 (07:28 -0400)]
qemu: Adjust the prototype to match the function

Changing the prototype to not have "int *index" since we'll soon be
disallowing index as a name. Curiously the original commit (a4504ac)
for the function used 'int idx' in the function - so they didn't match.
Now they do.

10 years agoAdd articles to virDomainDeviceDetachFlags docs
Ján Tomko [Tue, 14 Apr 2015 13:29:15 +0000 (15:29 +0200)]
Add articles to virDomainDeviceDetachFlags docs

Reported by John Ferlan.

10 years agoxen: fix build error on rhel-5
Pavel Hrdina [Tue, 14 Apr 2015 12:41:56 +0000 (14:41 +0200)]
xen: fix build error on rhel-5

../../src/xen/block_stats.c:82: warning: dereferencing type-punned
    pointer will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
10 years agosparc: Add default PCI root controller
Martin Kletzander [Thu, 9 Apr 2015 08:38:28 +0000 (10:38 +0200)]
sparc: Add default PCI root controller

It is there even with -nodefaults and -no-user-config, so count with
that so we can start sparc domains.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
10 years agohostdev: fix loop index error when resetvfnetconfig
Huanle Han [Thu, 2 Apr 2015 15:56:19 +0000 (23:56 +0800)]
hostdev: fix loop index error when resetvfnetconfig

The variable 'last_processed_hostdev_vf' indicates index of the last
successfully configed vf. When resetvfnetconfig because of failure,
hostdevs[last_processed_hostdev_vf] should also be reset.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
10 years agoqemu: fix index error when clean up vport profile
Huanle Han [Tue, 7 Apr 2015 18:40:15 +0000 (02:40 +0800)]
qemu: fix index error when clean up vport profile

1. 'last_good_net' indicates the index of last successfully configured
net. so def->nets[last_good_net] should also be clean up if error occurs.

2. if error occurs in 'virNetDevMacVLanVPortProfileRegisterCallback'
(second 'goto err_exit' in loop), we should also do
'virNetDevVPortProfileDisassociate' cleanup for the
'virNetDevVPortProfileAssociate'(first code block in loop). So we should
consider the net is successfully configured after first code block in
loop finishes.

Signed-off-by: Huanle Han <hanxueluo@gmail.com>
10 years agovirt-aa-helper: add unix channels (esp for qemu-guest-agent)
Serge Hallyn [Fri, 10 Apr 2015 20:21:03 +0000 (20:21 +0000)]
virt-aa-helper: add unix channels (esp for qemu-guest-agent)

The original bug report was at
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1393842

Also skip abstract unix sockets.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoqemu: save domain status after set memory parameters
Shanzhi Yu [Tue, 14 Apr 2015 10:24:41 +0000 (18:24 +0800)]
qemu: save domain status after set memory parameters

After set memory parameters for running domain, save the change to live
xml is needed otherwise it will disappear after restart libvirtd.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211548
Signed-off-by: Shanzhi Yu <shyu@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agovirsh: improve the error for wrong memtune parameters
Shanzhi Yu [Tue, 14 Apr 2015 10:24:40 +0000 (18:24 +0800)]
virsh: improve the error for wrong memtune parameters

When set guest memory with a invalid parameter of --soft-limit,
it posts weird error:

$ virsh memtune r7 --hard-limit 20417224 --soft-limit 9007199254740992 \
  --swap-hard-limit 35417224
error: Unable to parse integer parameter 'NAME

Change it to

error: Unable to parse integer parameter soft-limit

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211550
Signed-off-by: Shanzhi Yu <shyu@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoqemu: Use 'idx' instead of 'index' for variable name
John Ferlan [Tue, 14 Apr 2015 10:41:09 +0000 (06:41 -0400)]
qemu: Use 'idx' instead of 'index' for variable name

Apparently for Xen-devel 'index' is a global and causes a build failure,
so just use the shortened 'idx' instead to avoid the conflict.

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agoqemu: Refactor qemuDomainBlockJobAbort()
Peter Krempa [Wed, 1 Apr 2015 17:17:11 +0000 (19:17 +0200)]
qemu: Refactor qemuDomainBlockJobAbort()

Change few variable names and refactor the code flow. As an additional
bonus the function now fails if the event state is not as expected.

10 years agoqemu: drivePivot: Fix assumption when 'block-job-complete' fails
Peter Krempa [Wed, 1 Apr 2015 17:00:20 +0000 (19:00 +0200)]
qemu: drivePivot: Fix assumption when 'block-job-complete' fails

QEMU does not abandon the mirror. The job carries on in the synchronised
phase and it might be either pivoted again or cancelled. The commit
hints that the described behavior was happening in a downstream version.

If the command returns false there are two possible options:
1) qemu did not reach the point where it would ask the block job to
pivot
2) pivotting failed in the actual qemu coroutine

If either of those would happen we return failure and reset the
condition that waits for the block job to complete. This makes the API
fail but in case where qemu would actually abandon the mirror the fact
is notified via the event and handled asynchronously.

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

10 years agoqemu: blockPull: Refactor the rest of qemuDomainBlockJobImpl
Peter Krempa [Wed, 1 Apr 2015 09:45:35 +0000 (11:45 +0200)]
qemu: blockPull: Refactor the rest of qemuDomainBlockJobImpl

Since it now handles only block pull code paths we can refactor it and
remove tons of cruft.

10 years agoqemu: blockjob: Separate qemuDomainBlockJobAbort from qemuDomainBlockJobImpl
Peter Krempa [Wed, 1 Apr 2015 08:40:06 +0000 (10:40 +0200)]
qemu: blockjob: Separate qemuDomainBlockJobAbort from qemuDomainBlockJobImpl

Sacrifice a few lines of code in favor of the code being more readable.

10 years agoqemu: blockjob: Split qemuDomainBlockJobSetSpeed from qemuDomainBlockJobImpl
Peter Krempa [Wed, 1 Apr 2015 07:47:04 +0000 (09:47 +0200)]
qemu: blockjob: Split qemuDomainBlockJobSetSpeed from qemuDomainBlockJobImpl

qemuDomainBlockJobImpl become an unmaintainable mess over the years of
adding new stuff to it. This patch starts splitting up individual
functions from it until it can be killed entirely.

In bulk this will add lines of code rather than delete them but it will
be traded for maintainability.

10 years agoqemu: monitor: Extract handling of JSON block job error codes
Peter Krempa [Tue, 31 Mar 2015 15:13:21 +0000 (17:13 +0200)]
qemu: monitor: Extract handling of JSON block job error codes

My intention is to split qemuMonitorJSONBlockJob() into simpler separate
functions for every block job type. Since the error handling code is the
same for all block jobs, this patch extracts the code into a separate
function that will later be reused in more places.

With the new helper qemuMonitorJSONErrorIsClass we can save a few
function calls as we can extract the error object once.

10 years agoqemu: monitor: json: Refactor error code class checker
Peter Krempa [Thu, 9 Apr 2015 09:26:43 +0000 (11:26 +0200)]
qemu: monitor: json: Refactor error code class checker

Split out the function that checks the actual error class string into a
separate helper as it will be useful later and refactor
qemuMonitorJSONHasError to return bool type and remove few useless
checks.

Basically virJSONValueObjectHasKey are useless here since the next call
to virJSONValueObjectGet is checking the return value again (which can't
fail at that point). By removing the first check we save a function
call.

10 years agoqemu: Fix condition for checking vcpu when pinning vcpus
Peter Krempa [Tue, 7 Apr 2015 18:44:15 +0000 (20:44 +0200)]
qemu: Fix condition for checking vcpu when pinning vcpus

Previously we checked that the vcpu we are trying to set is in range of
the number of threads presented by qemu. The problem is that if the VM
is offline the count is 0. Since the condition subtracted 1 from the
count the number would overflow and the check would never trigger.

Change the condition for more sensible ones with specific error
messages.

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

10 years agoconf: Refactor virDomainVcpuPinDefParseXML
Peter Krempa [Tue, 7 Apr 2015 18:09:04 +0000 (20:09 +0200)]
conf: Refactor virDomainVcpuPinDefParseXML

Refactor the code to parse the vcpupin in a similar way the iothreadpin
code is now structured. This allows to get rid of some very strange
conditions and error messages.

Additionally since a existing bug
( https://bugzilla.redhat.com/show_bug.cgi?id=1208434 ) allows to add
vcpupin definitions for vcpus that don't exist, this patch makes the
parser to ignore all vcpupins that don't have a matching vCPU in the
definition rather than just offlined ones.

10 years agoconf: Error out if iothread id is missing in iothreadpin
Peter Krempa [Tue, 7 Apr 2015 17:52:02 +0000 (19:52 +0200)]
conf: Error out if iothread id is missing in iothreadpin

Defining a domain with the following config:

<domain ...>
  ...
  <iothreads>1</iothreads>
  <cputune>
    <iothreadpin cpuset='1'/>

will result in the following config formatted back:
<domain type='kvm'>
  ...
  <iothreads>1</iothreads>
  <cputune>
    <iothreadpin iothread='0' cpuset='1'/>

After restart the VM would vanish. Since our schema requires the
@iothread field to be present in <iothreadpin> make it required by the
code too.

10 years agoconf: Split up virDomainVcpuPinDefParseXML
Peter Krempa [Tue, 7 Apr 2015 15:44:12 +0000 (17:44 +0200)]
conf: Split up virDomainVcpuPinDefParseXML

Extract part that parses iothreads into virDomainIothreadPinDefParseXML

10 years agoconf: Split out parsing of emulatorpin
Peter Krempa [Tue, 7 Apr 2015 15:13:07 +0000 (17:13 +0200)]
conf: Split out parsing of emulatorpin

Split up parts of virDomainVcpuPinDefParseXML into
virDomainEmulatorPinDefParseXML.

10 years agolib: snapshot: Explain that only one layer of images is inserted
Peter Krempa [Fri, 10 Apr 2015 08:48:34 +0000 (10:48 +0200)]
lib: snapshot: Explain that only one layer of images is inserted

When creating a snapshot with _REUSE_EXTERNAL when the pre-created image
does not directly link to the current active layer libvirt would
re-detect the backing chain incorrectly and it would not match with
qemu's view. Since the configuration is an operator mistake, document
that only the top layer image gets inserted.

10 years agoqemu: Enforce WWN to be unique among VM's disks
Peter Krempa [Tue, 7 Apr 2015 14:08:32 +0000 (16:08 +0200)]
qemu: Enforce WWN to be unique among VM's disks

Operating systems use the identifier to name the disks. As the name
suggests the ID should be unique.

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

10 years agoconf: ABI: Check WWN in disk abi stability check
Peter Krempa [Tue, 7 Apr 2015 14:00:16 +0000 (16:00 +0200)]
conf: ABI: Check WWN in disk abi stability check

Since the WWN influences guest behavior in naming disks we should treat
this as vm ABI.

10 years agoConvert virDomainPinIsDuplicate into bool return
John Ferlan [Fri, 3 Apr 2015 10:57:32 +0000 (06:57 -0400)]
Convert virDomainPinIsDuplicate into bool return

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agoRename qemuCheckIothreads to qemuCheckIOThreads
John Ferlan [Fri, 3 Apr 2015 00:00:46 +0000 (20:00 -0400)]
Rename qemuCheckIothreads to qemuCheckIOThreads

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agoRewrite vshParseCPUList
Ján Tomko [Wed, 1 Apr 2015 16:46:56 +0000 (18:46 +0200)]
Rewrite vshParseCPUList

Use virBitmap helpers that were added after this function.

Change cpumaplen to int and fill it out by this function.

10 years agoRewrite vshPrintPinInfo
Ján Tomko [Thu, 26 Mar 2015 14:24:09 +0000 (15:24 +0100)]
Rewrite vshPrintPinInfo

Use virBitmapDataToString instead of constructing the ranges bit
by bit, remove the checking of parameters (that is already done
by the callers).

Let the callers choose the right bitmap, since there's only
one that uses this helper on a matrix-in-an-array.

10 years agoParallels: implemented domainAttachDevice
Alexander Burluka [Thu, 9 Apr 2015 10:42:00 +0000 (13:42 +0300)]
Parallels: implemented domainAttachDevice

That function uses domainAttachDeviceFlags

Signed-off-by: Alexander Burluka <aburluka@parallels.com>
10 years agoParallels: implement domainAttachDeviceFlags
Alexander Burluka [Mon, 13 Apr 2015 14:55:27 +0000 (17:55 +0300)]
Parallels: implement domainAttachDeviceFlags

Parallels Cloud Server supports block devices and virtual NIC
live attachment. I implemented that function for block devices so
OpenStack volume attachment is now works.

Signed-off-by: Alexander Burluka <aburluka@parallels.com>
10 years agoParallels: remove disk serial number check
Alexander Burluka [Thu, 9 Apr 2015 10:42:00 +0000 (13:42 +0300)]
Parallels: remove disk serial number check

OpenStack needs disk serial number setup because
nova boot --block-device-mapping command generates that param in
libvirt xml. I took QEMU libvirt driver behavior as a base.
QEMU driver skips inability to set serial and continues work.
So Parallels driver will ignore this param too and let domain
boot.

10 years agoRemove overengineered loop
Ján Tomko [Fri, 10 Apr 2015 12:28:41 +0000 (14:28 +0200)]
Remove overengineered loop

Do not loop over enum with one value.

10 years agoIntroduce struct _virStorageBackendQemuImgInfo
Ján Tomko [Thu, 31 Jul 2014 16:07:56 +0000 (18:07 +0200)]
Introduce struct _virStorageBackendQemuImgInfo

This will contain the data required for creating the qemu-img
command line without having access to the volume definition.

10 years agoRename virStorageBackendCreateQemuImgCmd
Ján Tomko [Thu, 31 Jul 2014 16:08:33 +0000 (18:08 +0200)]
Rename virStorageBackendCreateQemuImgCmd

Add FromVol at the end. This function will create the qemu-img
command line from volume definitions and check them.

10 years agoUse XPath when parsing snapshot disk definition
Ján Tomko [Fri, 10 Apr 2015 09:55:43 +0000 (11:55 +0200)]
Use XPath when parsing snapshot disk definition

Instead of going through XML nodes in a loop and
having to check if they are duplicate.

10 years agoSplit out storage format 'compat' attribute sanity check
Ján Tomko [Thu, 9 Apr 2015 08:48:49 +0000 (10:48 +0200)]
Split out storage format 'compat' attribute sanity check

For future reuse in the snapshot XML.

10 years agovirBitmap: Place virBitmapIsAllClear check after virBitmapParse calls
Erik Skultety [Fri, 10 Apr 2015 09:11:21 +0000 (11:11 +0200)]
virBitmap: Place virBitmapIsAllClear check after virBitmapParse calls

This patch adds checks for empty bitmaps right after the calls of
virBitmapParse. These only include spots where set API's are called and
where domain's XML is parsed.
Also, it partially reverts commit 983f5a which added a check for
invalid nodeset "0,^0" into virBitmapParse function. This change broke
the logic, as an empty bitmap should not cause an error.

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

10 years agoRemove feature formating funcs from pool-specific options
Ján Tomko [Thu, 9 Apr 2015 12:02:53 +0000 (14:02 +0200)]
Remove feature formating funcs from pool-specific options

We only have one formatting function for the features.

10 years agoVisually separate snapshot disk subelements
Ján Tomko [Fri, 10 Apr 2015 12:25:37 +0000 (14:25 +0200)]
Visually separate snapshot disk subelements

Create four smaller blocks of texts instead of one large one.

10 years agoRewrite usb device version parsing
Ján Tomko [Fri, 10 Apr 2015 13:50:53 +0000 (15:50 +0200)]
Rewrite usb device version parsing

Simplify the function by leaving out the local copy and checking
return values of virStrToLong.

10 years agoFix usb device version parsing issues
Ján Tomko [Fri, 10 Apr 2015 13:49:42 +0000 (15:49 +0200)]
Fix usb device version parsing issues

Request that the number be parsed as decimal, to allow 08
and 09.

Format it with the leading zero, 1.01 and 1.10 are two
different versions.

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

10 years agoDo xml->xml test for usb-redir-filter
Ján Tomko [Fri, 10 Apr 2015 13:03:07 +0000 (15:03 +0200)]
Do xml->xml test for usb-redir-filter

We don't format the default '-1' fields back.

10 years agoDo not require virtio-pci devices when using virtio-mmio
Ján Tomko [Fri, 10 Apr 2015 09:22:05 +0000 (11:22 +0200)]
Do not require virtio-pci devices when using virtio-mmio

On arm, we probe for virtio-*-pci devices, but use their
virtio-*-device variants.

Set the capabilities based on the -device variants as well,
to make them work with qemus with the PCI devices compiled out.

10 years agoqemuMigrationPrecreateStorage: Fix debug message
Michal Privoznik [Thu, 2 Apr 2015 14:34:01 +0000 (16:34 +0200)]
qemuMigrationPrecreateStorage: Fix debug message

When pre-creating storage for domains, we need to find corresponding
disk in the XML on the destination (domain XML may differ there, e.g.
disk is accessible under different path). For better debugging, I'm
printing all info I received on a disk. But there was a typo when
printing the disk capacity: "%lluu" instead of "%llu".

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoqemu_migration.c: sleep first before checking for migration status.
Xing Lin [Thu, 9 Apr 2015 22:02:02 +0000 (16:02 -0600)]
qemu_migration.c: sleep first before checking for migration status.

The problem with the previous implementation is,
even when qemuMigrationUpdateJobStatus() detects a migration job
has completed, it will do a sleep for 50 ms (which is unnecessary
and only adds up to the VM pause time).

Signed-off-by: Xing Lin <xinglin@cs.utah.edu>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoconf: Don't output <cpu> tag if it contains no information.
Andrea Bolognani [Fri, 10 Apr 2015 13:09:59 +0000 (15:09 +0200)]
conf: Don't output <cpu> tag if it contains no information.

The tag is already marked as optional in the schema, so no changes
are needed there.

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

10 years agoqemu: qemuDomainHotplugVcpus - separate out pin adjustment code
John Ferlan [Wed, 8 Apr 2015 13:25:47 +0000 (09:25 -0400)]
qemu: qemuDomainHotplugVcpus - separate out pin adjustment code

Future IOThread setting patches would copy the code anyway, so create
and generalize the adding of pindef for the vcpu and the pinning of the
thread into their own APIs.

10 years agoAUTHORS: Add my email address to AUTHORS.in
Dmitry Guryanov [Fri, 10 Apr 2015 15:26:00 +0000 (18:26 +0300)]
AUTHORS: Add my email address to AUTHORS.in

10 years agoSupport IPv6 in networkGetNetworkAddress
Ján Tomko [Wed, 8 Apr 2015 14:36:42 +0000 (16:36 +0200)]
Support IPv6 in networkGetNetworkAddress

We've been explicitly requesting IPv4 for some reason,
even if there were only IPv6 addresses in the network
definition.

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

10 years agoutil: Update virNetDevGetIPAddress to get IPv6 addresses
Luyao Huang [Tue, 10 Mar 2015 00:04:58 +0000 (20:04 -0400)]
util: Update virNetDevGetIPAddress to get IPv6 addresses

Add static virNetDevGetifaddrsAddress to attempt to get the interface
IP address. If getifaddrs is not supported, fall back to
virNetDevGetIPv4AddressIoctl to get the IP address.

This allows IPv6 addresses to be used for <listen type='network>
with device-backed networks.

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

Signed-off-by: Luyao Huang <lhuang@redhat.com>
Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoutil: Replace virNetDevGetIPv4Address with virNetDevGetIPAddress
John Ferlan [Tue, 10 Mar 2015 00:04:57 +0000 (20:04 -0400)]
util: Replace virNetDevGetIPv4Address with virNetDevGetIPAddress

Rename it to virNetDevGetIPv4AddressIoctl and make
virNetDevGetIPAddress a wrapper around it, allowing
other ways of getting the address to be implemented,
and still falling back to the old method.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
10 years agoparallels: fix virDomainDefineXML for domain in saved state
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:13 +0000 (23:35 +0300)]
parallels: fix virDomainDefineXML for domain in saved state

PCS doesn't store domain config in managed save state file.
It's forbidden to change config for VMs in this state.
It's possible to change config for containers, but after
restoring domain will have that new config, not a config,
which domain had at the moment of virDomainManagedSave.

So we need to handle this case differently from other states.
Let's forbid this operation, if config is changed and if it's
not changed - just do nothing.

Openstack/nova calls virDomainDefineXML on resume with
current domain config, so we can't forbid this operation
in managed save state.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoconf: fix virDomainDefFormatInternal for parallels
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:12 +0000 (23:35 +0300)]
conf: fix virDomainDefFormatInternal for parallels

We should add input devices with proper bus,
not VIR_DOMAIN_INPUT_BUS_XEN.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoconf: fix virDomainDefParseXML for parallels
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:11 +0000 (23:35 +0300)]
conf: fix virDomainDefParseXML for parallels

Handle input devices in virDomainDefParseXML properly
in case of parallels containers and VMs.

Parallels containers support only
VIR_DOMAIN_INPUT_BUS_PARALLELS. And if VNC is enabled
we should add implicit mouse and keyboard.

For VMs we should add implicit PS/2 mouse and
keyboard.

BTW, is it worth to refactor code and move
all this code to drivers, to *DomainDefPostParse
functions?

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
10 years agoparallels: add implicit input devices
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:10 +0000 (23:35 +0300)]
parallels: add implicit input devices

Add implicit input devices in parallelsLoadDomains,
when VNC is enabled.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoconf: add input device type for parallels containers
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:09 +0000 (23:35 +0300)]
conf: add input device type for parallels containers

Add VIR_DOMAIN_INPUT_BUS_PARALLELS device type
to handle domain configuration properly for
parallels containers, when VNC is enabled.

When domain configuration has at least one
'graphics', there should be mouse and keyboard.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoconf: return proper default video type for parallels
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:08 +0000 (23:35 +0300)]
conf: return proper default video type for parallels

Fix function virDomainVideoDefaultType for
parallels VMs and containers. It should return
VGA for VMs and VIR_DOMAIN_VIDEO_TYPE_PARALLELS
for containers.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoconf: add VIR_DOMAIN_VIDEO_TYPE_PARALLELS video type
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:07 +0000 (23:35 +0300)]
conf: add VIR_DOMAIN_VIDEO_TYPE_PARALLELS video type

We support VNC for containers to have the same
interface with VMs. At this moment it just renders
linux text console.

Of course we don't pass any physical devices and
don't emulate virtual devices. Our VNC server
renders text from terminal master and sends
input events from VNC client to terminal.

So add special video type VIR_DOMAIN_VIDEO_TYPE_PARALLELS
for these pseudo-devices.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: don't fill net adapter model for containers
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:06 +0000 (23:35 +0300)]
parallels: don't fill net adapter model for containers

Network adapter model has no sense for container,
so we shouldn't set it to e1000 in
parallelsDomainDeviceDefPostParse.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: fill adapter model in virDomainNetDef
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:05 +0000 (23:35 +0300)]
parallels: fill adapter model in virDomainNetDef

We handle this parameter for VMs while defining
domains, so let's get this property from PCS and
set corresponding field of virDomainNetDef in
prlsdkLoadDomains function.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: add controllers in prlsdkLoadDomain
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:04 +0000 (23:35 +0300)]
parallels: add controllers in prlsdkLoadDomain

Call virDomainDefAddImplicitControllers to add disk
controllers, so virDomainDef, filled by this function
will look exactly like the one returned by virDomainDefParseString.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: report, that cdroms are readonly
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:03 +0000 (23:35 +0300)]
parallels: report, that cdroms are readonly

Set readonly flag for cdrom devices when we
retrieve a list of domains from PCS.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: implement virDomainManagedSave
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:02 +0000 (23:35 +0300)]
parallels: implement virDomainManagedSave

Implement virDomainManagedSave api function. In PCS
this feature called "suspend". You can suspend VM or
CT while it is in running or paused state. And after
resuming (or starting) it will have the same state, as
before suspend.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: split prlsdkDomainChangeState function
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:01 +0000 (23:35 +0300)]
parallels: split prlsdkDomainChangeState function

Split function prlsdkDomainChangeState into
prlsdkDomainChangeStateLocked and prlsdkDomainChangeState.
So it can be used from places, where virDomainObj already
found and locked.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoparallels: fix headers in parallels_sdk.h
Dmitry Guryanov [Tue, 7 Apr 2015 20:35:00 +0000 (23:35 +0300)]
parallels: fix headers in parallels_sdk.h

Return value of functions prlsdkStart/Kill/Stop e.t.c.
is PRL_RESULT in parallels_sdk.c and int in parallels_sdk.h.
PRL_RESULT is int, so compiler didn't report errors.
Let's fix the difference.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
10 years agoqemu: qemuDomainHotplugVcpus - separate out the del cgroup and pin
John Ferlan [Thu, 19 Mar 2015 13:46:09 +0000 (09:46 -0400)]
qemu: qemuDomainHotplugVcpus - separate out the del cgroup and pin

Future IOThread setting patches would copy the code anyway, so create
and generalize a delete cgroup and pindef for the vcpu into its own API.

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agoqemu: qemuDomainHotplugVcpus - separate out the add cgroup
John Ferlan [Thu, 19 Mar 2015 12:28:14 +0000 (08:28 -0400)]
qemu: qemuDomainHotplugVcpus - separate out the add cgroup

Future IOThread setting patches would copy the code anyway, so create
and generalize the add the vcpu to a cgroup into its own API.

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agocgroup: Use virCgroupNewThread
John Ferlan [Tue, 7 Apr 2015 12:53:35 +0000 (08:53 -0400)]
cgroup: Use virCgroupNewThread

Replace the virCgroupNew{Vcpu|Emulator|IOThread} calls with the common
virCgroupNewThread API

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agocgroup: Introduce virCgroupNewThread
John Ferlan [Tue, 7 Apr 2015 12:28:05 +0000 (08:28 -0400)]
cgroup: Introduce virCgroupNewThread

Create a new common API to replace the virCgroupNew{Vcpu|Emulator|IOThread}
API's using an emum to generate the cgroup name

Signed-off-by: John Ferlan <jferlan@redhat.com>
10 years agostorage: Don't duplicate efforts of backend driver
John Ferlan [Fri, 27 Mar 2015 15:19:54 +0000 (11:19 -0400)]
storage: Don't duplicate efforts of backend driver

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

If the backend driver updates the pool available and/or allocation values,
then the storage_driver VolCreateXML, VolCreateXMLFrom, and VolDelete APIs
should not change the value; otherwise, it will appear as if the values
were "doubled" for each change.  Additionally since unsigned arithmetic will
be used depending on the size and operation, either or both values could be
appear to be much larger than they should be (in the EiB range).

Currently only the disk pool updates the values, but other pools could.
Assume a "fresh" disk pool of 500 MiB using /dev/sde:

$ virsh pool-info disk-pool
...
Capacity:       509.88 MiB
Allocation:     0.00 B
Available:      509.84 MiB

$ virsh vol-create-as disk-pool sde1 --capacity 300M

$ virsh pool-info disk-pool
...
Capacity:       509.88 MiB
Allocation:     600.47 MiB
Available:      16.00 EiB

Following assumes disk backend updated to refresh the disk pool at deletion
of primary partition as well as extended partition:

$ virsh vol-delete --pool disk-pool sde1
Vol sde1 deleted

$ virsh pool-info disk-pool
...
Capacity:       509.88 MiB
Allocation:     9.73 EiB
Available:      6.27 EiB

This patch will check if the backend updated the pool values and honor that
update.

10 years agostorage: Need to update freeExtent at delete primary partition
John Ferlan [Fri, 27 Mar 2015 15:04:22 +0000 (11:04 -0400)]
storage: Need to update freeExtent at delete primary partition

Commit id '471e1c4e' only considered updating the pool if the extended
partition was removed. As it turns out removing a primary partition
would also need to update the freeExtent list otherwise the following
sequence would fail (assuming a "fresh" disk pool for /dev/sde of 500M):

$  virsh pool-info disk-pool
...
Capacity:       509.88 MiB
Allocation:     0.00 B
Available:      509.84 MiB

$ virsh vol-create-as disk-pool sde1 --capacity 300M
$ virsh vol-delete --pool disk-pool sde1
$ virsh vol-create-as disk-pool sde1 --capacity 300M
error: Failed to create vol sde1
error: internal error: no large enough free extent

$

This patch will refresh the pool, rereading the partitions, and
return

10 years agostorage: Fix issues in storageVolResize
John Ferlan [Fri, 27 Mar 2015 13:48:59 +0000 (09:48 -0400)]
storage: Fix issues in storageVolResize

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

When creating a volume in a pool, the creation allows the 'capacity'
value to be larger than the available space in the pool. As long as
the 'allocation' value will fit in the space, the volume will be created.

However, resizing the volume checks were made with the new absolute
capacity value against existing capacity + the available space without
regard for whether the new absolute capacity was actually allocating
space or not.  For example, a pool with 75G of available space creates
a volume of 10G using a capacity of 100G and allocation of 10G will succeed;
however, if the allocation used a capacity of 10G instead and then tried
to resize the allocation to 100G the code would fail to allow the backend
to try the resize.

Furthermore, when updating the pool "available" and "allocation" values,
the resize code would just "blindly" adjust them regardless of whether
space was "allocated" or just "capacity" was being adjusted.  This left
a scenario whereby a resize to 100G would fail; however, a resize to 50G
followed by one to 100G would both succeed.  Again, neither was adjusting
the allocation value, just the "capacity" value.

This patch adds more logic to the resize code to understand whether the
new capacity value is actually "allocating" space as well and whether it
shrinking or expanding. Since unsigned arithmatic is involved, the possibility
that we adjust the pool size values incorrectly is probable.

This patch also ensures that updates to the pool values only occur if we
actually performed the allocation.

NB: The storageVolDelete, storageVolCreateXML, and storageVolCreateXMLFrom
each only updates the pool allocation/availability values by the target
volume allocation value.

10 years agoqemu: Avoid shadow of 'sync' symbol
Peter Krempa [Thu, 9 Apr 2015 13:36:26 +0000 (15:36 +0200)]
qemu: Avoid shadow of 'sync' symbol

Old compilers whine that 'sync' is being shadowed in the function
introduced in 1eccac1d2da7bbe97e1df25fd0ddac6e71b0794a.

10 years agoqemu: blockPivot: Don't pause the VM any more since we don't use drive-reopen
Peter Krempa [Wed, 1 Apr 2015 08:13:34 +0000 (10:13 +0200)]
qemu: blockPivot: Don't pause the VM any more since we don't use drive-reopen

Support for drive-reopen was never present in the upstream code so we
don't need to pause the VM when doing the block pivot. Kill all the
code related to this semi-upstream artifact.

10 years agoqemu: Clean up old leftovers in qemuMonitorDrivePivot
Peter Krempa [Wed, 1 Apr 2015 08:06:55 +0000 (10:06 +0200)]
qemu: Clean up old leftovers in qemuMonitorDrivePivot

There are two leftover unused variables. Remove them and clean up the
fallout of the change.

10 years agoqemu: blockjob: Use the new helpers in qemuDomainGetBlockJobInfo
Peter Krempa [Wed, 1 Apr 2015 07:36:04 +0000 (09:36 +0200)]
qemu: blockjob: Use the new helpers in qemuDomainGetBlockJobInfo

Refactor the function to use the new helpers.

10 years agoqemu: domain: Add helper to check block job support
Peter Krempa [Tue, 31 Mar 2015 15:29:35 +0000 (17:29 +0200)]
qemu: domain: Add helper to check block job support

We need to check that qemu supports block jobs in multiple places. Add a
helper to do the check.

10 years agoqemu: domain: Introduce helper to retrieve domain monitor object
Peter Krempa [Tue, 31 Mar 2015 15:24:50 +0000 (17:24 +0200)]
qemu: domain: Introduce helper to retrieve domain monitor object

In some cases where the function does not need to access the private
data this helper may be used to retrieve the monitor object.

10 years agodoc: Add info (where necessary) that paths should be specified as absolute
Erik Skultety [Tue, 7 Apr 2015 10:46:13 +0000 (12:46 +0200)]
doc: Add info (where necessary) that paths should be specified as absolute

We documented this almost everywhere, but missed it on several places.

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

10 years agoOpen /proc/PID/ns/* read-only to avoid getting permission denied
Cédric Bosdonnat [Thu, 9 Apr 2015 07:22:43 +0000 (09:22 +0200)]
Open /proc/PID/ns/* read-only to avoid getting permission denied

lxc-enter-namespace stopped working on recent kernels (at least 3.19+)
due to /proc/PID/ns/* file descriptors being opened RW. From outside
the namespace these can only be opened RO.

10 years agoApparmor qemu abstraction fixes for SLES
Cédric Bosdonnat [Wed, 11 Mar 2015 10:09:40 +0000 (11:09 +0100)]
Apparmor qemu abstraction fixes for SLES

SLES 11 has legacy qemu-kvm package, /usr/bin/qemu-kvm and
/usr/share/qemu-kvm need to be accessed to domains.

10 years agolxc: create the required directories upon driver start
Lubomir Rintel [Wed, 8 Apr 2015 17:16:52 +0000 (19:16 +0200)]
lxc: create the required directories upon driver start

/var/run may reside on a tmpfs and we fail to create the PID file if
/var/run/lxc does not exist.

Since commit 0a8addc1, the lxc driver's state directory isn't
automatically created before starting a domain. Now, the lxc driver
makes sure the state directory exists when it initializes.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
10 years agoutil: file: Don't carelessly sanitize URIs
Peter Krempa [Wed, 8 Apr 2015 08:57:07 +0000 (10:57 +0200)]
util: file: Don't carelessly sanitize URIs

rfc3986 states that the separator in URI path is a single slash.
Multiple slashes may potentially lead to different resources and thus we
should not remove them.

10 years agotest: Add tests for virFileSanitizePath
Peter Krempa [Wed, 8 Apr 2015 08:27:30 +0000 (10:27 +0200)]
test: Add tests for virFileSanitizePath

Add test infrastructure for virFileSanitizePath so that it can be
sensibly refactored later.