summaryrefslogtreecommitdiff
path: root/azurelinuxagent/pa
diff options
context:
space:
mode:
Diffstat (limited to 'azurelinuxagent/pa')
-rw-r--r--azurelinuxagent/pa/provision/cloudinit.py9
-rw-r--r--azurelinuxagent/pa/provision/default.py52
-rw-r--r--azurelinuxagent/pa/provision/factory.py2
-rw-r--r--azurelinuxagent/pa/rdma/suse.py2
4 files changed, 9 insertions, 56 deletions
diff --git a/azurelinuxagent/pa/provision/cloudinit.py b/azurelinuxagent/pa/provision/cloudinit.py
index fa47799..c674526 100644
--- a/azurelinuxagent/pa/provision/cloudinit.py
+++ b/azurelinuxagent/pa/provision/cloudinit.py
@@ -26,9 +26,9 @@ from datetime import datetime
import azurelinuxagent.common.conf as conf
import azurelinuxagent.common.logger as logger
import azurelinuxagent.common.utils.fileutil as fileutil
+import azurelinuxagent.common.utils.shellutil as shellutil
-from azurelinuxagent.common.event import elapsed_milliseconds, \
- WALAEventOperation
+from azurelinuxagent.common.event import elapsed_milliseconds
from azurelinuxagent.common.exception import ProvisionError, ProtocolError
from azurelinuxagent.common.future import ustr
from azurelinuxagent.common.protocol import OVF_FILE_NAME
@@ -64,12 +64,9 @@ class CloudInitProvisionHandler(ProvisionHandler):
logger.info("Finished provisioning")
self.report_ready(thumbprint)
- self.report_event("Provisioning with cloud-init succeeded",
+ self.report_event("Provision succeed",
is_success=True,
duration=elapsed_milliseconds(utc_start))
- self.report_event(self.create_guest_state_telemetry_messsage(),
- is_success=True,
- operation=WALAEventOperation.GuestState)
except ProvisionError as e:
logger.error("Provisioning failed: {0}", ustr(e))
diff --git a/azurelinuxagent/pa/provision/default.py b/azurelinuxagent/pa/provision/default.py
index 44e171b..d278975 100644
--- a/azurelinuxagent/pa/provision/default.py
+++ b/azurelinuxagent/pa/provision/default.py
@@ -22,7 +22,6 @@ Provision handler
import os
import os.path
import re
-import socket
import time
from datetime import datetime
@@ -89,14 +88,10 @@ class ProvisionHandler(object):
self.write_provisioned()
- self.report_event("Provisioning succeeded",
+ self.report_event("Provision succeed",
is_success=True,
duration=elapsed_milliseconds(utc_start))
- self.report_event(self.create_guest_state_telemetry_messsage(),
- is_success=True,
- operation=WALAEventOperation.GuestState)
-
self.report_ready(thumbprint)
logger.info("Provisioning complete")
@@ -269,53 +264,12 @@ class ProvisionHandler(object):
logger.info("Deploy ssh key pairs.")
self.osutil.deploy_ssh_keypair(ovfenv.username, keypair)
- def report_event(self, message, is_success=False, duration=0,
- operation=WALAEventOperation.Provision):
+ def report_event(self, message, is_success=False, duration=0):
add_event(name=AGENT_NAME,
message=message,
duration=duration,
is_success=is_success,
- op=operation)
-
- def get_cpu_count(self):
- try:
- count = len([x for x in open('/proc/cpuinfo').readlines()
- if x.startswith("processor")])
- return count
- except Exception as e:
- logger.verbose(u"Failed to determine the CPU count: {0}.", ustr(e))
- pass
- return -1
-
- def get_mem_size_mb(self):
- try:
- for line in open('/proc/meminfo').readlines():
- m = re.match('^MemTotal:\s*(\d+) kB$', line)
- if m is not None:
- return int(int(m.group(1)) / 1024)
- except Exception as e:
- logger.verbose(u"Failed to determine the memory size: {0}..", ustr(e))
- pass
- return -1
-
- def create_guest_state_telemetry_messsage(self):
- """
- Create a GuestState JSON message that contains the current CPU, Memory
- (MB), and hostname of the guest.
-
- e.g.
-
- {
- "cpu": 1,
- "mem": 1024,
- "hostname": "server1234"
- }
- """
- cpu = self.get_cpu_count()
- mem = self.get_mem_size_mb()
-
- return """{{"cpu": {0}, "mem": {1}, "hostname": "{2}"}}"""\
- .format(cpu, mem, socket.gethostname())
+ op=WALAEventOperation.Provision)
def report_not_ready(self, sub_status, description):
status = ProvisionStatus(status="NotReady", subStatus=sub_status,
diff --git a/azurelinuxagent/pa/provision/factory.py b/azurelinuxagent/pa/provision/factory.py
index 9e88618..d87765f 100644
--- a/azurelinuxagent/pa/provision/factory.py
+++ b/azurelinuxagent/pa/provision/factory.py
@@ -16,7 +16,9 @@
#
import azurelinuxagent.common.conf as conf
+import azurelinuxagent.common.logger as logger
+from azurelinuxagent.common.utils.textutil import Version
from azurelinuxagent.common.version import DISTRO_NAME, DISTRO_VERSION, \
DISTRO_FULL_NAME
diff --git a/azurelinuxagent/pa/rdma/suse.py b/azurelinuxagent/pa/rdma/suse.py
index 2b6ae29..729c842 100644
--- a/azurelinuxagent/pa/rdma/suse.py
+++ b/azurelinuxagent/pa/rdma/suse.py
@@ -91,7 +91,7 @@ class SUSERDMAHandler(RDMAHandler):
logger.info("Package '%s' is not a match." % entry)
else:
logger.info("Package '%s' is a match. Installing." % entry)
- complete_name = '%s-%s' % (package_name, entry)
+ complete_name = '%s-%s' % (package_name, version)
cmd = zypper_install % complete_name
result = shellutil.run(cmd)
if result: