|
@@ -155,7 +155,7 @@ def ping(self, timeout: Optional[float]) -> bool:
|
|
|
|
|
|
def fsfreeze(self, cmd: str) -> object:
|
|
|
if cmd not in ['status', 'freeze', 'thaw']:
|
|
|
- raise Exception('Invalid command: ' + cmd)
|
|
|
+ raise ValueError('Invalid command: ' + cmd)
|
|
|
# Can be int (freeze, thaw) or GuestFsfreezeStatus (status)
|
|
|
return getattr(self.qga, 'fsfreeze' + '_' + cmd)()
|
|
|
|
|
@@ -167,7 +167,7 @@ def fstrim(self, minimum: int) -> Dict[str, object]:
|
|
|
|
|
|
def suspend(self, mode: str) -> None:
|
|
|
if mode not in ['disk', 'ram', 'hybrid']:
|
|
|
- raise Exception('Invalid mode: ' + mode)
|
|
|
+ raise ValueError('Invalid mode: ' + mode)
|
|
|
|
|
|
try:
|
|
|
getattr(self.qga, 'suspend' + '_' + mode)()
|
|
@@ -178,7 +178,7 @@ def suspend(self, mode: str) -> None:
|
|
|
|
|
|
def shutdown(self, mode: str = 'powerdown') -> None:
|
|
|
if mode not in ['powerdown', 'halt', 'reboot']:
|
|
|
- raise Exception('Invalid mode: ' + mode)
|
|
|
+ raise ValueError('Invalid mode: ' + mode)
|
|
|
|
|
|
try:
|
|
|
self.qga.shutdown(mode=mode)
|