Commit Graph

472 Commits

Author SHA1 Message Date
Michal Privoznik
0d3d020ba6 virDomainInterfaceStats: Accept MAC address too
https://bugzilla.redhat.com/show_bug.cgi?id=1497396

The other APIs accept both, ifname and MAC address. There's no
reason virDomainInterfaceStats can't do the same.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-13 13:46:59 -07:00
Jiri Denemark
4fd179f518 cpu_conf: Drop updateCPU from virCPUDefFormat
In the past we updated host-model CPUs with host CPU data by adding a
model and features, but keeping the host-model mode. And since the CPU
model is not normally formatted for host-model CPU defs, we had to pass
the updateCPU flag to the formatting code to be able to properly output
updated host-model CPUs. Libvirt doesn't do this anymore, host-model
CPUs are turned into custom mode CPUs once updated with host CPU data
and thus there's no reason for keeping the hacks inside CPU XML
formatters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-09-21 15:23:39 +02:00
Jiri Denemark
abec725ab1 cpu: Drop cpuBaselineXML
The implementation of virConnectBaselineCPU may be different for each
hypervisor. Thus it shouldn't really be implmented in the cpu code.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-09-18 10:40:12 +02:00
Cole Robinson
ac87932ee3 conf: add virDomainVideoDefNew
To handle setting a default heads value. Convert callers that were
doing it by hand

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2017-08-27 09:38:12 -04:00
Nikolay Shirokovskiy
c22f02cfdf vz: build fix
6e6faf6d changed vzDomObjAlloc signature in source but not in header file.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2017-08-24 09:40:34 +02:00
Nikolay Shirokovskiy
f3cdbf22e3 vz: support disabled items in vz boot order
At the time the check was written virtuozzo did not use disabled items in boot
order configuration. Boot items were always enabled. Now they can be disabled
as well. Supporting such items is easy - they just should be ignored.
2017-08-23 09:03:27 -04:00
Pavel Hrdina
068606f85c use virXMLNodeNameEqual instead of xmlStrEqual
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-08-14 14:31:52 +02:00
Martin Kletzander
6e6faf6d62 conf: Pass config.priv to xmlopt->privateData.alloc
This will help us to get to some data more easily.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-07-25 17:02:27 +02:00
Daniel P. Berrange
d8f8c7a83d Remove network constants out of internal.h
The HOST_NAME_MAX, INET_ADDRSTRLEN and VIR_LOOPBACK_IPV4_ADDR
constants are only used by a handful of files, so are better
kept in virsocketaddr.h or the source file that uses them.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-07-11 13:57:11 +01:00
Mikhail Feoktistov
e007e764e1 vz: nseclabels member is moved to virDomainChrSourceDef struct 2017-06-29 16:55:39 +03:00
Mikhail Feoktistov
06db9ff037 vz: add argument xmlopt for virDomainDefCheckABIStability call 2017-06-29 16:55:39 +03:00
John Ferlan
2065499b60 events: Avoid double free possibility on remote call failure
If a remote call fails during event registration (more than likely from
a network failure or remote libvirtd restart timed just right), then when
calling the virObjectEventStateDeregisterID we don't want to call the
registered @freecb function because that breaks our contract that we
would only call it after succesfully returning.  If the @freecb routine
were called, it could result in a double free from properly coded
applications that free their opaque data on failure to register, as seen
in the following details:

    Program terminated with signal 6, Aborted.
    #0  0x00007fc45cba15d7 in raise
    #1  0x00007fc45cba2cc8 in abort
    #2  0x00007fc45cbe12f7 in __libc_message
    #3  0x00007fc45cbe86d3 in _int_free
    #4  0x00007fc45d8d292c in PyDict_Fini
    #5  0x00007fc45d94f46a in Py_Finalize
    #6  0x00007fc45d960735 in Py_Main
    #7  0x00007fc45cb8daf5 in __libc_start_main
    #8  0x0000000000400721 in _start

The double dereference of 'pyobj_cbData' is triggered in the following way:

    (1) libvirt_virConnectDomainEventRegisterAny is invoked.
    (2) the event is successfully added to the event callback list
        (virDomainEventStateRegisterClient in
        remoteConnectDomainEventRegisterAny returns 1 which means ok).
    (3) when function remoteConnectDomainEventRegisterAny is hit,
        network connection disconnected coincidently (or libvirtd is
        restarted) in the context of function 'call' then the connection
        is lost and the function 'call' failed, the branch
        virObjectEventStateDeregisterID is therefore taken.
    (4) 'pyobj_conn' is dereferenced the 1st time in
        libvirt_virConnectDomainEventFreeFunc.
    (5) 'pyobj_cbData' (refered to pyobj_conn) is dereferenced the
         2nd time in libvirt_virConnectDomainEventRegisterAny.
    (6) the double free error is triggered.

Resolve this by adding a @doFreeCb boolean in order to avoid calling the
freeCb in virObjectEventStateDeregisterID for any remote call failure in
a remoteConnect*EventRegister* API. For remoteConnect*EventDeregister* calls,
the passed value would be true indicating they should run the freecb if it
exists; whereas, it's false for the remote call failure path.

Patch based on the investigation and initial patch posted by
fangying <fangying1@huawei.com>.
2017-06-25 08:16:04 -04:00
Jiri Denemark
25af7e950a conf: Add save cookie callbacks to xmlopt
virDomainXMLOption gains driver specific callbacks for parsing and
formatting save cookies.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-07 13:36:01 +02:00
Jiri Denemark
957cd268a9 conf: Pass xmlopt to virDomainSnapshotDefFormat
This will be used later when a save cookie will become part of the
snapshot XML using new driver specific parser/formatter functions.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-07 13:36:01 +02:00
Michal Privoznik
4f0aeed871 virDomainXMLOption: Introduce virDomainABIStabilityDomain
While checking for ABI stability, drivers might pose additional
checks that are not valid for general case. For instance, qemu
driver might check some memory backing attributes because of how
qemu works. But those attributes may work well in other drivers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-06-05 09:08:52 +02:00
Konstantin Neumoin
f8912d0527 vz: minor cleanup in prlsdkDomainSetUserPassword
No need begin job for asynchronous operation.

Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
2017-05-24 11:29:39 +02:00
Konstantin Neumoin
af4b0ed03e vz: fix raise in vzDomainBlock
Put domain access after acquiring job condition, otherwise
another job can change it meanwhile.

Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-05-24 11:29:39 +02:00
Konstantin Neumoin
0c5d5cb959 vz: unlock dom until resize operation
We have to use waitDomainJob instead of waitJob, because of it
unlock the domain until job has finished, so domain will be available
for other clients.

Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
2017-05-24 11:29:39 +02:00
Jim Fehlig
975ea20f85 maint: define a macro for IPv4 loopback address
Use a macro instead of hardcoding "127.0.0.1" throughout the
sources.
2017-05-22 10:20:27 -06:00
Martin Kletzander
72e04d2800 Init host cache info in drivers
Added only in drivers that were already calling
virCapabilitiesInitNUMA().  Instead of refactoring all the callers to
behave the same way in case of error, just follow what the callers are
doing for all the functions.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-05-09 13:12:40 +02:00
Konstantin Neumoin
f99bc451fe vz: support virDomainBlockResize
Acked-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
2017-04-17 20:42:33 +03:00
Konstantin Neumoin
d678379df1 vz: support virDomainSetVcpus
Acked-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
2017-04-17 20:42:22 +03:00
Nikolay Shirokovskiy
609cc5a880 vz: fix typo that breaks build 2017-04-04 14:27:18 +02:00
Michal Privoznik
5683b21309 virGetDomain: Set domain ID too
So far our code is full of the following pattern:

  dom = virGetDomain(conn, name, uuid)
  if (dom)
      dom->id = 42;

There is no reasong why it couldn't be just:

  dom = virGetDomain(conn, name, uuid, id);

After all, client domain representation consists of tuple (name,
uuid, id).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-04-03 08:35:57 +02:00
Martin Kletzander
26ae4e482a Remove src/nodeinfo
There is no "node driver" as there was before, drivers have to do
their own ACL checking anyway, so they all specify their functions and
nodeinfo is basically just extending conf/capablities.  Hence moving
the code to src/conf/ is the right way to go.

