"""Create a block device.
"""
- bdev_s, size, on_primary, info = params
+ bdev_s, size, owner, on_primary, info = params
bdev = objects.Disk.FromDict(bdev_s)
if bdev is None:
raise ValueError("can't unserialize data!")
- return backend.CreateBlockDevice(bdev, size, on_primary, info)
+ return backend.CreateBlockDevice(bdev, size, owner, on_primary, info)
@staticmethod
def perspective_blockdev_remove(params):
"""Assemble a block device.
"""
- bdev_s, on_primary = params
+ bdev_s, owner, on_primary = params
bdev = objects.Disk.FromDict(bdev_s)
if bdev is None:
raise ValueError("can't unserialize data!")
- return backend.AssembleBlockDevice(bdev, on_primary)
+ return backend.AssembleBlockDevice(bdev, owner, on_primary)
@staticmethod
def perspective_blockdev_shutdown(params):
"""Query detailed information about existing OSes.
"""
- os_list = backend.DiagnoseOS()
- if not os_list:
- # this catches also return values of 'False',
- # for which we can't iterate over
- return os_list
- result = []
- for data in os_list:
- if isinstance(data, objects.OS):
- result.append(data.ToDict())
- elif isinstance(data, errors.InvalidOS):
- result.append(data.args)
- else:
- raise errors.ProgrammerError("Invalid result from backend.DiagnoseOS"
- " (class %s, %s)" %
- (str(data.__class__), data))
-
- return result
+ return [os.ToDict() for os in backend.DiagnoseOS()]
@staticmethod
def perspective_os_get(params):
"""
name = params[0]
try:
- os_obj = backend.OSFromDisk(name).ToDict()
+ os_obj = backend.OSFromDisk(name)
except errors.InvalidOS, err:
- os_obj = err.args
- return os_obj
+ os_obj = objects.OS.FromInvalidOS(err)
+ return os_obj.ToDict()
# hooks -----------------------
hr = backend.HooksRunner()
return hr.RunHooks(hpath, phase, env)
+ # test -----------------------
+
+ @staticmethod
+ def perspective_test_delay(params):
+ """Run test delay.
+
+ """
+ duration = params[0]
+ return utils.TestDelay(duration)
+
class MyRealm:
"""Simple realm that forwards all requests to a ServerObject.
"""
options, args = ParseOptions()
+ utils.debug = options.debug
for fname in (constants.SSL_CERT_FILE,):
if not os.path.isfile(fname):
print "config %s not there, will not run." % fname