Commit Graph

63 Commits

Author SHA1 Message Date
Maxim Nestratov
30ae685780 parallels: suppress console output from parallels SDK
It is necessary to have unpolluted screen when connecting to
parallels driver via virsh.
Otherwise a lot of unexpected output one will get on the console.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-05-28 12:58:44 +03:00
Maxim Nestratov
55714f78c4 parallels: fix possible crash in case of errors in prlsdkLoadDomain
Cleanup code in prlsdkLoadDomain doesn't take into account the fact
if private domain structure along with freeing function is assigned
or not. In case it is, we shouldn't call it manually because
virDomainObjListRemove calls it and frees pdom.
Also, allocated def structure should be freed only if it's not
assigned to domain. Otherwise it will be called twice: one time by
virDomainObjListRemove and the second by prlsdkLoadDomain itself.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-05-26 00:11:13 +03:00
Maxim Nestratov
dc58e7424a parallels: move up updating parameter in prlsdkLoadDomain
It is better to get all necessary parameters and check them on newly
created configuration before actually creating a domain with them or
applying them to an existing domain.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-05-26 00:11:07 +03:00
Michal Privoznik
bcd9a564b6 virDomainNumatuneGetMode: Report if numatune was defined
So far, we are not reporting if numatune was even defined. The
value of zero is blindly returned (which maps onto
VIR_DOMAIN_NUMATUNE_MEM_STRICT). Unfortunately, we are making
decisions based on this value. Instead, we should not only return
the correct value, but report to the caller if the value is valid
at all.

For better viewing of this patch use '-w'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-05-20 14:02:25 +02:00
Jiri Denemark
890fa6a055 Add privateData to virDomainDiskDef
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-05-15 08:04:26 +02:00
Nikolay Shirokovskiy
2f1f28885a parallels: remove connection wide wait timeout
We have a lot of passing arguments code just to pass connection
object cause it holds jobTimeout. Taking into account that
right now this value is defined at compile time let's just
get rid of it and make arguments list more clear in many
places.

In case we later need some runtime configurable timeout
value we can provide this value through arguments
function already operate such as a parallels domain
object etc as this timeouts are operation( and thus
object) specific in practice.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com>
2015-05-13 18:41:55 +03:00
Maxim Nestratov
18f24c65d5 parallels: implement domainDetachDevice and domainDetachDeviceFlags
New functions utilize previosly added prlsdkDelDisk and prlsdkGetDiskIndex
Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-04-28 19:00:53 +03:00
Maxim Nestratov
0d20195e53 parallels: add prlsdkDelDisk and prlsdkGetDiskIndex functions
Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-04-28 18:58:48 +03:00
Maxim Nestratov
62d1814614 parallels: fix crash in prlsdkAddNet in case of CT definition
Since net->model is not defined for containers we shouldn't touch it.
In case network adapter model is defined, a warning about ignoring
it is shown.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-04-24 21:38:54 +03:00
Michal Privoznik
85cbe869f9 parallels_sdk: Utilize parallelsDomObjFromDomain()
Instead of each API copying the same lines of code, lets use the
generic function designed just for that purpose.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-04-23 14:21:42 +02:00
Cole Robinson
5f7c599456 domain: Convert os.type to VIR_DOMAIN_OSTYPE enum 2015-04-20 16:40:09 -04:00
Nikolay Shirokovskiy
6b7b677a0e parallels: make device addressing consistent
In Parallels we do not support device name hints
aka <target dev=../> option and full-fledged device
disk device addressing through
<address type=.. controller=.. bus=.. target=.. unit=../>
and have only one index instead.
In this situation to be consistent we can only take
one-to-one mapping from some reasonable subset
of full address. Values outside this subset are
invalid to create Parallels VMs.

