@@ -286,7 +286,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
286286 protected List <VIF > _tmpDom0Vif = new ArrayList <VIF >();
287287
288288 public enum SRType {
289- NFS , LVM , ISCSI , ISO , LVMOISCSI , LVMOHBA , EXT ;
289+ NFS , LVM , ISCSI , ISO , LVMOISCSI , LVMOHBA , EXT , FILE ;
290290
291291 String _str ;
292292
@@ -1066,7 +1066,7 @@ protected String handleVmStartFailure(Connection conn, String vmName, VM vm, Str
10661066 }
10671067
10681068 protected VBD createPatchVbd (Connection conn , String vmName , VM vm ) throws XmlRpcException , XenAPIException {
1069-
1069+
10701070 if ( _host .systemvmisouuid == null ) {
10711071 Set <SR > srs = SR .getByNameLabel (conn , "XenServer Tools" );
10721072 if ( srs .size () != 1 ) {
@@ -1100,8 +1100,8 @@ protected VBD createPatchVbd(Connection conn, String vmName, VM vm) throws XmlRp
11001100 cdromVBDR .type = Types .VbdType .CD ;
11011101 VBD cdromVBD = VBD .create (conn , cdromVBDR );
11021102 cdromVBD .insert (conn , VDI .getByUuid (conn , _host .systemvmisouuid ));
1103-
1104- return cdromVBD ;
1103+
1104+ return cdromVBD ;
11051105 }
11061106
11071107 protected void destroyPatchVbd (Connection conn , String vmName ) throws XmlRpcException , XenAPIException {
@@ -3870,7 +3870,7 @@ protected SR getLocalEXTSR(Connection conn) {
38703870 Map <SR , SR .Record > map = SR .getAllRecords (conn );
38713871 for (Map .Entry <SR , SR .Record > entry : map .entrySet ()) {
38723872 SR .Record srRec = entry .getValue ();
3873- if (SRType .EXT .equals (srRec .type )) {
3873+ if (SRType .FILE . equals ( srRec . type ) || SRType . EXT .equals (srRec .type )) {
38743874 Set <PBD > pbds = srRec .PBDs ;
38753875 if (pbds == null ) {
38763876 continue ;
@@ -3902,6 +3902,8 @@ protected StartupStorageCommand initializeLocalSR(Connection conn) {
39023902 SR lvmsr = getLocalLVMSR (conn );
39033903 if (lvmsr != null ) {
39043904 try {
3905+ _host .localSRuuid = lvmsr .getUuid (conn );
3906+
39053907 String lvmuuid = lvmsr .getUuid (conn );
39063908 long cap = lvmsr .getPhysicalSize (conn );
39073909 if (cap > 0 ) {
@@ -3932,6 +3934,7 @@ protected StartupStorageCommand initializeLocalSR(Connection conn) {
39323934 if (extsr != null ) {
39333935 try {
39343936 String extuuid = extsr .getUuid (conn );
3937+ _host .localSRuuid = extuuid ;
39353938 long cap = extsr .getPhysicalSize (conn );
39363939 if (cap > 0 ) {
39373940 long avail = cap - extsr .getPhysicalUtilisation (conn );
@@ -3956,6 +3959,7 @@ protected StartupStorageCommand initializeLocalSR(Connection conn) {
39563959 s_logger .warn (msg );
39573960 }
39583961 }
3962+
39593963 return null ;
39603964 }
39613965
@@ -4033,7 +4037,13 @@ protected boolean getHostInfo(Connection conn) throws IllegalArgumentException{
40334037 break ;
40344038 }
40354039 Host .Record hr = myself .getRecord (conn );
4036- _host .product_version = hr .softwareVersion .get ("product_version" ).trim ();
4040+
4041+ _host .product_version = hr .softwareVersion .get ("product_version" );
4042+ if (_host .product_version == null ) {
4043+ _host .product_version = hr .softwareVersion .get ("platform_version" );
4044+ } else {
4045+ _host .product_version = _host .product_version .trim ();
4046+ }
40374047
40384048 XsLocalNetwork privateNic = getManagementNetwork (conn );
40394049 _privateNetworkName = privateNic .getNetworkRecord (conn ).nameLabel ;
@@ -4493,8 +4503,10 @@ protected boolean setupServer(Connection conn) {
44934503 } finally {
44944504 sshConnection .close ();
44954505 }
4506+
44964507 hr .tags .add ("vmops-version-" + version );
44974508 host .setTags (conn , hr .tags );
4509+
44984510 return true ;
44994511 } catch (XenAPIException e ) {
45004512 String msg = "Xen setup failed due to " + e .toString ();
@@ -5106,13 +5118,19 @@ protected void fillHostInfo(Connection conn, StartupRoutingCommand cmd) {
51065118 if (details == null ) {
51075119 details = new HashMap <String , String >();
51085120 }
5109- details .put ("product_brand" , hr .softwareVersion .get ("product_brand" ));
5110- details .put ("product_version" , hr .softwareVersion .get ("product_version" ));
5121+
5122+ String productBrand = hr .softwareVersion .get ("product_brand" );
5123+ if (productBrand == null ) {
5124+ productBrand = hr .softwareVersion .get ("platform_name" );
5125+ }
5126+ details .put ("product_brand" , productBrand );
5127+ details .put ("product_version" , _host .product_version );
5128+
51115129 if ( hr .softwareVersion .get ("product_version_text_short" ) != null ) {
51125130 details .put ("product_version_text_short" , hr .softwareVersion .get ("product_version_text_short" ));
51135131 cmd .setHypervisorVersion (hr .softwareVersion .get ("product_version_text_short" ));
51145132 }else {
5115- cmd .setHypervisorVersion (hr . softwareVersion . get ( " product_version" ) );
5133+ cmd .setHypervisorVersion (_host . product_version );
51165134 }
51175135 if (_privateNetworkName != null ) {
51185136 details .put ("private.network.device" , _privateNetworkName );
@@ -5165,9 +5183,9 @@ protected void fillHostInfo(Connection conn, StartupRoutingCommand cmd) {
51655183 cmd .setPrivateMacAddress (pifr .MAC );
51665184 cmd .setPrivateNetmask (pifr .netmask );
51675185 } else {
5168- String msg = "Private network " + _privateNetworkName + " doesn't have IP address, please check the host network configuration" ;
5169- s_logger . error ( msg );
5170- throw new CloudRuntimeException ( msg );
5186+ cmd . setPrivateIpAddress ( _host . ip ) ;
5187+ cmd . setPrivateMacAddress ( pifr . MAC );
5188+ cmd . setPrivateNetmask ( "255.255.255.0" );
51715189 }
51725190
51735191 pif = PIF .getByUuid (conn , _host .storagePif1 );
@@ -5330,7 +5348,6 @@ public CreateAnswer execute(CreateCommand cmd) {
53305348 vdir .virtualSize = dskch .getSize ();
53315349 vdi = VDI .create (conn , vdir );
53325350 }
5333-
53345351 VDI .Record vdir ;
53355352 vdir = vdi .getRecord (conn );
53365353 s_logger .debug ("Succesfully created VDI for " + cmd + ". Uuid = " + vdir .uuid );
@@ -6764,6 +6781,7 @@ protected class XsHost {
67646781 public int speed ;
67656782 public int cpus ;
67666783 public String product_version ;
6784+ public String localSRuuid ;
67676785
67686786 @ Override
67696787 public String toString () {
0 commit comments