Also that way we can de-duplicate some code that is in virsysfs and/or
virhostcpu that got duplicated during the virhostcpu.c split.  And
Some cleanup is done throughout the changes, like adding the vir*
prefix etc.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 13:13:29 +02:00
Martin Kletzander
ffb3f69448 vz: Do not use magic constants when building capabilities
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2017-03-27 13:13:29 +02:00
Jiri Denemark
79a78c13ec cpu: Add list of allowed CPU models to virCPUGetHost
When creating host CPU definition usable with a given emulator, the CPU
should not be defined using an unsupported CPU model. The new @models
and @nmodels parameters can be used to limit CPU models which can be
used in the result.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-13 23:49:57 +01:00
Jiri Denemark
5677b9b336 cpu: Add virCPUType parameter to virCPUGetHost
The parameter can be used to request either VIR_CPU_TYPE_HOST (which has
been assumed so far) or VIR_CPU_TYPE_GUEST definition.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-13 23:49:57 +01:00
Jiri Denemark
23a3f5f50c cpu: Replace cpuNodeData with virCPUGetHost
cpuNodeData has always been followed by cpuDecode as no hypervisor
driver is really interested in raw CPUID data for a host CPU. Let's
create a new CPU driver API which returns virCPUDefPtr directly.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-13 23:49:57 +01:00
Jiri Denemark
f6d55a5f42 cpu: Rework cpuDataFree
The new API is called virCPUDataFree. Individual CPU drivers are no
longer required to implement their own freeing function unless they need
to free architecture specific data from virCPUData.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-02-24 14:10:57 +01:00
Nikolay Shirokovskiy
0518aae304 vz: make more accurate closing connection to sdk
Current code for example can call unsubscribe if connection
succeeds but subscribing fails. This will probabaly lead
only to spurious error messages without any actual inconsistencies
but nevertheless.
2017-02-23 10:04:00 +01:00
Maxim Nestratov
eda4ec94ff vz: cleanup: remove unused constant
PARALLELS_STATISTICS_DROP_COUNT isn't used anymore

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2017-02-09 13:06:15 +03:00
Maxim Nestratov
c52f5bea0d vz: fix event handle leak in prlsdkHandlePerfEvent
When we happen to lose a domain but still get a performance event
for it, we should also free the event handle.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2017-02-09 13:06:15 +03:00
Maxim Nestratov
05456cc97e vz: fix handle leak in prlsdkHandleVmStateEvent
Every successful call of PrlEvent_GetParamByName allocates a handle,
which has to be freed.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2017-02-09 13:06:15 +03:00
Maxim Nestratov
99fb668ede vz: change printing format specifier for network statistics
This is necessary to be able to get statistics for venet0 or
"host-routed" adapter, which has -1 index and thus, its statistics
is shown as "net.nic4294967295".

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2017-01-31 17:05:20 +03:00
Nikolay Shirokovskiy
4ebb75c364 vz: support virDomainReset 2017-01-31 17:03:22 +03:00
Nikolay Shirokovskiy
48317abbf7 vz: support virDomainAbortJob 2017-01-31 17:02:26 +03:00
Nikolay Shirokovskiy
b66bf0730a vz: add state group to all domain stats 2017-01-30 19:44:13 +03:00
Nikolay Shirokovskiy
2a41a2301b vz: add balloon group to all domain stats 2017-01-30 19:44:13 +03:00
Nikolay Shirokovskiy
e15e94c2dd vz: add vcpu group to all domain stats 2017-01-30 19:44:13 +03:00
Nikolay Shirokovskiy
87f41f38e3 vz: add net group to all domain stats 2017-01-30 19:44:13 +03:00
Nikolay Shirokovskiy
0d5ca32e38 vz: provide block stats for all domain stats 2017-01-30 19:44:13 +03:00
Nikolay Shirokovskiy
9c10c03093 vz: don't show bootorder for containers
Because this is invalid xml for containers. This patch almost
reverts 7eda8369, but still skips converting vz sdk bootorder
for containers to libvirt bootorder because we use boot order
in containers for quite different purpurse.
2017-01-30 19:44:13 +03:00
Maxim Nestratov
e4aa80dfde vz: get disks statistics for CTs
A CT disk statistics is reported with prefix "hdd" and we should use
it to extract data.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-12-22 22:06:40 +03:00
Maxim Nestratov
7eda8369fc vz: set boot from disk for CT only when there is no root filesystem
Before, boot devices information for CTs was always empty and we
didn't indicate that containers can boot from disk.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-12-22 22:06:39 +03:00
Maxim Nestratov
8c9252aa6d vz: report disks either as disks or filesystems depending on original xml
Virtuozzo SDK interface doesn't differ filesystems from disks and sees them as disks.
Before, we always mistakenly presented disks based on files as filesystems, which is
not completely correct. Now we are going to show either disks or filesystems depending
on a hint, which uses boot device section of VZ config. Though this information
doesn't change booting order of a CT, it is used by vz libvirt interface as a hint
for libvirt representation of disks. Since now, if we have filesystems in input xml,
then we add them to VZ booting devices list and rely on this information to show
corresponding libvirt xml.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-12-22 22:06:39 +03:00
Maxim Nestratov
1abc8b3966 vz: don't add implicit devices for CTs
Implicit devices like controllers are confusing for CTs and
function virDomainDefAddImplicitDevices never intended to be called
for CTs.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-12-22 22:06:39 +03:00
Maxim Nestratov
e485310ab2 vz: report "scsi" bus for disks when nothing was set explixitly
This is necessary to show CTs created out of libvirt correctly.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-12-22 22:06:39 +03:00
Pavel Glushchak
b1f916abbc vz: added VIR_MIGRATE_NON_SHARED_INC migration flag support
This flag is used in Virtuozzo backend implicitly, thus
we need to support it and don't fail if it's set.

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2016-12-09 17:21:53 +03:00
Pavel Glushchak
5bafa1d721 vz: set PVMT_DONT_CREATE_DISK migration flag
This flag tells backend not to create instance
disks making behavior the same as in qemu driver.
Disk files have to be created beforehand on target
host manually or by upper management layer i.e.
OpenStack Nova.

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2016-12-09 17:21:43 +03:00
Maxim Nestratov
745263589f Revert "vz: fixed race in vzDomainAttach/DettachDevice"
This reverts commit 3a6cf6fc16.

Mistakenly this commit was pushed because I thought I missed the
corret one b880ff42dd while in fact I didn't.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-11-25 17:26:55 +03:00
Michal Privoznik
c2a5a4e7ea virstring: Unify string list function names
We have couple of functions that operate over NULL terminated
lits of strings. However, our naming sucks:

virStringJoin
virStringFreeList
virStringFreeListCount
virStringArrayHasString
virStringGetFirstWithPrefix

We can do better:

virStringListJoin
virStringListFree
virStringListFreeCount
virStringListHasString
virStringListGetFirstWithPrefix

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-11-25 13:54:05 +01:00
Sławek Kapłoński
6c98ac2c62 Forbid new-line char in name of new domain
New line character in name of domain is now forbidden because it
mess virsh output and can be confusing for users.
Validation of name is done in drivers, after parsing XML to avoid
problems with dissappeared domains which was already created with
new-line char in name.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-11-22 14:35:14 +01:00
Pavel Glushchak
4f949f7486 vz: fixed migration in p2p mode
dom xml generated on begin step should be passed
to perform step in VIR_MIGRATE_PARAM_DEST_XML parameter.
Otherwise 'XML error: failed to parse xml document' is
raised on destination host as dom xml is NULL.

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2016-11-14 21:22:40 +03:00
Maxim Nestratov
29594f2675 vz: remove Bridged network name and rename Routed
It's funny, but Routed network name was incorrect. We should use
host-routed instead.
2016-10-27 17:25:50 +03:00
Maxim Nestratov
0e094a4495 vz: support type=bridge network interface type correctly
Recently, libprlsdk got a separate flag PNA_BRIDGE corresponding to
type=bridge libvirt network interfaces. Let's use it and get rid of
all workarounds previously added to  support it.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-10-27 17:25:50 +03:00
John Ferlan
77a12987a4 Introduce virDomainChrSourceDefNew for virDomainChrDefPtr
Change the virDomainChrDef to use a pointer to 'source' and allocate
that pointer during virDomainChrDefNew.

This has tremendous "fallout" in the rest of the code which mainly
has to change source.$field to source->$field.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-10-21 14:03:36 -04:00
Nikolay Shirokovskiy
bdaf5e8098 vz: set something in disk driver name
Absent driver name attribute is invalid xml. Which in turn makes
unusable 'virsh edit' for example. The value does not make
much sense and ignored on input so nobody will hurt.
2016-10-21 16:19:09 +03:00
Nikolay Shirokovskiy
d6e3af6209 vz: add serial number to disk devices
vz sdk supports setting serial number only for disk devices.
Getting serial upon cdrom(for example) is error however
setting is just ignored. Let's check for disk device
explicitly for clarity in both cases.

Setting serial number for other devices is ignored
with an info note just as before.

We need usual conversion from "" to NULL in direction
vz sdk -> libvirt, because "" is not valid for libvirt
and "" means unspecifiend in vz sdk which is NULL for libvirt.
2016-10-21 16:18:56 +03:00
Mikhail Feoktistov
97b31f8672 vz: set localhost as vnc address
We should set localhost as vnc address in case of empty string.
Because Virtuozzo sets 0.0.0.0 as default vnc address.
2016-10-21 11:34:59 +03:00
John Ferlan
5f2a132786 qemu: Introduce qemuDomainChardevPrivatePtr
Modeled after the qemuDomainHostdevPrivatePtr (commit id '27726d8c'),
create a privateData pointer in the _virDomainChardevDef to allow storage
of private data for a hypervisor in order to at least temporarily store
secret data for usage during qemuBuildCommandLine.

NB: Since the qemu_parse_command (qemuParseCommandLine) code is not
expecting to restore the secret data, there's no need to add code
code to handle this new structure there.

Signed-off-by: John Ferlan <jferlan@redhat.com>
2016-10-19 15:40:29 -04:00
Martin Kletzander
1827f2ac5d Change virDomainEventState to virObjectLockable
This way we get reference counting and we can get rid of locking
function.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-10-12 12:54:47 +02:00
Michal Privoznik
78ab5dcea0 conf: Extend virDomainDeviceDefPostParse for parseOpaque
Just like virDomainDefPostParseCallback has gained new
parseOpaque argument, we need to follow the logic with
virDomainDeviceDefPostParse.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-09-26 16:50:12 +02:00
Michal Privoznik
c41b989112 virDomainDefParse{File,String}: Introduce @parseOpaque argument
We want to pass the proper opaque pointer instead of NULL to
virDomainDefParse and subsequently virDomainDefParseNode too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-09-26 16:50:12 +02:00
Michal Privoznik
940d91c55b virDomainDefPostParse: Introduce @parseOpaque argument
Some callers might want to pass yet another pointer to opaque
data to post parse callbacks. The driver generic one is not
enough because two threads executing post parse callback might
want to see different data (e.g. domain object pointer that
domain def belongs to).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-09-26 16:50:12 +02:00
Mikhail Feoktistov
0c3e499c78 vz: getting bus type for containers
We should query bus type for containers too, like for VM.
In openstack we add volume disk like SCSI, so we can't
hardcode SATA bus.
2016-08-26 17:48:55 +03:00
Nikolay Shirokovskiy
836a2c78ca vz: update domain cache after device updates 2016-08-26 17:48:29 +03:00
Olga Krishtal
3a6cf6fc16 vz: fixed race in vzDomainAttach/DettachDevice
While dettaching/attaching device in OpenStack, nova
calls vzDomainDettachDevice twice, because the update of the internal
configuration of the ct comes a bit latter than the update event.
As the result, we suffer from the second call to dettach the same device.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-08-26 17:48:12 +03:00
Pavel Glushchak
2354266acf vz: added VIR_MIGRATE_PARAM_BANDWIDTH param handling
libvirt-python passes parameter bandwidth = 0
by default. This means that bandwidth is unlimited.
VZ driver doesn't support bandwidth rate limiting,
but we still need to handle it and fail if bandwidth > 0.

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2016-08-26 14:59:22 +03:00
Pavel Glushchak
d7af2218b6 vz: implicitly support additional migration flags
* Added VIR_MIGRATE_LIVE, VIR_MIGRATE_UNDEFINE_SOURCE and
  VIR_MIGRATE_PERSIST_DEST to supported migration flags

Signed-off-by: Pavel Glushchak <pglushchak@virtuozzo.com>
2016-08-26 14:59:13 +03:00
Nikolay Shirokovskiy
018b4ae14b vz: add ACL checks to API calls
vzDomainMigrateConfirm3Params is whitelisted. Otherwise we need to
move removing domain from domain list from perform to confirm
step. This would further imply adding a flag and check that migration
is in progress to prohibit mistakenly (maliciously) removing domains
on confirm step. vz version of p2p also need to be fixed to include confirm step.
One would also need to add means to cleanup pending migration
on client disconnect as now is has state across several API
calls.

  On the other hand current version of confirm step is totaly
