Commit Graph

219 Commits

Author SHA1 Message Date
Matt Coleman
e6d09928b6 hyperv: use g_autoptr for WMI classes in hypervNodeGetInfo
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:25 -05:00
Matt Coleman
770186542f hyperv: use g_autoptr for Msvm_ProcessorSettingData in hypervConnectGetMaxVcpus
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:25 -05:00
Matt Coleman
067168bf69 hyperv: use g_autoptr for Win32_ComputerSystem in hypervConnectGetHostname
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:25 -05:00
Matt Coleman
1c603b7c02 hyperv: use g_autoptr for Win32_OperatingSystem in hypervConnectOpen
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:24 -05:00
Matt Coleman
7c34b298db hyperv: enable automatic cleanup for OpenWSMAN types
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:24 -05:00
Matt Coleman
a245dbdd4a hyperv: enable use of g_autoptr for the rest of the CIM/WMI classes
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:24 -05:00
Matt Coleman
e668d4a57d hyperv: enable use of g_autoptr for hypervObject
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:24 -05:00
Matt Coleman
4d01763e3f hyperv: store hypervPrivate in hypervObject
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:24 -05:00
Matt Coleman
b0c3fa390b hyperv: store the Hyper-V version when connecting
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:24 -05:00
Matt Coleman
0fec6ab9b5 hyperv: add a macro for retrieving setting data
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Laine Stump <laine@redhat.com>
2021-01-22 14:04:24 -05:00
Matt Coleman
86fb766d54 hyperv: implement domainAttachDevice and domainAttachDeviceFlags
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
fdc0222095 hyperv: attach floppy disks when defining domains
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
91b3725099 hyperv: attach virtual optical disks when defining domains
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
e1eba7bff4 hyperv: attach physical disks when defining domains
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
677cea803c hyperv: attach virtual disks when defining domains
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
ee86227d87 hyperv: create SCSI controllers when defining domains
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
843aba699e hyperv: add hypervMsvmVSMSAddResourceSettings
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
9f38929625 hyperv: implement domainDefineXML
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
c79da543c8 hyperv: implement domainUndefine and domainUndefineFlags
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Matt Coleman
65e1b4fd26 hyperv: ambiguous VM names will throw an error
Since Hyper-V allows multiple VMs to be created with the same name,
some commands produce unpredictable results due to
hypervDomainLookupByName's WMI query selecting the wrong domain.