Reasonable mapping is default one defined in virDomainDiskDefAssignAddress.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@parallels.com>
2015-04-20 20:02:54 +03:00
Alexander Burluka
fcba57b2ec 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>
2015-04-13 17:55:27 +03:00
Alexander Burluka
92b54f1c4a 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.
2015-04-13 17:23:13 +03:00
Dmitry Guryanov
c0c3d4c8c9 parallels: add implicit input devices
Add implicit input devices in parallelsLoadDomains,
when VNC is enabled.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2015-04-10 09:50:30 +02:00
Dmitry Guryanov
0d572b6982 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>
2015-04-10 09:50:29 +02:00
Dmitry Guryanov
6a06b467f5 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>
2015-04-10 09:50:29 +02:00
Dmitry Guryanov
b204afa13e 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>
2015-04-10 09:50:29 +02:00
Dmitry Guryanov
66aee37530 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>
2015-04-10 09:50:29 +02:00
Dmitry Guryanov
8951ad86ce 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>
2015-04-10 09:50:29 +02:00
Dmitry Guryanov
233b799ddb 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>
2015-04-10 09:50:29 +02:00
Maxim Nestratov
9baf87bbc6 parallels: delete old networks in prlsdkDoApplyConfig before adding new ones
In order to change an existing domain we delete all existing devices and add
new from scratch. In case of network devices we should also delete corresponding
virtual networks (if any) before removing actual devices from xml. In the patch,
we do it by extending prlsdkDoApplyConfig with a new parameter, which stands for
old xml, and calling prlsdkDelNet every time old xml is specified.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-04-08 10:22:39 +02:00
Maxim Nestratov
c630b48006 parallels: don't prevent domain define if VIR_DOMAIN_NET_TYPE_BRIDGE
network adapter is used
2015-03-18 18:23:41 +01:00
Maxim Nestratov
ed043768a3 parallels: switch off offline management feature
which is on by default when a new VM/CT is created.
We should do this because this feature can't be controlled
by libvirt now and it sets up some iptables rules. So it's
better to do this to avoid potential conflict of different
set of rules or to avoid unexpected behavior.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-18 18:21:39 +01:00
Maxim Nestratov
5a9b01b36d parallels: make E1000 network adapter model default
and set adapter model specified in xml

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-18 18:16:17 +01:00
Maxim Nestratov
46f4a532d5 parallels: set correct network adapter link state
when a new network adapter device is added

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-18 18:09:15 +01:00
Maxim Nestratov
50e0a1bff8 parallels: better bridge network interface support
In order to support 'bridge' network adapters in parallels
driver we need to plug our veth devices into corresponding
linux bridges.
We are going to do this by reusing our abstraction of
Virtual Networks in terms of PCS. On a domain creation, we
create a new Virtual Network naming it with the same name
as a source bridge for each network  interface.
Having done this, we plug PCS veth interfaces created with names of
target dev into specified bridges using our standard PCS procedures

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-18 18:07:23 +01:00
Maxim Nestratov
20111b6fdf parallels: introduce and use string constants for network types and names
Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-18 17:35:21 +01:00
Maxim Nestratov
50bdad6678 parallels_sdk.c: minor cleanup
Fix indentation in prlsdkGetNetInf()o, remove unnecessary error
message in prlsdkDomainChangeState(), remove unnecessary job
freeing in prlsdkLoadDomains().

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-17 16:50:03 +01:00
Maxim Nestratov
b980c34dec parallels: fix home directory for VMs
Failures of parallelsStorageOpen occured because we incorrectly treated
path to VM' configuration file as a directory. Now initialization of
parallels VM domains home directory is fixed.

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-17 15:42:49 +01:00
Mikhail Feoktistov
7bf69e0208 parallels: set cpu mode when applying xml configuration
Otherwise exporting existing domain config and defining a new one like this:
virsh -c parallels:///system dumpxml instance01 > my.xml
virsh -c parallels:///system define my.xml
leads to an error because PCS default x64 mode turns to x32.
Thus, we need to set correct cpuMode in prlsdkDoApplyConfig() explicitly.

Signed-off-by: Mikhail Feoktistov <mfeoktistov@parallels.com>
Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-03-17 15:34:59 +01:00
Peter Krempa
4f9907cd11 conf: Replace access to def->mem.max_balloon with accessor functions
As there are two possible approaches to define a domain's memory size -
one used with legacy, non-NUMA VMs configured in the <memory> element
and per-node based approach on NUMA machines - the user needs to make
sure that both are specified correctly in the NUMA case.

To avoid this burden on the user I'd like to replace the NUMA case with
automatic totaling of the memory size. To achieve this I need to replace
direct access to the virDomainMemtune's 'max_balloon' field with
two separate getters depending on the desired size.

The two sizes are needed as:
1) Startup memory size doesn't include memory modules in some
hypervisors.
2) After startup these count as the usable memory size.