harmless thus it is easier to whitelist it at the moment.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-08-23 19:48:01 +03:00
Nikolay Shirokovskiy
5a435726ef vz: prepare migration for ACL checks
ACL check on perform step should be in API call itself to make ACL
checking script pass. Thus we need to reorganize code to obtain
domain object in perform API itself. Most of this is straight
forward, the only nuance is dropping locks on lengthy remote
operations.
  The other motivation is to have only perform step ACL checks for
p2p migration instead of both begin in perform if we can leave
ACL check in vzDomainMigratePerformStep.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-08-23 19:48:01 +03:00
Nikolay Shirokovskiy
5a78ef91fa vz: expand setting memory API calls
We need it to prepare the calls for ACL checks otherwise ACL checking
script will fail.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-08-23 19:48:01 +03:00
Nikolay Shirokovskiy
a041ae571d vz: add missing flagged versions of API functions
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-08-23 19:48:01 +03:00
Nikolay Shirokovskiy
1a28c5e007 vz: factor out converting block stats to params
This action deserves its own function and makes main API call
structure much cleaner.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-08-23 19:48:01 +03:00
Nikolay Shirokovskiy
1b2673e2b0 vz: factor out block stats impl
Now we can use intended ACL check for both API calls.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-08-23 19:48:01 +03:00
Nikolay Shirokovskiy
4cdf203263 vz: implement plain create API thru createFlags instead of visa versa
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-08-23 19:48:01 +03:00
Nikolay Shirokovskiy
db66c35e2e vz: expand start/stop/... APIs for ACL checks
The original motivation is to expand API calls like start/stop etc so that
the ACL checks could be added. But this patch has its own befenits.

1. functions like prlsdkStart/Stop use common routine to wait for
job without domain lock. They become more self contained and do
not return intermediate PRL_RESULT.

2. vzDomainManagedSave do not update cache twice.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-08-23 19:48:01 +03:00
Mikhail Feoktistov
72abe56448 vz: add validation callbacks
This patch fixes a bug which occurs when we check a bus and unit number
for a new attached disk. We should do this check in ValidadionCallback,
not in PostParse callback. Because in PostParse we have not initialized
disk->info.addr.drive struct yet.
Move part of code from domainPostParseCallback to domainValidateCallback
and part from devicesPostParseCallback to deviceValidateCallback.
PostParse callbacks are for modification data.
ValidateCallbacks are only for checks.
2016-08-18 20:37:09 +03:00
Olga Krishtal
b880ff42dd vz: fixed race in vzDomainAttach/DettachDevice
While dettaching/attaching device in OpenStack, nova
calls vzDomainDettachDevice twice, because the update of the internal
configuration of the ct comes a bit latter than the update event.
As the result, we suffer from the second call to dettach the same device.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-08-18 20:37:09 +03:00
Maxim Nestratov
0970a066d1 vz: specify VIR_DOMAIN_NET_TYPE_NETWORK for routed networks
Somehow we lost this during recent refactoring

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-08-18 20:37:09 +03:00
Maxim Nestratov
0f13dc81d7 vz: reset errors after ignoring return values
If we are going to ignore return value of a functions
that can raise an error, it's not enough to use ignore_value
construction. We should explicitly call virResetLastError

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-08-18 20:37:08 +03:00
Maxim Nestratov
d9e0d4ecbb vz: don't fail query domain info in case we don't have valid stats handle
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-08-18 20:37:08 +03:00
Maxim Nestratov
9e8cbe185d vz: get additional error information from job correctly
First, make function logPrlEventErrorHelper be void and only
print information (if any) from an event.
Second, don't rewrite original error with any errors we get
during parsing event info.
Third, ignore PRL_ERR_NO_DATA at all.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-08-18 20:37:08 +03:00
Nikolay Shirokovskiy
492a383e58 vz: add vzDomainGetJobStats
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-08-06 22:01:29 +03:00
Nikolay Shirokovskiy
dd7b0a388f vz: add getting job info for migration
Unfortunately vz sdk do not provide detail information on migration
progress, only progress percentage. Thus vz driver provides percents
instead of bytes in data fields of virDomainJobInfoPtr.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-08-06 22:01:02 +03:00
Nikolay Shirokovskiy
b999ce97f3 vz: handle gracefully races on undefining domain
Undefine procedure drops domain lock while waiting for detaching
disks vz sdk call. Meanwhile vz sdk event domain-config-changed
arrives, its handler finds domain and is blocked waiting for job
condition. After undefine API call finishes event processing procedes
and tries to refreshes domain config thru existing vz sdk domain handle.
Domain does not exists anymore and event processing fails. Everything
is fine we just don't want to see error message in log for this
particular case.

Fortunately domain has flag that domain is removed from list. This
also imply that vz sdk domain is also undefined. Thus if we check
for this flag right after domain is locked again on accuiring
job condition we gracefully handle this situation.

Actually the race can happen in other situations too. Any
time we wait for job condition in mutualy exclusive job in
time when we acquire it vz sdk domain can cease to exist.
So instead of general internal error we can return domain
not found which is easier to handle. We don't need to patch
other places in mutually exclusive jobs where domain lock
is dropped as if job is started domain can't be undefine
by mutually exclusive undefine job.

The code of this patch is quite similar to qemu driver checks
for is domain is active after acquiring a job. The difference
only while qemu domain is operational while process is active
vz domain is operational while domain exists.
2016-07-21 00:59:17 +03:00
Nikolay Shirokovskiy
8429923507 vz: make vz driver more responsive
Current vz driver implementation is not usable when it comes to
long runnig operations. Migration or saving a domain blocks all
other operations even query ones which are expecteted to be available.
This patch addresses this problem.

All vz driver API calls fall into next 3 groups:
1. only query domain cache (virDomainObj, vz cache statistic)
   examples are vzDomainGetState, vzDomainGetXMLDesc etc.
2. use thread shared sdkdom object
   examples are vzDomainSetMemoryFlags, vzDomainAttachDevice etc.
3. use no thread shared sdkdom object nor domain cache
   examples are vzDomainSnapshotListNames, vzDomainSnapshotGetXMLDesc etc

API calls from group 1 don't need to be changed as they hold domain lock only
for short period of time. These calls [1] are easily distinguished. They query
domain object thru libvirt common code or query vz sdk statistics handle thru
vz sdk sync operations.

vzDomainInterfaceStats is the only exception. It uses sdkdom object to
convert interface name to its vz sdk stack index which could not be saved in
domain cache. Interface statistics is available thru this stack index as a key
rather than name. As a result we can have accidental 'not known interface'
errors on quering intrerface stats. The reason is that in the process of
updating domain configuration we drop all devices and then recreate them again
in sdkdom object and domain lock can be dropped meanwhile (to remove networks
for existing bridged interfaces and(or) (re)create new ones). We can fix this
by changing the way we support bridged interfaces or by reordering operations
and changing bridged networks beforehand. Anyway this is better than moving
this API call into 2 group and making it an exclusive job.

As to API calls from group 2, first thread shared sdkdom object needs to be
explained. vz sdk has only one handle for a given domain, thus threads need
exclusive access to operate on it. These calls are fixed to drop and reacquire
domain lock on any lengthy operations - namely waiting the result of async vz
sdk operation. As lock is dropped we need to take extra reference to domain
object if it is not taken already as domain object can be deleted from list
while lock is dropped. As this operations use thread shared sdkdom object, the
simplest way to make calls from group 2 be consistent to each other is to make
them mutually exclusive. This is done by taking/releasing job condition thru
calling correspondent job routine. This approach makes group 1 and group
2 calls consistent to each other too. Not all calls of group 2 change the
domain cache but those that do update it thru prlsdkUpdateDomain which holds
the lock thoughout the update.

API calls from group [2] are easily distinguished too. They use
beginEdit/commit to change domain configuration (vzDomainSetMemoryFlags) or/and
update domain cache from sdkdom at the end of operation (vzDomainSuspend).

There is a known issue however. Frankly speaking it was introduced by ealier
patch '[PATCH 6/9] vz: cleanup loading domain code' from a different series.
The patch significantly reduced amount of time when the driver lock is held when
creating domain from API call or as a result of domain added event from vz sdk.
The problem is these two paths race on using thread shared sdkdom as we don't
have libvirt domain object and can not lock on it. However this don't
invalidates the patch as we can't use the former approach of preadding domain
into the list as we need name at least and name is not given by event. Anyway
i'm against adding half baked object into the list. Eventually this race can be
fixed by extra measures. As to current situation races with different
configurations are unlikely and race when adding domain thru vz driver and
simultaneous event from vz sdk is not dangerous as configuration is the same.

The last group [3] is API calls that need only sdkdom object to make vz sdk
call and don't change thread shared sdkdom object or domain cache in any way.
For now these are mostly domain snapshot API calls. The changes are similar to
those of group 2 - they add extra reference and drop/reacquire the lock on waiting
vz async call result. One can simply take the immutable sdkdom object from the
cache and drop the lock for the rest of operations but the chosen approach
makes implementation of these API calls somewhat similar to those of from group
2 and thus a bit futureproof. As calls of group 3 don't need vz driver
domain/vz sdk cache in any way, they are consistent with respect to API calls from
groups 1 and 3.

There is another exception. Calls to make-snapshot/revert-to-snapshot/migrate
are moved to group 2. That is they are made mutually exclusive. The reason
is that libvirt API supports control/query only for one job per domain and
these are jobs that are likely to be queried/aborted.

Appendix.

[1] API calls that only query domain cache.
(marked [*] are included for a different reason)

