Add code to eject dvd inside guest vm

This commit is contained in:
Yue Zhang
2015-08-06 23:37:02 +08:00
parent 6ace1354d0
commit f4b279dc2c
3 changed files with 8 additions and 1 deletions
+5
View File
@@ -342,6 +342,11 @@ class DefaultOSUtil(object):
retcode = self.umount(mount_point, chk_err=chk_err)
if chk_err and retcode != 0:
raise OSUtilError("Failed to umount dvd.")
def eject_dvd(self, chk_err=True):
retcode = shellutil.run("eject")
if chk_err and retcode != 0:
raise OSUtilError("Failed to eject dvd")
def load_atappix_mod(self):
if self.is_atapiix_mod_loaded():
+1
View File
@@ -59,6 +59,7 @@ def copy_ovf_env():
ovf_file_path = os.path.join(OSUTIL.get_lib_dir(), OVF_FILE_NAME)
fileutil.write_file(ovf_file_path, ovfxml)
OSUTIL.umount_dvd()
OSUTIL.eject_dvd()
except IOError as e:
raise ProtocolError(text(e))
except OSUtilError as e:
+2 -1
View File
@@ -22,8 +22,9 @@ import azurelinuxagent.utils.restutil as restutil
from azurelinuxagent.protocol.common import *
ENDPOINT='169.254.169.254'
APIVERSION='2015-05-01-preview'
#TODO use http for azure pack test
#ENDPOINT='localhost'
APIVERSION='2015-05-01-preview'
BASE_URI = "http://{0}/Microsoft.Compute/{1}?api-version={{{2}}}{3}"
def _add_content_type(headers):