mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Make the VHD file created by xenconverter importable.
This commit is contained in:
parent
30c5352f20
commit
d5b9f6a8c4
@ -47,7 +47,7 @@ public class VhdProcessor implements Processor {
|
|||||||
private int vhd_footer_creator_app_offset = 28;
|
private int vhd_footer_creator_app_offset = 28;
|
||||||
private int vhd_footer_creator_ver_offset = 32;
|
private int vhd_footer_creator_ver_offset = 32;
|
||||||
private int vhd_footer_current_size_offset = 48;
|
private int vhd_footer_current_size_offset = 48;
|
||||||
private byte[] citrix_creator_app = {0x74, 0x61, 0x70, 0x00}; /*"tap "*/
|
private byte[][] citrix_creator_app = {{0x74, 0x61, 0x70, 0x00},{0x43, 0x54, 0x58, 0x53}}; /*"tap ", and "CTXS"*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException {
|
public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException {
|
||||||
@ -91,10 +91,22 @@ public class VhdProcessor implements Processor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Arrays.equals(creatorApp, citrix_creator_app)) {
|
boolean findKnownCreator = false;
|
||||||
/*Only support VHD image created by citrix xenserver*/
|
for (int i = 0; i < citrix_creator_app.length; i++) {
|
||||||
throw new InternalErrorException("Image creator is:" + creatorApp.toString() +", is not supported");
|
if (Arrays.equals(creatorApp, citrix_creator_app[i])) {
|
||||||
|
findKnownCreator = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (!findKnownCreator) {
|
||||||
|
/*Only support VHD image created by citrix xenserver, and xenconverter*/
|
||||||
|
String readableCreator = "";
|
||||||
|
for (int j = 0; j < creatorApp.length; j++) {
|
||||||
|
readableCreator += (char)creatorApp[j];
|
||||||
|
}
|
||||||
|
throw new InternalErrorException("Image creator is:" + readableCreator +", is not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
long templateSize = NumbersUtil.bytesToLong(currentSize);
|
long templateSize = NumbersUtil.bytesToLong(currentSize);
|
||||||
info.virtualSize = templateSize;
|
info.virtualSize = templateSize;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user