.domainLookupByID = vzDomainLookupByID,    /* 0.10.0 */
.domainLookupByUUID = vzDomainLookupByUUID,        /* 0.10.0 */
.domainLookupByName = vzDomainLookupByName,        /* 0.10.0 */
.domainGetOSType = vzDomainGetOSType,    /* 0.10.0 */
.domainGetInfo = vzDomainGetInfo,  /* 0.10.0 */
.domainGetState = vzDomainGetState,        /* 0.10.0 */
.domainGetXMLDesc = vzDomainGetXMLDesc,    /* 0.10.0 */
.domainIsPersistent = vzDomainIsPersistent,        /* 0.10.0 */
.domainGetAutostart = vzDomainGetAutostart,        /* 0.10.0 */
.domainGetVcpus = vzDomainGetVcpus, /* 1.2.6 */
.domainIsActive = vzDomainIsActive, /* 1.2.10 */
.domainIsUpdated = vzDomainIsUpdated,     /* 1.2.21 */
.domainGetVcpusFlags = vzDomainGetVcpusFlags, /* 1.2.21 */
.domainGetMaxVcpus = vzDomainGetMaxVcpus, /* 1.2.21 */
.domainHasManagedSaveImage = vzDomainHasManagedSaveImage, /* 1.2.13 */
.domainGetMaxMemory = vzDomainGetMaxMemory, /* 1.2.15 */
.domainBlockStats = vzDomainBlockStats, /* 1.2.17 */
.domainBlockStatsFlags = vzDomainBlockStatsFlags, /* 1.2.17 */
.domainInterfaceStats = vzDomainInterfaceStats, /* 1.2.17 */                   [*]
.domainMemoryStats = vzDomainMemoryStats, /* 1.2.17 */
.domainMigrateBegin3Params = vzDomainMigrateBegin3Params, /* 1.3.5 */
.domainMigrateConfirm3Params = vzDomainMigrateConfirm3Params, /* 1.3.5 */

[2] API calls that use thread shared sdkdom object
(marked [*] are included for a different reason)

.domainSuspend = vzDomainSuspend,    /* 0.10.0 */
.domainResume = vzDomainResume,    /* 0.10.0 */
.domainDestroy = vzDomainDestroy,  /* 0.10.0 */
.domainShutdown = vzDomainShutdown, /* 0.10.0 */
.domainCreate = vzDomainCreate,    /* 0.10.0 */
.domainCreateWithFlags = vzDomainCreateWithFlags, /* 1.2.10 */
.domainReboot = vzDomainReboot, /* 1.3.0 */
.domainDefineXML = vzDomainDefineXML,      /* 0.10.0 */
.domainDefineXMLFlags = vzDomainDefineXMLFlags, /* 1.2.12 */ (update part)
.domainUndefine = vzDomainUndefine, /* 1.2.10 */
.domainAttachDevice = vzDomainAttachDevice, /* 1.2.15 */
.domainAttachDeviceFlags = vzDomainAttachDeviceFlags, /* 1.2.15 */
.domainDetachDevice = vzDomainDetachDevice, /* 1.2.15 */
.domainDetachDeviceFlags = vzDomainDetachDeviceFlags, /* 1.2.15 */
.domainSetUserPassword = vzDomainSetUserPassword, /* 1.3.6 */
.domainManagedSave = vzDomainManagedSave, /* 1.2.14 */
.domainSetMemoryFlags = vzDomainSetMemoryFlags, /* 1.3.4 */
.domainSetMemory = vzDomainSetMemory, /* 1.3.4 */
.domainRevertToSnapshot = vzDomainRevertToSnapshot, /* 1.3.5 */                  [*]
.domainSnapshotCreateXML = vzDomainSnapshotCreateXML, /* 1.3.5 */                [*]
.domainMigratePerform3Params = vzDomainMigratePerform3Params, /* 1.3.5 */        [*]
.domainUpdateDeviceFlags = vzDomainUpdateDeviceFlags, /* 2.0.0 */
prlsdkHandleVmConfigEvent

[3] API calls that do not use thread shared sdkdom object

.domainManagedSaveRemove = vzDomainManagedSaveRemove, /* 1.2.14 */
.domainSnapshotNum = vzDomainSnapshotNum, /* 1.3.5 */
.domainSnapshotListNames = vzDomainSnapshotListNames, /* 1.3.5 */
.domainListAllSnapshots = vzDomainListAllSnapshots, /* 1.3.5 */
.domainSnapshotGetXMLDesc = vzDomainSnapshotGetXMLDesc, /* 1.3.5 */
.domainSnapshotNumChildren = vzDomainSnapshotNumChildren, /* 1.3.5 */
.domainSnapshotListChildrenNames = vzDomainSnapshotListChildrenNames, /* 1.3.5 */
.domainSnapshotListAllChildren = vzDomainSnapshotListAllChildren, /* 1.3.5 */
.domainSnapshotLookupByName = vzDomainSnapshotLookupByName, /* 1.3.5 */
.domainHasCurrentSnapshot = vzDomainHasCurrentSnapshot, /* 1.3.5 */
.domainSnapshotGetParent = vzDomainSnapshotGetParent, /* 1.3.5 */
.domainSnapshotCurrent = vzDomainSnapshotCurrent, /* 1.3.5 */
.domainSnapshotIsCurrent = vzDomainSnapshotIsCurrent, /* 1.3.5 */
.domainSnapshotHasMetadata = vzDomainSnapshotHasMetadata, /* 1.3.5 */
.domainSnapshotDelete = vzDomainSnapshotDelete, /* 1.3.5 */

[4] Known issues.

1. accidental errors on getting network statistics
2. race with simultaneous use of thread shared domain object on paths
 of adding domain thru API and adding domain on vz sdk domain added event.
2016-07-21 00:59:17 +03:00
Nikolay Shirokovskiy
5013ad4e0f vz: keep naming convention for domain objects
see 4385b868
2016-07-21 00:59:17 +03:00
Nikolay Shirokovskiy
3d211da27b vz: remove redundant variable in prlsdkHandleVmAddedEvent 2016-07-21 00:59:17 +03:00
Nikolay Shirokovskiy
2abef7fb55 vz: use state variable sdkdom in prlsdkApplyConfig
sdk domain handle is unique per connection so there is
no sense to query it again if we have it in vzDomObjPtr.
Side effect of prlsdkSdkDomainLookupByUUID is refreshing
domain config is of no use too as PrlVm_BeginEdit do it too.
2016-07-21 00:59:17 +03:00
Nikolay Shirokovskiy
c62e9d4199 vz: add tcp and udp serial device support
vz supports only a subset of tcp and udp parameters.

1. tcp type supports only 'raw' protocol.
2. udp type supports only same parameters of 'host' and 'service'
for 'bind' and 'connect'.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 06:11:03 +03:00
Nikolay Shirokovskiy
ec8d5ce1ea vz: add mode of unix socket serial device to xml dump
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 06:10:30 +03:00
Nikolay Shirokovskiy
32cca27821 vz: don't fail unregister on sending event error
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:17 +03:00
Nikolay Shirokovskiy
9250492e56 vz: use single variable for domain
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:17 +03:00
Nikolay Shirokovskiy
ab64ebd1b5 vz: dont remove domain from list on client object error
After domain is in the domains list let's keep it there. This
is approach taken by qemu driver and vz vzDomainMigrateFinish3Params too.
It quite reasonable, driver domain object is fully constructed and
can be discovered by client later.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:17 +03:00
Nikolay Shirokovskiy
cfc6815568 vz: cleanup loading domain code
9c14a9ab introduced vzNewDomain function to enlist libvirt domain
object before actually creating vz sdk domain. Fix should fix
race on same vz sdk domain added event where libvirt domain object is
enlisted too. But later eb5e9c1e added locked checks for
adding livirtd domain object to list on vz sdk domain added event.
Thus now approach of 9c14a9ab is unnecessary complicated.

  See we have otherwise unuseful prlsdkGetDomainIds function only
to create minimal domain definition to create libvirt domain object.
Also vzNewDomain is difficult to use as it creates partially
constructed domain object.

  Let's move back to original approach where prlsdkLoadDomain do
all the necessary job. Another benefit is that we can now
take driver lock for bare minimum and in single place. Reducing
locking time have small disadvatage of double parsing on race
conditions which is typical if domain is added thru vz driver.
Well we have this double parse inevitably with current vz sdk api
on any domain updates so i would not take it here seriously.

  Performance events subscribtion is done before locked check and
therefore could be done twice on races but this is not the problem.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:17 +03:00
Nikolay Shirokovskiy
8dd169d1c1 vz: use domain list infrastructure to deal with private domain
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:17 +03:00
Nikolay Shirokovskiy
c2f5dc24c5 vz: make error handling idiomatic in prlsdkCreateVm
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:17 +03:00
Nikolay Shirokovskiy
e43fb4ee77 vz: fix leaks in prlsdkCreate* functions
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:16 +03:00
Nikolay Shirokovskiy
1e697ac9f3 vz: restore accidentally removed locks around close callback calls
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:16 +03:00
Nikolay Shirokovskiy
3eede43aab vz: remove unnecessary labels in simple API calls
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-19 05:31:16 +03:00
Olga Krishtal
3dd50be7ca vz: support filesystem type volume
Vz containers are able to use ploop volumes from storage pools
to work upon.

To use filesystem type volume, pool name and volume name should be
specifaed in <source> :
   <filesystem type='volume' accessmode='passthrough'>
      <driver type='ploop' format='ploop'/>
      <source pool='guest_images' volume='TEST_POOL_CT'/>
      <target dir='/'/>
   </filesystem>

The information about pool and volume is stored in ct dom configuration:
<StorageURL>libvirt://localhost/pool_name/vol_name</StorageURL>
and can be easily obtained via PrlVmDevHd_GetStorageURL sdk call.

The only shorcoming: if storage pool is moved somewhere the ct
should be redefined in order to refresh the information aboot path
to root.hdd

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-07-18 23:39:57 +03:00
Olga Krishtal
cec0309840 vz: refactoring of prlsdkCreateCt
We do not need to check domainf fs type there,
because it is done in prlsdkCheckUnsupportedParams.

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-07-18 23:39:56 +03:00
Olga Krishtal
da665fbd48 filesystem: adds possibility to use storage pool as fs source
Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-07-18 23:39:56 +03:00
Olga Krishtal
799b5aa59e vz: fixed null-pointer dereference in applying graphic params
Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-07-18 23:39:56 +03:00
Nikolay Shirokovskiy
eb2fe4eb4a vz: fix destination domain synchronization
Adding domain to domain list on preparation step is not correct.
First domain is not fully constructed - domain definition is
missing. Second we can't use VIR_MIGRATE_PARAM_DEST_XML parameter
to parse definition as vz sdk can patch it by itself. Let's add/remove
domain on finish step. This is for synchronization purpose only so domain
is present/absent on destination after migration completion. Actually
domain object will probably be created right after actual vz sdk
migration start by vz sdk domain defined event.