Note that the comments for the functions are future aware and document
state that will be present after a few later patches.
2015-03-16 14:26:51 +01:00
Maxim Nestratov
79265b9834 parallels: fix prlsdkCheckUnsupportedParams checks
for memory limits since unset ones are no longer zero

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-13 09:03:37 +01:00
Maxim Nestratov
0473e1bb16 parallels: prevent domain define only if vcpupin is specified
and their settings differ from common cpumask

Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-11 09:00:28 +01:00
Maxim Nestratov
3f2d67bbfa parallels: prevent domain define only if NUMA is really specified
Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-11 09:00:28 +01:00
Maxim Nestratov
a4e0f2343f parallels: cpumask support
Signed-off-by: Maxim Nestratov <mnestratov@parallels.com>
2015-03-11 08:24:42 +01:00
Yuri Chornoivan
8a833d1eb0 Fix typos in messages
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2015-02-25 14:12:51 +01:00
Peter Krempa
c03411199e conf: Allocate domain definition with the new helper
Use the virDomainDefNew() helper to allocate the definition instead of
doing it via VIR_ALLOC.
2015-02-20 17:43:05 +01:00
Peter Krempa
6bc80fa86d conf: numa: Rename virDomainNumatune to virDomainNuma
The structure will gradually become the only place for NUMA related
config, thus rename it appropriately.
2015-02-20 17:43:04 +01:00
Mikhail Feoktistov
675fa6b360 parallels: Set the first HDD from XML as bootable
1. Delete all boot devices for VM instance
2. Find the first HDD from XML and set it as bootable

Now we support only one boot device and it should be HDD.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-02-19 16:32:49 +01:00
Mikhail Feoktistov
6783cf63b0 parallels: Use IS_CT() macro instead of STREQ("exe") 2015-02-19 16:32:49 +01:00
Mikhail Feoktistov
0268eabd7d parallels: code aligment 2015-02-19 16:32:49 +01:00
Dmitry Guryanov
2bc460d3c1 parallels: create container from existing image
It's possible to create a container with existing
disk image as root filesystem. You need to remove
existing disks from PCS VM config and then add a new
one, pointing to your image. And then call PrlVm_RegEx
with PRNVM_PRESERVE_DISK flag.

With this patch you can create such container with
something like this for new domain XML config:

    <filesystem type='file' accessmode='passthrough'>
      <driver type='ploop' format='ploop'/>
      <source file='/path-to-image'/>
      <target dir='/'/>
    </filesystem>

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-01-16 14:07:47 +01:00
Dmitry Guryanov
aba95c287c parallels: allow to add filesystems to container
Handle information about filesystems in domain config
and add corresponding devices to container via
parallels sdk.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2015-01-16 14:07:47 +01:00
Dmitry Guryanov
d86f2aa336 parallels: commit with PVCF_DETACH_HDD_BUNDLE flag
PCS removes disk image from filesystem, if you remove it
from config. There is a special flag PVCF_DETACH_HDD_BUNDLE
which allow to remove disk only from VM/CT config.

If you call virDomainDefine and remove some disk from
config it should be preserved, so call PrlVm_CommitEx
always with flag PVCF_DETACH_HDD_BUNDLE.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2015-01-16 14:07:47 +01:00
Dmitry Guryanov
4bbd3b1e7e parallels: dump info about container filesystems
Obtain information about container's filesystems and
store it in virDomainDef structure.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-01-16 14:07:47 +01:00
Alexander Burluka
95170a3085 Parallels: Add VNC hostname setup
Add missing VNC setup via Parallels SDK.
Parallels Cloud Server starts one VNC server per domain,
so we could process only one VNC server definition.
Network-based listening currently is unimplemented.

Signed-off-by: Alexander Burluka <aburluka@parallels.com>
2015-01-07 09:58:18 +01:00
Dmitry Guryanov
7c6dbf3518 parallels: report, that cdrom image is raw
VIR_STORAGE_FILE_AUTO should be used only in xml provided to
libvirt by user, if I understood correctly. Driver should
set storage source format to specific disk format in
*DomainGetXMLDesc.

CDROMs in PCS use raw image format.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2014-12-23 15:13:13 +01:00
Dmitry Guryanov
dec21593e1 parallels: fix usage of disk->info.addr.drive structure
For SCSI and SATA devices controller and unit are used
to specify drive address. For IDE devices - bus specifies
IDE bus, becase usually there are 2 IDE buses on IDE
controller.

Parallels SDK allows to set drive position by calling
PrlVmDev_SetStackIndex. Since PCS VMs have only one
controller of each type, for SATA and SCSI devices it
simple means position on bus, for IDE devices -
2 * bus_number + position_on_bus.

This patch fixes mapping from libvirt's disk->info.addr.drive
to parallels's 'StackIndex'.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2014-12-15 17:20:45 +01:00
Dmitry Guryanov
87be10858f parallels: set format for real disk devices
It seems file format is usually specified event for
real block devices. So report that file format is
raw in virDomainGetXMLDesc and add checks for proper
file format to prlsdkAddDisk.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2014-12-15 17:20:44 +01:00