For example, this prevents `virsh dumpxml` from outputting XML for the
wrong domain.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-21 10:18:21 +01:00
Ján Tomko
641fd93de1 hyperv: remove duplicit addr check
We already check addr is not negative right after filling
its value. There's no need to check it before using it too.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: a7a1d1f59e
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-12-10 12:58:54 +01:00
Matt Coleman
a7a1d1f59e hyperv: XML parsing of storage volumes
dumpxml can now serialize:
* floppy drives
* file-backed and device-backed disk drives
* images mounted to virtual CD/DVD drives
* IDE and SCSI controllers

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
2020-11-24 18:45:07 +00:00
Pavel Hrdina
2b58ce9155 hyperv_wmi: remove unreachable cleanup code
In the cleanup section @data will always be NULL.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-11-16 17:14:04 +01:00
Matt Coleman
0b27822472 hyperv: implement domainSetVcpus and domainSetVcpusFlags
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
30525b759b hyperv: implement domainGetMaxVcpus
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
b516400976 hyperv: implement domainGetVcpusFlags
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
01a93d55a0 hyperv: implement domainGetVcpus
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 18:58:57 +01:00
Matt Coleman
08aed0888f hyperv: implement domainGetScheduler*
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:57 +01:00
Matt Coleman
16fb99c7a1 hyperv: refactor hypervDomainSetMemoryProperty
* use hypervMsvmVSMSModifyResourceSettings()
* improve the error message: say which property it failed to set
* remove usage of VIR_FREE()

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:54 +01:00
Matt Coleman
5df9f9dadf hyperv: add hypervMsvmVSMSModifyResourceSettings
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:52 +01:00
Matt Coleman
5f3915a334 hyperv: implement domainSetMaxMemory
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:42 +01:00
Matt Coleman
5b389613e6 hyperv: move hypervDomainSetMemory and hypervDomainSetMemoryFlags
This matches their placement in struct _virHypervisorDriver.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:39 +01:00
Matt Coleman
14951313d9 hyperv: implement domainGetMaxMemory
Co-authored-by: Sri Ramanujam <sramanujam@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-12 09:43:33 +01:00
Daniel P. Berrangé
18c73a4c70 meson: drop use of .path() for python args
When using .path() for an argument to a python script meson will not
setup dependancies on the file. This means that changes to the generator
script will not trigger a rebiuld

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-09 16:32:55 +00:00
Matt Coleman
8a9eb5de0c hyperv: remove hypervWmiClassInfoList, hypervWmiClassInfoListPtr, and _hypervWmiClassInfoList
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matt Coleman <matt@datto.com>
2020-11-09 15:26:02 +00:00
Matt Coleman
0e43ccb838 hyperv: remove support for multiple API versions from the WMI generator
All Msvm_* classes are assumed to be V2, now.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matt Coleman <matt@datto.com>
2020-11-09 15:26:02 +00:00
Daniel P. Berrangé
b920556979 hyperv: remove V1 classes from the WMI generator input
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matt Coleman <matt@datto.com>
2020-11-09 15:26:02 +00:00
Matt Coleman
a4b8722f36 hyperv: remove hypervPrivate->wmiVersion
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matt Coleman <matt@datto.com>
2020-11-09 15:26:02 +00:00
Peter Krempa
62a01d84a3 util: hash: Retire 'virHashTable' in favor of 'GHashTable'
Don't hide our use of GHashTable behind our typedef. This will also
promote the use of glibs hash function directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Matt Coleman <matt@datto.com>
2020-11-06 10:40:51 +01:00
Peter Krempa
4eb8e9ae8b util: hash: Rewrite sorting of elements in virHashGetItems
All but one of the callers either use the list in arbitrary order or
sorted by key. Rewrite the function so that it supports sorting by key
natively and make it return the element count. This in turn allows to
rewrite the only caller to sort by value internally.

This allows to remove multiple sorting functions which were sorting by
key and the function will be also later reused for some hash operations
internally.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Matt Coleman <matt@datto.com>
2020-11-06 10:31:57 +01:00
Matt Coleman
7795712ddc hyperv: call openwsman's ws_serializer_free_mem
This should have been included with the upgrade to openwsman 2.6.3.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-03 11:30:11 +01:00
Matt Coleman
3b52bcfa43 hyperv: minor formatting fix in hyperv_wmi.h
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-03 11:29:38 +01:00
Matt Coleman
d2ab8a530c hyperv: consistent names for SettingData functions
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-03 11:29:14 +01:00
Matt Coleman
87e062415f hyperv: move hypervGetProcSDByVSSDInstanceId to hyperv_wmi.c
This places it next to existing related functions.

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-03 11:28:57 +01:00
Matt Coleman
add5cd8a3c hyperv: move hypervGetWmiClass to hyperv_wmi.h
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-03 11:28:25 +01:00
Matt Coleman
58ae6be649 hyperv: WMI class list function general cleanup
* use the same section comment in the header and code
* place the items in the same relative location within the .h and .c
* one parameter per line for multiline function definitions

Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-03 11:27:37 +01:00
Matt Coleman
db294a7eec hyperv: remove spaces after hypervObject* casts
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-03 11:26:15 +01:00
Matt Coleman
f5dadf9a71 hyperv: g_autofree username and password in hypervConnectOpen()
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-03 11:24:47 +01:00
Matt Coleman
b1a06feed7 hyperv: do not overwrite errors from hypervInvokeMethod()
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-02 18:44:21 +01:00
Matt Coleman
f1c406a9aa hyperv: reduce duplicate code for Msvm_ComputerSystem lookups
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-11-02 18:44:21 +01:00