We can not and should not sync domain cache on error path in finish step
of migration. We can not as we really don't know what is the reason of
cancelling and we should not as user should not make assumptions on
state on error path. What we should do is cleaning up temporary migration
state that is induced on prepare step but we don't have one. Thus
cancellation should be noop.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-07-18 22:21:40 +03:00
Nikolay Shirokovskiy
e126352e93 vz: fix memory leaks in prlsdkLoadDomains
Free sdkdom on any result of prlsdkNewDomainByHandle.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-18 22:20:51 +03:00
Nikolay Shirokovskiy
b5e08e8c7e vz: fix missed defined domain event
libvirt domain defined event is issued only on correspondent vz sdk
event. But in case event delivered before domain is added to
domain list we can mistakenly skip this event if prlsdkNewDomainByHandle
return NULL in case of domain is discovered in the list under
the driver lock. Let's return domain object in this case.
Now prlsdkNewDomainByHandle returns NULL only in case of
error which is more convinient.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-18 22:20:24 +03:00
Nikolay Shirokovskiy
ac60d42384 vz: don't pass empty and unused fields in migration cookie
The first version of migration cookie was rather dumb resulting
in passing empty or unused fields here and there. Add flags to
specify what to bake to and eat from cookie so we deal only
with meaningful data. However for backwards compatibility
we still need to pass at least some faked fields sometimes.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-07-18 22:19:16 +03:00
Peter Krempa
5fe0b6b0a7 conf: Add private data for virDomainVcpuDef
Allow to store driver specific data on a per-vcpu basis.

Move of the virDomainDef*Vcpus* functions was necessary as
virDomainXMLOptionPtr was declared below this block and I didn't want to
split the function headers.
2016-07-11 10:44:04 +02:00
Peter Krempa
c7d5dd3974 conf: Rename virDomainVcpuInfoPtr to virDomainVcpuDefPtr 2016-07-11 09:06:09 +02:00
Andrea Bolognani
a9a2abd478 vz: Fix indentation in prlsdkGetNetAddresses() 2016-06-28 10:09:52 +02:00
Olga Krishtal
a2adcc1b93 vz: fix build for virNetDev* changes
Patch fixes vz build after changes in IP-related netdev functions(cf0568b0, fbc1843d).

Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com>
2016-06-27 16:31:11 -04:00
Laine Stump
fbc1843d2e conf: use virNetDevIPInfo for guest-side <interface> config
All the same information was already there, just in slightly different
places in the virDomainNetDef.
2016-06-26 19:33:09 -04:00
Nikolay Shirokovskiy
851a751575 vz: always pass graphics address to sdk
We need this because apply graphics functions is used on
update too. Also in case of NULL address resolve it to default
instead of error.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:04 +03:00
Nikolay Shirokovskiy
96ca48451a vz: support vnc password
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:04 +03:00
Nikolay Shirokovskiy
4698b4e65c vz: remove exlicitly setting zeros in dumping graphics
Allocation will do this job. Also we don't use the explicit setting
in other places.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:04 +03:00
Nikolay Shirokovskiy
e325c997a8 vz: support attach/detach/update/ of graphics device
Move graphic device config to post parse. This way we
detect error on early stage and leverage checking on detach too.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:04 +03:00
Nikolay Shirokovskiy
e7878d4623 vz: move getting container video devices out from vnc code
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:03 +03:00
Nikolay Shirokovskiy
3a622f6b32 vz: trustGuestRxFilters fixes
First we need to always set value to vz sdk parameter so
we can leverage setting code for device updates. This patch
resolves tristate default to off implicitly. This is easier
then extract default value from vz sdk itself. First current
default is off too, second this approach is already taken
for 'net->linkstate'.

Second dump this option in domain xml.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:03 +03:00
Nikolay Shirokovskiy
3a82c04c09 vz: fix minor type safey issues with net union usage
Fix net->data usage accordingly to type field.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:03 +03:00
Nikolay Shirokovskiy
62b0066de4 vz: fix updating to no gateways
Current code that pass gateways to vz sdk is not suitable for
updates. If update has no gateways while we had them before
we need to pass "" for vz sdk gateways to reset old value.

The code definitely deserves its own function.

Drop checks that skip setting gateways if network address
is not set. Such a configuration is possible in vz sdk.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:03 +03:00
Nikolay Shirokovskiy
c34a9d6e56 vz: dump route info in domain xml
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:03 +03:00
Nikolay Shirokovskiy
b86396dc54 vz: dump ip addresses to domain xml
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:03 +03:00
Nikolay Shirokovskiy
2e4bed1b81 vz: give nice report if network device not found
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:02 +03:00
Nikolay Shirokovskiy
3cea593f35 vz: fix memory leaks in attach/detach functions
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:02 +03:00
Nikolay Shirokovskiy
91ee31d19e vz: move disks checks to device post parse
And reformat so that we don't have lengthy lines. Also simplify
some checks.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:02 +03:00
Nikolay Shirokovskiy
511f6ab5ba vz: leverage disks parameters check on disks updates too
This is as easy as moving disks checks from domain post
parse callback to device post parse callback.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:02 +03:00
Nikolay Shirokovskiy
307eb644ed vz: add device updates
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-25 22:56:02 +03:00
Nikolay Shirokovskiy
0f38187b68 vz: reuse edit config frame in for attach/detach functions
Attach/detach functions for disk/net are quite trivial and
typically call a few functions in begin/end edit frame. Having
in mind update function too adding configuring for another
device (like graphics) will introduce 3 trivial functions more.
Let's replace current approach by attach/detach functions for
device.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-25 22:56:01 +03:00
Nikolay Shirokovskiy
f6e13453e7 vz: make prlsdkGetDisk more generic
Current implementation works with hard disks only. This patch
adds support for any disk device (cdroms and hdds right now).

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-25 22:56:01 +03:00
Nikolay Shirokovskiy
2e6ff2da75 vz: remove disk cache mode hunk
This code was added as a part of huge patch that moves driver
from working with prlctl to vz sdk so there is no good explanation
why this is done this way. The problem that it is not correct.
vz sdk cache mode parameter affects all domain disks while this hunk
resets its on every disk to a new value.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-25 22:56:01 +03:00
Ján Tomko
ff52e9d43a Remove separator argument from virBitmapParse
Most the callers pass 0 in one form or another, including
vircapstest which used VIR_ARCH_NONE.
2016-06-20 12:09:52 +02:00
Peter Krempa
f8d565bf86 conf: Rename virDomainDefGetMemoryActual to virDomainDefGetMemoryTotal 2016-06-17 10:39:40 +02:00
Nikolay Shirokovskiy
475835e38b vz: get rid of unused home state variable in private domain obj
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-15 16:24:28 +02:00
Ján Tomko
b9df355592 maint: remove whitespace from closing parentheses
To allow tightening syntax check.
2016-06-15 15:07:47 +02:00
Martin Kletzander
e8dc0e3a43 Change 1.3.6 occurrences to 2.0.0 to follow version bump
Version was bumped but documentation (and comments) didn't follow the
numbering.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-06-14 11:15:18 +02:00
Maxim Nestratov
85d54f133c vz: fix crash when parsing unexpected disk configuration
As it turned out PrlVmDev_GetStackIndex can return negative values
without reporting an error, which is incorrect but nevertheless.
After that we feed this negative index to virIndexToDiskName,
which in turn returns NULL and we set it to virDomainDiskDef.dst.
Using virDiskNameToBusDeviceIndex with a virDomainDiskDef structure
which has NULL dst field crashes.
Fix this by returning an error in prlsdkGetDiskId in such cases.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-11 18:21:15 +03:00
Mikhail Feoktistov
ceb5461f7b vz: implementation of domainSetUserPassword callback 2016-06-11 18:20:56 +03:00
Maxim Nestratov
f166d6449c vz: return correct result for unimplemented ChangeState actions
Map PRL_ERR_UNIMPLEMENTED to VIR_ERR_OPERATION_INVALID

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-11 18:20:41 +03:00
Maxim Nestratov
ab753f7b50 vz: remove unused macro logPrlEventError
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-11 18:20:24 +03:00
Nikolay Shirokovskiy
4f17e4d0a1 vz: keep subscription to performance events thru domain lifetime
The approach of subscribing on first stat API call and then waiting
for receiving of performance event from sdk to process the call originates
in times when every vz libvirt connections spawns its own sdk connection.
Thus without this waiting virsh stat call would return empty stats. Now
with single sdk connection this scheme is unnecessary complicated.

This patch subscribes to performance events on first domain appearence
and unsubscribe on its removing.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-06-11 13:27:55 +03:00
Nikolay Shirokovskiy
4385b86817 vz: use consistent naming for different domain object in vz_driver.c
Naming scheme is next:

virDomainPtr domain;
virDomainObjPtr dom;

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-06-11 13:27:55 +03:00
Maxim Nestratov
ecdff2fd89 vz: fixed build by including necessary headers
After eaf18f4c2 some functions changed their homes
Pushed under build breaking rule
2016-06-10 20:21:18 +03:00
Daniel P. Berrange
4053350bfe nodeinfo: rename all CPU APIs to have a virHostCPU prefix
In preparation for moving all the CPU related APIs out of
the nodeinfo file, give them a virHostCPU name prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:08:15 +01:00
Daniel P. Berrange
dcfe37e682 nodeinfo: rename all memory APIs to have a virHostMem prefix
In preparation for moving all the memory related APIs out of
the nodeinfo file, give them a virHostMem name prefix.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:07:00 +01:00
Daniel P. Berrange
08ea852c25 nodeinfo: remove sysfs_prefix from all methods
Nearly all the methods in the nodeinfo file are given a
'const char *sysfs_prefix' parameter to override the
default sysfs path (/sys/devices/system). Every single
caller passes in NULL for this, except one use in the
unit tests. Furthermore this parameter is totally
Linux-specific, when the APIs are intended to be cross
platform portable.

This removes the sysfs_prefix parameter and instead gives
a new method linuxNodeInfoSetSysFSSystemPath for use by
the test suite.

For two of the methods this hardcodes use of the constant
SYSFS_SYSTEM_PATH, since the test suite does not need to
override the path for thos methods.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-09 18:00:18 +01:00
Pavel Hrdina
acc83afe33 vnc: add support for listen type 'socket'
VNC graphics already supports sockets but only via 'socket' attribute.
This patch coverts that attribute into listen type 'socket'.

For backward compatibility we need to handle listen type 'socket' and 'socket'
attribute properly to support old XMLs and new XMLs.  If both are provided they
have to match, if only one of them is provided we need to be able to parse that
configuration too.

To not break migration back to old libvirt if the socket is provided by user we
need to generate migratable XML without the listen element and use only 'socket'
attribute.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-09 14:42:48 +02:00
Daniel P. Berrange
5f1837eaca Pass config file object through to driver open methods
The virConnectOpenInternal method opens the libvirt client
config file and uses it to resolve things like URI aliases.

