if (bd == null) {
throw new IllegalArgumentException("bd may not be null");
}
final _VMFile file = this.repr._newVMFile();
file.setRootFile(rootfile);
file.setBlankSpaceName(null);
file.setBlankSpaceSize(-1);
final URI uri = bd.getLocation();
if (uri == null) {
throw new CannotTranslateException("a disk is missing location");
}
file.setURI(this.convertURI(uri));
final String mountAs = bd.getMountAs();
if (mountAs == null) {
throw new CannotTranslateException("a disk is missing mountAs");
}
file.setMountAs(mountAs);
final DiskPermissions_Type perms = bd.getPermissions();
if (perms == null) {
file.setDiskPerms(VMFile.DISKPERMS_ReadWrite);
} else if (perms.equals(DiskPermissions_Type.ReadOnly)) {
file.setDiskPerms(VMFile.DISKPERMS_ReadOnly);
} else if (perms.equals(DiskPermissions_Type.ReadWrite)) {
file.setDiskPerms(VMFile.DISKPERMS_ReadWrite);
} else {
throw new CannotTranslateException(
"unknown disk permission: '" + perms + "'");
}