[virt-who] spec: set default permissions for config file to 600
by Radek Novacek
commit bfd585fe39f025c911440b5015ae983dcf8ee262
Author: Radek Novacek <rnovacek(a)redhat.com>
Date: Thu Apr 17 11:23:04 2014 +0200
spec: set default permissions for config file to 600
virt-who.spec | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/virt-who.spec b/virt-who.spec
index 9ae4fed..0c7e069 100644
--- a/virt-who.spec
+++ b/virt-who.spec
@@ -67,7 +67,7 @@ fi
%{_bindir}/virt-who
%{_datadir}/virt-who/
%{_sysconfdir}/rc.d/init.d/virt-who
-%config(noreplace) %{_sysconfdir}/sysconfig/virt-who
+%attr(600, root, root) %config(noreplace) %{_sysconfdir}/sysconfig/virt-who
%{_mandir}/man8/virt-who.8.gz
%{_sharedstatedir}/%{name}
10 years
[virt-who] hyperv: support Windows Server 2012 R2
by Radek Novacek
commit a6bad4fb804e50da3cfbe8f0db492a94f858c2a1
Author: Radek Novacek <rnovacek(a)redhat.com>
Date: Thu Apr 3 15:25:31 2014 +0200
hyperv: support Windows Server 2012 R2
root/virtualization namespace is no longer present in 2012 server R2, so
we need to use root/virtualization/v2 namespace if not available.
hyperv.py | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/hyperv.py b/hyperv.py
index 3dc25c2..189366e 100644
--- a/hyperv.py
+++ b/hyperv.py
@@ -67,6 +67,7 @@ class HyperVSoap(object):
def post(self, body):
self.headers["Content-Length"] = "%d" % len(body)
+ self.headers["Content-Type"] = "application/soap+xml;charset=UTF-8"
self.connection.request("POST", self.url, body=body, headers=self.headers)
response = self.connection.getresponse()
if response.status == 401:
@@ -152,6 +153,10 @@ class HyperV:
self.username = username
self.password = password
+ # First try to use old API (root/virtualization namespace) if doesn't
+ # work, go with root/virtualization/v2
+ self.useNewApi = False
+
# Parse URL and create proper one
if "//" not in url:
url = "//" + url
@@ -273,8 +278,22 @@ class HyperV:
guests = []
connection, headers = self.connect()
hypervsoap = HyperVSoap(self.url, connection, headers)
- # SettingType == 3 means current setting, 5 is snapshot - we don't want snapshots
- uuid = hypervsoap.Enumerate("select BIOSGUID from Msvm_VirtualSystemSettingData where SettingType = 3")
+ try:
+ if not self.useNewApi:
+ # SettingType == 3 means current setting, 5 is snapshot - we don't want snapshots
+ uuid = hypervsoap.Enumerate("select BIOSGUID from Msvm_VirtualSystemSettingData where SettingType = 3", "root/virtualization")
+ else:
+ # Filter out Planned VMs and snapshots, see
+ # http://msdn.microsoft.com/en-us/library/hh850257%28v=vs.85%29.aspx
+ uuid = hypervsoap.Enumerate("select BIOSGUID from Msvm_VirtualSystemSettingData "
+ "where VirtualSystemType = 'Microsoft:Hyper-V:System:Realized'", "root/virtualization/v2")
+ except HyperVException, e:
+ if not self.useNewApi:
+ self.logger.debug("Error when enumerating using root/virtualization namespace, trying root/virtualization/v2 namespace")
+ self.useNewApi = True
+ return self.getHostGuestMapping()
+ raise
+
for instance in hypervsoap.Pull(uuid):
guests.append(HyperV.decodeWinUUID(instance["BIOSGUID"]))
uuid = hypervsoap.Enumerate("select UUID from Win32_ComputerSystemProduct", "root/cimv2")
10 years