There may be driver specific things that are useful to
store in the config file too, so rather than have them
re-parse the same file, pass the virConfPtr down to the
drivers.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2016-06-08 13:48:45 +01:00
Peter Krempa
9890a7a183 conf: Add device def validation callback
Similarly to the domain definition validator add a device validator. The
change to the prototype of the domain validator is necessary as
virDomainDeviceInfoIterateInternal requires a non-const pointer.
2016-06-07 13:02:20 +02:00
Peter Krempa
998c9e34e6 conf: Rename VIR_DOMAIN_DEF_PARSE_VALIDATE to VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA
Make it obvious that the flag is controlling RNG schema validation.
2016-06-07 13:02:20 +02:00
Mikhail Feoktistov
4aeb1d5158 vz: add error code for case if vm is already stopped
If try to stop VM or container which is already stopped than
Virtuozzo 7 returns code PRL_ERR_INVALID_ACTION_REQUESTED.
Error code PRL_ERR_DISP_VM_IS_NOT_STARTED is used in Virtuozzo 6
2016-05-23 20:06:17 +03:00
Pavel Hrdina
6bd0cd3b73 graphics: rename gListen to glisten
We have both in the code.  Let's use only one format.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-05-20 10:05:56 +02:00
Nikolay Shirokovskiy
2d3940907d vz: cleanup: define vz format of uuids
vz puts uuids into curly braces. Simply introduce new contstant to reflect this
and get rid of magic +2 in code.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-19 14:57:13 +03:00
Nikolay Shirokovskiy
0ec30a24b8 vz: implement p2p migration
Peer to peer migration is implemented just as in managed case. Basically
it is copy paste from managed case but with all the branches that are not
applied to vz removed.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-19 14:57:13 +03:00
Nikolay Shirokovskiy
0eced74f34 vz: implement managed migration
The newest version of migration protocol - version 3 with parameters is implemented.
Supported flags is VIR_MIGRATE_PAUSED only. Supported parameters are
VIR_MIGRATE_PARAM_URI and VIR_MIGRATE_PARAM_DEST_NAME. VIR_MIGRATE_PARAM_DEST_XML
is in VZ_MIGRATION_PARAMETERS for technical onyl reasons.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-05-19 14:57:02 +03:00
Nikolay Shirokovskiy
17c37031e5 vz: fix const correctness case
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-19 14:56:00 +03:00
Nikolay Shirokovskiy
34075acf21 vz: save session uuid on login
This session uuid acts as authN token for different multihost vz operations one
of which is migration. Unfortunately we can't get it from server at any time
thus we need to save it at login.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-19 14:56:00 +03:00
Nikolay Shirokovskiy
d6734879c0 vz: drop prlsdkDomainHasSnapshots
Let's use introduced domain snapshots infrastructure instead.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-18 18:15:11 +03:00
Nikolay Shirokovskiy
abc85b2cab vz: add domain snapshots functionality
This solution does not keep snapshots cache because vz sdk lacks good support
for snapshot related events.

Libvirt and vz sdk has different approach to snapshot ids. vz sdk always
auto generate them while libvirt has ability to specify id by user.
Thus I have no other choice rather than simply ignore ids set by user
or generated by libvirt.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-05-18 18:14:58 +03:00
Maxim Nestratov
9ef05d597e Revert "vz: handle sourceless cdroms"
This reverts commit 071fe092.
It was committed by a mistake and correct patch was committed
earlier as baad90fb.
2016-05-17 15:11:35 +03:00
Nikolay Shirokovskiy
e10a4c67c3 vz: make error path code idiomatic
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-05-17 13:35:29 +03:00
Mikhail Feoktistov
4aef1a5e3e vz: fix template ct creation
First we don't need to add disk in this case. Second flag should
be skipped.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-17 13:35:29 +03:00
Nikolay Shirokovskiy
07761f5d39 vz: fix error message for readonly fs
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-17 13:35:29 +03:00
Mikhail Feoktistov
071fe09260 vz: handle sourceless cdroms
SDK handles empty cdroms all right. We just need to
pass "" instead of NULL (not setting is good too).

However we can get problems here. Disk detaching treats source
as ids. Fortunately disk detaching is not supported for cdroms
yet and for hard disks we can not get empty source - this is prohibitited
by xml parsing code.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-05-17 13:35:28 +03:00
Nikolay Shirokovskiy
caff6b8043 vz: fix vzCheckUnsupportedDisks format checks for cdroms
Current version of the function does not check format of cdroms at all.
At the same time prlsdkGetDiskInfo give hints that cdroms always
have format VIR_STORAGE_FILE_RAW. So fix vzCheckUnsupportedDisks.

About structure of checks. As we don't have means to store format
in SDK we always have only one format in every situation. So instead
of setting boolean let's get allowed format instead and finally compare
it to the requested. This structure of checks seems stable to me
because we have only one format in every situation.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-17 13:35:28 +03:00
Nikolay Shirokovskiy
38e1e06845 vz: remove check for auto file format for disks
VIR_STORAGE_FILE_AUTO can not be set from xml description.
At the same time we don't set disks format to this value
as for example qemu does. Thus this we can never get this
value in format.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-05-17 13:35:28 +03:00
Yuri Chornoivan
50fc4b4bdd Fix minor typos in messages
Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
2016-04-30 15:37:31 +02:00
Mikhail Feoktistov
cdbbb93a96 vz: fix disk enumeration
If we want to delete all disks for container or vm
we should make a loop from 0 to NumberOfDisks and always
use zero index in PrlVmCfg_GetHardDisk to get disk handle.
When we delete first disk after that numbers of other disks
will be changed, start from 0 to NumberOfDisks-1.
That's why we should always use zero index.
2016-04-28 20:24:09 +02:00
Nikolay Shirokovskiy
2df4685905 vz: fix config input device check
We don't have input devices in SDK thus for define/dumpxml
operations to be consistent we need to:

1. on dumpxml: infer input devices from other parts of config.
It is already done in prlsdkLoadDomain.

2. on define: check that input devices are the same that
will be infer back on dumpxml operation.

The second part should be fixed.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-20 18:26:58 +03:00
Nikolay Shirokovskiy
77dfa91192 vz: add default input devices on post parse
It is on par with prlsdkLoadDomain actions.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-20 18:26:35 +03:00
Mikhail Feoktistov
baad90fb1c vz: handle sourceless cdroms
libvirt handles empty source as NULL, while vz sdk as
"" thus we need a bit of conversion.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-19 19:52:38 +03:00
Nikolay Shirokovskiy
88c6c4ab96 vz: cleanup: remove trivial function 2016-04-19 19:52:37 +03:00
Nikolay Shirokovskiy
29439964a2 vz: fix boot check to use new disk id
Current implementation does not detect all incompatible configurations.
For example if we have in vzsdk bootorder "cdrom1, cdrom0" (that is
"hdb, hda" in case of ide cdroms) and cdroms do not have disk
images inserted. In this case boot order check code fails to
distiguish them at all as for both PrlVmDev_GetFriendlyName gives "".
Well the consequences are only missing warnings but as
we just have introduced all the necessary tools to face the problem -
let's fix it.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-19 19:52:37 +03:00
Nikolay Shirokovskiy
c7ba62009d vz: fix detach disk to use new disk id
Actually using disk PrlVmDev_GetFriendlyName as id on
detaching volumes is not a problem. We can only detach
hard disks and these can not have empty friendly names.
But upcoming update device functionality for cdroms
can not use disk source as id at all as update operation
typically change this same source value. Thus we will need
to use cdrom bus and cdrom target name as cdrom id. So in attempt
to use same id scheme for all purpuses lets fix hard disk
detach function to use new id.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-19 19:52:37 +03:00
Nikolay Shirokovskiy
bc5f2aab6d vz: introduce vzsdk disk id function
Our intention is to use disk bus and disk target name pair
as disk id instead of name returned by PrlVmDev_GetFriendlyName.
We already have the code that extracts this pair from vzsdk
data. Let's factor it out into a function.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-19 19:52:36 +03:00
Maxim Nestratov
9e783db282 vz: make it possible to use shared drivers API with vz driver connection
Since vz driver is now lives as a part of daemon we can benefit from
this fact and allow vz clients to use shared drivers API like storage,
network, nwfilter etc.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-15 10:21:00 +03:00
Nikolay Shirokovskiy
bc9d35ebfb vz: simplify getting strings from vzsdk
SDK does not allocate memory when getting strings thus we
need to call every function that returns string twice.
First to obtain string length, second to obtain string
itself. It is tedious so let's create helper functions
for cases when we know length of the result beforehand
and we are not.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-13 19:13:40 +03:00
Maxim Nestratov
6e4cb1eaef vz: minor cleanup
remove unnecessary vzConnectClose prototype and make
local structure vzDomainDefParserConfig be static

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:44 +03:00
Maxim Nestratov
52616fc5db vz: remove vzDriverLock/Unlock function
We don't need them anymore as all pointers within vzDriver structure
are not changed during the time it exists.
Where we still need to synchronize we use virObjectLock/Unlock as far
as vzDriver is lockable object.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:44 +03:00
Maxim Nestratov
6202b72387 vz: implement connectGetSysinfo hypervisor callback
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:44 +03:00
Maxim Nestratov
eb5e9c1ea9 vz: fix possible vzDomainDefineXMLFlags and prlsdkNewDomainByHandle race
Lock driver when a new domain is created in prlsdkNewDomainByHandle
and try to find it in the list under lock again because it can race
with vzDomainDefineXMLFlags when a domain with the same uuid is added
via vz dispatcher directly and libvirt define.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:44 +03:00
Maxim Nestratov
7762c5a233 vz: introduce new vzDriver lockable structure and use it
This patch introduces a new 'vzDriver' lockable object and provides
helper functions to allocate/destroy it and we pass it to prlsdkXxx
functions instead of virConnectPtr.
Now we store domain related objects such as domain list, capabitilies
etc. within a single vz_driver vzDriver structure, which is shared by
all driver connections. It is allocated during daemon initialization or
in a lazy manner when a new connection to 'vz' driver is established.
When a connection to vz daemon drops, vzDestroyConnection is called,
which in turn relays disconnect event to all connection to 'vz' driver.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-13 18:48:43 +03:00
Pavel Hrdina
6e76738e54 build: fix build on RHEL-6
GCC in RHEL-6 complains about listen:

../../src/conf/domain_conf.c:23718: error: declaration of 'listen' shadows a global declaration [-Wshadow]
/usr/include/sys/socket.h:204: error: shadowed declaration is here [-Wshadow]

This renames all the listen to gListen.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-04-13 17:28:50 +02:00
Mikhail Feoktistov
500f23767a vz: correct iomode check
Virtuozzo hypervisor supports native iomode.
So we should allow to add disk with iomode "native" or "default".
2016-04-13 18:21:58 +03:00
Pavel Hrdina
f53bb3eda9 use virDomainGraphicsGetListen instead of the other getters
There is no point the use two different getters on the same listen
structure few lines apart.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-04-13 10:43:49 +02:00
Maxim Nestratov
1ee1b58fc3 vz: add Hypervisor prefix to vz and parallels Driver structures 2016-04-12 21:05:21 +03:00
Maxim Nestratov
f376069fa5 vz: remove drivername field from vzConn structure
No need to remember connection name and have corresponding
domain type to keep backward compatibility with former
'parallels' driver. It is enough to be able to accept 'parallels'
uri and domain types.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-12 21:05:05 +03:00
Maxim Nestratov
419aaf23ce vz: change the order of capabilities reported
'vz' goes first now to make clients like virt-manager choose 'vz'
instead of 'parallels'

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-12 21:04:53 +03:00
Nikolay Shirokovskiy
4517eb0f4e vz: fix memory leak
we don't need to allocate macstr at all as it is an array
and already has the the space it needs.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-12 12:44:26 +03:00
Nikolay Shirokovskiy
ad584cbb6c vz: implement memory setting functions
Quite straigthforward as vz sdk memory setting function makes
just what we want to that is set "amount of physical memory
allocated to a domain".

'useflags' is introduced for non flag function implementation.
We can't just use combination of flags like "live | config" or
we fail for inactive domains. Other combinations have drawbacks
too.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-11 20:00:01 +03:00
Nikolay Shirokovskiy
3fbb7dba33 vz: factor out config update flags checks
Actually this is not pure refactoring. Part of common code is
replaced with virDomainObjUpdateModificationImpact and this
a good replacement. It includes removed check of inactive
domain and active flags set. Additionally we resolve
current flag in accordance with current state of domain.
Thus it becames possible to attach/detach devices for
inactive domains if this flag is set.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-11 19:58:30 +03:00
Nikolay Shirokovskiy
032c5bf988 vz: support boot order in domain xml dump
As usual we try to deal correctly with vz domains that were
created by other means and thus can have all range of SDK domain
parameters. If vz domain boot order can't be represented
in libvirt os boot section let's give warning and make os boot section
represent SDK to some extent.

1. Os boot section supports up to 4 boot devices. Here we just
cut SDK boot order up to this limit. Not too bad.

2. If there is a floppy in boot order let's just skip it.
Anyway we don't show it in the xml. Not too bad too.

3. SDK boot order with unsupported disks order. Say we have "hdb, hda" in
SDK. We can not present this thru os boot order. Well let's just
give warning but leave double <boot dev='hd'/> in xml. It's
kind of misleading but we warn you!

SDK boot order have an extra parameters 'inUse' and 'sequenceIndex'
which makes our task more complicated. In realitly however 'inUse'
is always on and 'sequenceIndex' is not less than 'boot position index'
which simplifies out task back again! To be on a safe side let's explicitly
check for this conditions!

We have another exercise here. We want to check for unrepresentable
condition 3 (see above). The tricky part is that in contrast to
domains defined thru this driver 3-rd party defined domains can
have device ordering different from default. Thus we need
some id to check that N-th boot disk of os boot section is same as
N-th boot disk of SDK boot. This is what prlsdkBootOrderCheck
for. It uses disks sources paths as id for disks and iface names
for network devices.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-07 16:21:41 +03:00
Nikolay Shirokovskiy
bc281f7d7d vz: fix disk order on load domain
We want to report boot order in dumpxml for vz domains.
Thus we want disks devices to be sorted in output compatible with boot
ordering specification. So let's just use virDomainDiskInsert
which makes appropriate sorting.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-04-07 16:21:40 +03:00
Nikolay Shirokovskiy
497dcafc2e vz: support boot order specification on define domain
The patch makes some refactoring of the existing code. Current boot order spec code
makes very simple thing in somewhat obscure way. In case of VMs
it sets the first hdd as the only bootable device. In case of CTs it
doesn't touch the boot order at all if one of the filesystems is mounted to root.
Otherwise like in case of VMs it sets the first hdd as the only bootable
device and additionally sets this device mount point to root. Refactored
code makes all this explicit.

The actual boot order support is simple. Common libvirt domain xml parsing
code makes the exact ordering of disks devices as described in docs
for boot ordering (disks are sorted by bus order first, device target
second. Bus order is the order of disk buses appearence in original
xml. Device targets order is alphabetical). We add devices in the
same order and SDK designates device indexes sequentially for each
device type. Thus device index is equal to its boot index. For
example N-th cdrom in boot specification refers to sdk cdrom with
it's device index N.

If there is no boot spec in xml the parsing code will add <boot dev='hdd'>
for HVMs automatically and we backward compatibly set fist hdd as
bootable.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-04-07 16:21:40 +03:00
Cole Robinson
9a423d1826 domain: Add virDomainDefAddImplicitDevices
It's just a combination of AddImplicitControllers, and AddConsoleCompat.
Every caller that wants ImplicitControllers also wants the ConsoleCompat
AFAICT, so lump them together. We also need it for future patches.
2016-03-20 16:11:04 -04:00
Michal Privoznik
865764de06 Drop paths.h include
We include the file in plenty of places. This is mostly due to
historical reasons. The only place that needs something from the
header file is storage_backend_fs which opens _PATH_MOUNTED. But
it gets the file included indirectly via mntent.h. At no other
place in our code we need _PATH_.*. Drop the include and
configure check then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-03-18 09:43:45 +01:00
Mikhail Feoktistov
ad29dbb31c vz: code refactoring
In prlsdkAddNet() Attach/DetachNet() functions
privconn should be the first argument
2016-03-17 15:20:20 +01:00
Mikhail Feoktistov
bb2f63da79 vz: set default SCSI model
Each version of virtuozzo supports only one type of SCSI controller
So if we add disk on SCSI bus, we should set SCSI controller model.
We can take it from vzCapabilities structure.
2016-03-16 19:34:27 +03:00
Mikhail Feoktistov
97841dd9e6 vz: check supported controllers
Because Vz6 supports SCSI(BUSLOGIC), IDE and SATA controllers only and
Vz7 supports SCSI(VIRTIO_SCSI) and IDE only we add list of supported
controllers and scsi models to vzCapabilities structure.
When a new  connection opens, we select proper capabilities values according
to Virtuozzo version and check them in XMLPostParse.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-03-16 19:34:27 +03:00
Mikhail Feoktistov
1de787b065 vz: report correct disk format in domainGetXMLDesc
We should report correct disk format depending on vz version and domain type.
Since we support only one disk format for each domain type, we can take it
from vzCapabilities structure.
2016-03-16 19:34:27 +03:00
Maxim Nestratov
a9555e202e vz: move prlsdkCheckDiskUnsupportedParams to vz_utils.c
As long as we have another function checking disk parameters correctness,
let's have them in one place. Here we change prefix of the moved function and
start to call it from vzCheckUnsupportedDisks rather than add disk.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-03-16 19:34:27 +03:00
Mikhail Feoktistov
adbe76fb42 vz: check supported disk format and bus
Now we check disk parameters correctness in DomainPostParse.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-03-16 19:34:27 +03:00
Mikhail Feoktistov
19d979edff vz: add vzCapabilities to connection structure
As far as Virtuozzo6 and Virtuozzo7 support different disk types for virtual
machines (ploop and qcow2 respectively) and different buses (vz6: IDE, SCSI,
SATA; vz7: IDE SCSI) we add vzCapabilities structure to help undestand which
disk formats and buses are supported in the context of a current connection.

When a new connection opens, we select proper capabilities in accordance to
current Virtuozzo version.
2016-03-16 19:34:26 +03:00
Mikhail Feoktistov
d10b02b5e5 vz: save vz version in connection structure
Move code from connectGetVersion callback to vzInitVersion function
2016-03-16 19:34:26 +03:00
Maxim Nestratov
8a74498721 vz: fix active domain listing
Since commit 9c14a9ab we have broken active domain listing
because reworked prlsdkLoadDomain doesn't set dom->def->id
propely. It just looses it when a new def structure is set.
Now we make prlsdkConvertDomainState function return void
and move calling it after an old dom->def is replaces with
a new one within prlsdkLoadDomain function.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2016-03-14 15:12:10 +03:00
Peter Krempa
185d13b1b0 conf: refactor checking for unsupported memory devices
Introduce a helper to check supported device and domain config and move
the memory hotplug checks to it.

The advantage of this approach is that by default all new features are
considered unsupported by all hypervisors unless specifically changed
rather than the previous approach where every hypervisor would need to
declare that a given feature is unsupported.
2016-03-09 10:09:16 +01:00
Nikolay Shirokovskiy
4b4fbfe406 vz: implement connection close notification
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2016-03-01 14:18:16 +00:00
Mikhail Feoktistov
9c14a9ab42 vz: fix race condition when adding domain to domains list
Race condition:
User calls defineXML to create new instance.
The main thread from vzDomainDefineXMLFlags() creates new instance by prlsdkCreateVm.
Then this thread calls prlsdkAddDomain to add new domain to domains list.
The second thread receives notification from hypervisor that new VM was created.
It calls prlsdkHandleVmAddedEvent() and also tries to add new domain to domains list.
These two threads call virDomainObjListFindByUUID() from prlsdkAddDomain() and don't find new domain.
So they add two domains with the same uuid to domains list.

This fix splits logic of prlsdkAddDomain() into two functions.
1. vzNewDomain() creates new empty domain in domains list with the specific uuid.
2. prlsdkLoadDomain() add data from VM to domain object.

New algorithm for creating an instance:
In vzDomainDefineXMLFlags() we add new domain to domain list by calling vzNewDomain()
and only after that we call CreateVm() to create VM.
It means that we "reserve" domain object with the specific uuid.
After creation of new VM we add info from this VM
to reserved domain object by calling prlsdkLoadDomain().

Before this patch prlsdkLoadDomain() worked in 2 different cases:
1. It creates and initializes new domain. Then updates it from sdk handle.
2. It updates existed domain from sdk handle.
In this patch we remove code which creates new domain from LoadDomain()
and move it to vzNewDomain().
Now prlsdkLoadDomain() only updates domain from skd handle.

In notification handler prlsdkHandleVmAddedEvent() we check
the existence of a domain and if it doesn't exist we add new domain by calling
vzNewDomain() and load info from sdk handle via prlsdkLoadDomain().
2016-02-12 13:32:03 +03:00
Mikhail Feoktistov
d5f0cf990b vz: fix notification subscription
Bug cause:
Update the domain that is subscribed to hypervisor notification.
LoadDomain() rewrites notifications fields in vzDomObj structure and makes domain as "unsubscribed".
Fix:
Initialize notification fields in vzDomObj only if we create a new domain.
And do not reinitialize these fields if we update domain (by calling LoadDomain with olddom argument)
2016-02-12 13:32:01 +03:00
Mikhail Feoktistov
a7b2257e9a vz: remove unused struct field
In commit 7039bb3c we have removed code that saves uuid to vzDomObj.uuid
So this field is no longer needed.
2016-02-12 13:31:58 +03:00
Mikhail Feoktistov
2286986a9c vz: make output arguments in prlsdkGetDomainIds as optional
prlsdkGetDomainIds() returns name and uuid for specified instance.
Now output arguments can be NULL.
It allows to get only necessary info(name or uuid).
2016-02-12 13:31:56 +03:00
Peter Krempa
d2a6fc79e3 conf: Store cpu pinning data in def->vcpus
Now with the new struct the data can be stored in a much saner place.
2016-02-08 09:51:34 +01:00
Peter Krempa
856f254eef conf: Don't copy def->cpumask into cpu pinning info
This step can be omitted, so that drivers can decide what to do when the
user requests to use default vcpu pinning.
2016-02-08 09:51:34 +01:00
Joao Martins
d239a5427f conf: add caps to virDomainDefFormat*
And use the newly added caps->host.netprefix (if it exists) for
interface names that match the autogenerated target names.

Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
2016-02-04 12:38:26 +00:00
Peter Krempa
68ee703bfe vz: Fix invalid iteration of def->cputune.vcpupin
The array doesn't necessarily have the same cardinality as the count of
vCPUs for a domain. Iterating it can cause access beyond the end of the
array.
2016-01-25 17:45:09 +01:00
Martin Kletzander
93103da84b Provide parse flags to PostParse functions
This way both Domain and Device PostParse functions can act based on the
flags.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2016-01-11 10:54:50 +01:00
Maxim Nestratov
635daa2556 vz: BUG: fix connecting hang in case of init failure
In case of prlsdkLoadDomains fails, vzOpenDefault should
clear connection privateData pointer every time its
memory is actually freed.
Also it is not necessary to call vzConnectClose if a call
to vzOpenDefault fails, because they both make cleanup of
connection privateData.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-12-24 18:31:05 +03:00
Maxim Nestratov
6b4b916da4 vz: support additional flags in domain undefine
Implement VIR_DOMAIN_UNDEFINE_MANAGED_SAVE and
VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA flags support.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-12-24 14:20:56 +03:00
Maxim Nestratov
64b3bb7b15 vz: move prlsdkCleanupBridgedNet after domain deletion
prlsdkCleanupBridgedNet call should be made strongly after
any actual domain deletion accurs. By doing this we avoid
any potential problems connected with second undefine call
when it is made after first one fails by some reason, and
we detect that network is already deleted.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-12-24 14:20:56 +03:00
Maxim Nestratov
b733739416 vz: delete domains when undefine is called
Currently vz driver unregisters domains when undefine is called,
which is wrong because it contradicts with expected behavior.
All vz domains are persistent, which means that when one is
defined a new bundle directory containing meta data is created.
Undefining domains in a way we do now leaves those directories
undeleted, which prevents subsequent define call for the same
domain xml. I.e. the following sequence define->undefine->define
doesn't work now.
The patch fixes the problem by calling PrlVm_Delete instead of
PrlVm_Unreg detaching all disks prior actually doing this to
prevent images deletion.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-12-24 14:20:56 +03:00
Peter Krempa
71c89ac9df conf: Replace read accesses to def->vcpus with accessor 2015-12-09 14:57:12 +01:00
Peter Krempa
957d597330 conf: Replace writes to def->vcpus with accessor 2015-12-09 14:57:12 +01:00
Peter Krempa
d1dda68777 conf: Replace read access to def->maxvcpus with accessor
Finalize the refactor by adding the 'virDomainDefGetVCpusMax' getter and
reusing it accross libvirt.
2015-12-09 14:57:12 +01:00
Peter Krempa
c970c4a5ea conf: Add helper to check whether domain has offline vCPUs
The new helper will simplify checking whether the domain config contains
inactive vCPUs.
2015-12-09 14:57:12 +01:00
Peter Krempa
4e187169f0 conf: Replace writes to def->maxvcpus with accessor
To support further refactors replace all write access to def->maxvcpus
with a accessor function.
2015-12-09 14:57:12 +01:00
Michal Privoznik
90f3c0d717 conf: Split virDomainObjList into a separate file
Our domain_conf.* files are big enough. Not only they contain XML
parsing code, but they served as a storage of all functions whose
name is virDomain prefixed. This is just wrong as it gathers not
related functions (and modules) into one big file which is then
harder to maintain. Split virDomainObjList module into a separate
file called virdomainobjlist.[ch].

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-11-30 13:55:10 +01:00
Marc-André Lureau
56a4fe2818 Replace support{2d,3d} with accel{2d,3d}
Following the domain XML naming

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2015-11-27 16:48:53 +01:00
Pavel Hrdina
3d0c59e5bb Post-release version bump to 1.3.0
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-11-24 13:52:14 +01:00
Mikhail Feoktistov
dbc7819921 vz: implementation of domainReboot callback
Diff from v1.
1. Add virCheckFlags() call in vzDomainReboot
2015-11-19 16:19:27 +03:00
Mikhail Feoktistov
1158184f05 vz: allow only en-us keymap for VNC
In virtuozzo we support only en-us keymap for VMs and containers.
If keymap is specified than check that it's en-us, otherwise
show error message.
2015-11-19 15:53:07 +03:00
Nikolay Shirokovskiy
db92aee2b4 vz: support cpu time in driver's domainGetInfo
Just straight-forward patch.
Use reference counting for privdom as stats internally could drop domain lock.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
2015-11-10 16:24:47 +03:00
Ishmanpreet Kaur Khera
32cee5b2f0 Avoid using !STREQ and !STRNEQ
We have macros for both positive and negative string matching.
Therefore there is no need to use !STREQ or !STRNEQ. At the same
time as we are dropping this, new syntax-check rule is
introduced to make sure we won't introduce it again.

Signed-off-by: Ishmanpreet Kaur Khera <khera.ishman@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-10-21 15:03:35 +02:00
Maxim Nestratov
b3ea63b581 vz: implement some domain API calls
The following functions are implemented:

vzDomainIsUpdated, vzDomainGetVcpusFlags and vzDomainGetMaxVcpus.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-20 09:58:17 +03:00
Maxim Nestratov
4ff36e742b vz: implement API calls of nodeGetxxx family
The following functions were implemented:

 vzNodeGetCPUStats, vzNodeGetMemoryStats,
 vzNodeGetCellsFreeMemory and vzNodeGetFreeMemory.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-20 09:58:17 +03:00
Maxim Nestratov
e16dd5f2d2 vz: implement connectGetMaxVcpus API calls
Because we have no limitation for maximal number of vcpus in containers
we report as maximum 1028 just for the sake of common sence.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-20 09:58:17 +03:00
Wei Jiangang
c3d4eb124c Fix conficts with HACKING doc
Don't compare a bool variable against the literal, "true".

Signed-off-by: Wei Jiangang <weijg.fnst@cn.fujitsu.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2015-10-15 11:31:27 +02:00
Maxim Nestratov
04a39574a8 vz: cleanup
Remove unused definitions, functions and structure fields.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-08 16:44:48 +03:00
Maxim Nestratov
bd6ae7b8ab vz: remove storage driver as never used
In fact, it was never used as far as vz has no features supporting it.
That is why there will be no harm to anyone if we just remove this code to
prevent further misunderstanding and efforts to support dead code.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-06 18:22:47 +03:00
Maxim Nestratov
439f29e78c vz: remove network driver as never used
At the time this code was added we had intentions to support libvirt interface
to manage vz networks. In fact, it was never implemented completely to work
correctly that makes me think that there will be no harm to anyone if we just
rip it off. Moreover, in vz7 we started to use libvirt bridge network driver to
manage networks.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-10-06 18:22:47 +03:00
Peter Krempa
8059a99025 conf: Rename max_balloon to total_memory
The name of the variable was misleading. Rename it and it's setting
accessor before other fixes.
2015-09-22 16:09:28 +02:00
Peter Krempa
5dd61a168f libxl: vz: Use accessor instead of direct access for max_balloon
Commits 45697fe5 and f863ac80 used direct access to the variable instead
of the preferred accessor method.
2015-09-22 16:09:27 +02:00
Maxim Nestratov
91c8e75f44 vz: remove error logging from prlsdkUUIDParse
As far as not every call of prlsdkUUIDParse assume correct UUID
supplied, there is no use to complain about wrong format in it.
Otherwise our log is flooded with false error messages.
For instance, calling prlsdkUUIDParse from prlsdkEventsHandler
works as a filter and in case of uuid absence for event issuer,
we simply know that we shouldn't continue further processing.
Instead of error logging for all calls we should explicitly take
into accaunt where it is called from.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-09-21 13:56:12 +02:00
John Ferlan
b97b30480d nodeinfo: Add sysfs_prefix to nodeCapsInitNUMA
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_CPU_PATH which is a
derivative of SYSFS_SYSTEM_PATH

Use cpupath for nodeCapsInitNUMAFake and remove SYSFS_CPU_PATH
2015-07-13 15:59:32 -04:00
John Ferlan
29e4f2243f nodeinfo: Add sysfs_prefix to nodeGetInfo
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
John Ferlan
f1c6179f0d nodeinfo: Add sysfs_prefix to nodeGetCPUMap
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
John Ferlan
f1a43a0f91 nodeinfo: Add sysfs_prefix to nodeGetCPUCount
Add the sysfs_prefix argument to the call to allow for setting the
path for tests to something other than SYSFS_SYSTEM_PATH.
2015-07-13 15:59:32 -04:00
Dmitry Guryanov
f6d908a2f3 vz: fix cleanup of nets of bridged type
We create a virtual network of special type, which
has the same name as bridge name to create bridged
network adapter in vz. So when we delete such an
adapter we have to remove corresponding virtual
network.

So let's rename prlsdkDelNet to prlsdkCleanupBridgedNet
and don't check for return value.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
2015-07-10 16:37:57 +03:00
Maxim Nestratov
7d73ca06ce vz: use PRL_USE_VNET_NAME_FOR_BRIDGE_NAME
It is better not to assume that newly created network should be
connected to a bridge with same name, but specify it explicitly
by PRL_USE_VNET_NAME_FOR_BRIDGE_NAME flag.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
2015-07-08 17:21:11 +03:00