bug 10695: add XCP 1.0 support

status 10695: resolved fixed
This commit is contained in:
anthony 2011-08-09 19:47:52 -07:00
parent 5f31d5008e
commit 33b3e02c17
10 changed files with 154 additions and 2854 deletions

View File

@ -39,67 +39,80 @@ public class CitrixHelper {
static {
_xcpGuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5");
_xcpGuestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6");
_xcpGuestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7");
_xcpGuestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8");
_xcpGuestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5.0");
_xcpGuestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5.0 x64");
_xcpGuestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5.1");
_xcpGuestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5.1 x64");
_xcpGuestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5.2");
_xcpGuestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5.2 x64");
_xcpGuestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5.3");
_xcpGuestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5.3 x64");
_xcpGuestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5.4");
_xcpGuestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5.4 x64");
_xcpGuestOsMap.put("Debian GNU/Linux 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5.0");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5.0 x64");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5.1");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5.1 x64");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5.2");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5.2 x64");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5.3");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5.3 x64");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5.4");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5.4 x64");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5.0");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5.0 x64");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5.1");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5.1 x64");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5.2");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5.2 x64");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5.3");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5.3 x64");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5.4");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5.4 x64");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 9 SP4");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 x64");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 x64");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "Other install media");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 x64");
_xcpGuestOsMap.put("Windows 7 (32-bit)", "Windows 7");
_xcpGuestOsMap.put("Windows 7 (64-bit)", "Windows 7 x64");
_xcpGuestOsMap.put("Windows Server 2003 (32-bit)", "Windows Server 2003");
_xcpGuestOsMap.put("Windows Server 2003 (64-bit)", "Windows Server 2003 x64");
_xcpGuestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008");
_xcpGuestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 x64");
_xcpGuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 x64");
_xcpGuestOsMap.put("Windows 2000 SP4 (32-bit)", "Windows 2000 SP4");
_xcpGuestOsMap.put("Windows Vista (32-bit)", "Windows Vista");
_xcpGuestOsMap.put("Windows XP SP2 (32-bit)", "Windows XP SP2");
_xcpGuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3");
_xcpGuestOsMap.put("Other install media", "Other install media");
_xcpGuestOsMap.put("Other PV (32-bit)", "CentOS 5.5 (32-bit)");
_xcpGuestOsMap.put("Other PV (64-bit)", "CentOS 5.5 (64-bit)");
_xcpGuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)");
_xcpGuestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6 (32-bit)");
_xcpGuestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7 (32-bit)");
_xcpGuestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8 (32-bit)");
_xcpGuestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5 (32-bit)");
_xcpGuestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5 (64-bit)");
_xcpGuestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5 (32-bit)");
_xcpGuestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5 (64-bit)");
_xcpGuestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5 (32-bit)");
_xcpGuestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5 (64-bit)");
_xcpGuestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5 (32-bit)");
_xcpGuestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5 (64-bit)");
_xcpGuestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5 (32-bit)");
_xcpGuestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5 (64-bit)");
_xcpGuestOsMap.put("CentOS 5.5 (32-bit)", "CentOS 5 (32-bit)");
_xcpGuestOsMap.put("CentOS 5.5 (64-bit)", "CentOS 5 (64-bit)");
_xcpGuestOsMap.put("Debian GNU/Linux 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
_xcpGuestOsMap.put("Debian GNU/Linux 6(32-bit)", "Debian Squeeze 6.0 (32-bit)");
_xcpGuestOsMap.put("Debian GNU/Linux 6(64-bit)", "Debian Squeeze 6.0 (64-bit) (experimental)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.5 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Oracle Enterprise Linux 5.5 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.5 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 5.5 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 6.0 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit) (experimental)");
_xcpGuestOsMap.put("Red Hat Enterprise Linux 6.0 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit) (experimental)");
;
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 9 SP4");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 x64");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 x64");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "Other install media");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 x64");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (32-bit)", "SUSE Linux Enterprise Server 11 SP1 (32-bit)");
_xcpGuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (64-bit)", "SUSE Linux Enterprise Server 11 SP1 (64-bit)");
_xcpGuestOsMap.put("Windows 7 (32-bit)", "Windows 7 (32-bit)");
_xcpGuestOsMap.put("Windows 7 (64-bit)", "Windows 7 (64-bit)");
_xcpGuestOsMap.put("Windows Server 2003 (32-bit)", "Windows Server 2003 (32-bit)");
_xcpGuestOsMap.put("Windows Server 2003 (64-bit)", "Windows Server 2003 (64-bit)");
_xcpGuestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008 (32-bit)");
_xcpGuestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 (64-bit)");
_xcpGuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 (64-bit)");
_xcpGuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3 (32-bit)");
_xcpGuestOsMap.put("Windows Vista (32-bit)", "Windows Vista (32-bit)");
_xcpGuestOsMap.put("Ubuntu 10.04 (32-bit)", "Ubuntu Lucid Lynx 10.04 (32-bit) (experimental)");
_xcpGuestOsMap.put("Ubuntu 10.04 (64-bit)", "Ubuntu Lucid Lynx 10.04 (64-bit) (experimental)");
_xcpGuestOsMap.put("Other install media", "Other install media");
_xcpGuestOsMap.put("Other PV (32-bit)", "CentOS 5 (32-bit)");
_xcpGuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)");
}
static {
@ -164,8 +177,6 @@ public class CitrixHelper {
_xenServerGuestOsMap.put("Other install media", "Other install media");
_xenServerGuestOsMap.put("Other PV (32-bit)", "CentOS 5.4 (32-bit)");
_xenServerGuestOsMap.put("Other PV (64-bit)", "CentOS 5.4 (64-bit)");
// _xenServerGuestOsMap.put("Ubuntu 10.04 (32-bit)", "CentOS 5.3 (32-bit");
// _xenServerGuestOsMap.put("Ubuntu 10.04 (64-bit)", "CentOS 5.3 (64-bit");
}
static {
@ -239,8 +250,8 @@ public class CitrixHelper {
_xenServer56FP1GuestOsMap.put("Ubuntu 10.04 (32-bit)", "Ubuntu Lucid Lynx 10.04 (32-bit) (experimental)");
_xenServer56FP1GuestOsMap.put("Ubuntu 10.04 (64-bit)", "Ubuntu Lucid Lynx 10.04 (64-bit) (experimental)");
_xenServer56FP1GuestOsMap.put("Other install media", "Other install media");
_xenServer56FP1GuestOsMap.put("Other PV (32-bit)", "CentOS 5.5 (32-bit)");
_xenServer56FP1GuestOsMap.put("Other PV (64-bit)", "CentOS 5.5 (64-bit)");
_xenServer56FP1GuestOsMap.put("Other PV (32-bit)", "CentOS 5 (32-bit)");
_xenServer56FP1GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)");
}
@ -315,8 +326,8 @@ public class CitrixHelper {
_xenServer56FP2GuestOsMap.put("Ubuntu 10.04 (32-bit)", "Ubuntu Lucid Lynx 10.04 (32-bit) (experimental)");
_xenServer56FP2GuestOsMap.put("Ubuntu 10.04 (64-bit)", "Ubuntu Lucid Lynx 10.04 (64-bit) (experimental)");
_xenServer56FP2GuestOsMap.put("Other install media", "Other install media");
_xenServer56FP2GuestOsMap.put("Other PV (32-bit)", "CentOS 5.5 (32-bit)");
_xenServer56FP2GuestOsMap.put("Other PV (64-bit)", "CentOS 5.5 (64-bit)");
_xenServer56FP2GuestOsMap.put("Other PV (32-bit)", "CentOS 5 (32-bit)");
_xenServer56FP2GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)");
}
@ -408,8 +419,8 @@ public class CitrixHelper {
_xenServer60GuestOsMap.put("Ubuntu 10.10 (32-bit)", "Ubuntu Maverick Meerkat 10.10 (32-bit) (experimental)");
_xenServer60GuestOsMap.put("Ubuntu 10.10 (64-bit)", "Ubuntu Maverick Meerkat 10.10 (64-bit) (experimental)");
_xenServer60GuestOsMap.put("Other install media", "Other install media");
_xenServer60GuestOsMap.put("Other PV (32-bit)", "CentOS 5.5 (32-bit)");
_xenServer60GuestOsMap.put("Other PV (64-bit)", "CentOS 5.5 (64-bit)");
_xenServer60GuestOsMap.put("Other PV (32-bit)", "CentOS 5 (32-bit)");
_xenServer60GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)");
}

View File

@ -333,7 +333,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
protected boolean isRefNull(XenAPIObject object) {
return (object == null || object.toWireString().equals("OpaqueRef:NULL"));
return (object == null || object.toWireString().equals("OpaqueRef:NULL") || object.toWireString().equals("<not in database>"));
}
@Override
@ -2578,7 +2578,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
final State state = convertToState(ps);
Host host = record.residentOn;
String host_uuid = null;
if( host != null ) {
if( ! isRefNull(host) ) {
host_uuid = host.getUuid(conn);
if( host_uuid.equals(_host.uuid)) {
synchronized (_vms) {

View File

@ -17,9 +17,20 @@
*/
package com.cloud.hypervisor.xen.resource;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Local;
import org.apache.xmlrpc.XmlRpcException;
import com.cloud.resource.ServerResource;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
import com.xensource.xenapi.Connection;
import com.xensource.xenapi.VM;
import com.xensource.xenapi.Types.XenAPIException;
@Local(value=ServerResource.class)
public class XcpServerResource extends CitrixResourceBase {
@ -31,4 +42,31 @@ public class XcpServerResource extends CitrixResourceBase {
protected String getGuestOsType(String stdType, boolean bootFromCD) {
return CitrixHelper.getXcpGuestOsType(stdType);
}
@Override
protected List<File> getPatchFiles() {
List<File> files = new ArrayList<File>();
String patch = "scripts/vm/hypervisor/xenserver/xcpserver/patch";
String patchfilePath = Script.findScript("", patch);
if (patchfilePath == null) {
throw new CloudRuntimeException("Unable to find patch file " + patch);
}
File file = new File(patchfilePath);
files.add(file);
return files;
}
@Override
protected void setMemory(Connection conn, VM vm, long memsize) throws XmlRpcException, XenAPIException {
vm.setMemoryStaticMin(conn, 33554432L);
vm.setMemoryDynamicMin(conn, 33554432L);
vm.setMemoryDynamicMax(conn, 33554432L);
vm.setMemoryStaticMax(conn, 33554432L);
vm.setMemoryStaticMax(conn, memsize);
vm.setMemoryDynamicMax(conn, memsize);
vm.setMemoryDynamicMin(conn, memsize);
vm.setMemoryStaticMin(conn, memsize);
}
}

View File

@ -24,9 +24,10 @@ import vhdutil
from lock import Lock
import cleanup
CAPABILITIES = ["SR_PROBE","SR_UPDATE", \
CAPABILITIES = ["SR_PROBE","SR_UPDATE", "SR_CACHING", \
"VDI_CREATE","VDI_DELETE","VDI_ATTACH","VDI_DETACH", \
"VDI_UPDATE", "VDI_CLONE","VDI_SNAPSHOT","VDI_RESIZE","VDI_RESIZE_ONLINE"]
"VDI_UPDATE", "VDI_CLONE","VDI_SNAPSHOT","VDI_RESIZE", \
"VDI_RESIZE_ONLINE", "VDI_RESET_ON_BOOT", "ATOMIC_PAUSE"]
CONFIGURATION = [ [ 'server', 'hostname or IP address of NFS server (required)' ], \
[ 'serverpath', 'path on remote server (required)' ] ]
@ -59,6 +60,7 @@ class NFSSR(FileSR.FileSR):
def load(self, sr_uuid):
self.ops_exclusive = FileSR.OPS_EXCLUSIVE
self.lock = Lock(vhdutil.LOCK_TYPE_SR, self.uuid)
self.sr_vditype = SR.DEFAULT_TAP
if not self.dconf.has_key('server'):
@ -99,12 +101,10 @@ class NFSSR(FileSR.FileSR):
raise xs_errors.XenError('NFSMount', opterr=exc.errstr)
@FileSR.locking("SRUnavailable")
def attach(self, sr_uuid):
self.validate_remotepath(False)
#self.remotepath = os.path.join(self.dconf['serverpath'], sr_uuid)
self.remotepath = self.dconf['serverpath']
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
self.mount_remotepath(sr_uuid)
@ -117,7 +117,6 @@ class NFSSR(FileSR.FileSR):
return super(NFSSR, self).attach(sr_uuid)
@FileSR.locking("SRUnavailable")
def probe(self):
# Verify NFS target and port
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
@ -137,7 +136,6 @@ class NFSSR(FileSR.FileSR):
pass
@FileSR.locking("SRUnavailable")
def detach(self, sr_uuid):
"""Detach the SR: Unmounts and removes the mountpoint"""
if not self._checkmount():
@ -156,7 +154,6 @@ class NFSSR(FileSR.FileSR):
return super(NFSSR, self).detach(sr_uuid)
@FileSR.locking("SRUnavailable")
def create(self, sr_uuid, size):
util._testHost(self.dconf['server'], NFSPORT, 'NFSTarget')
self.validate_remotepath(True)
@ -191,7 +188,6 @@ class NFSSR(FileSR.FileSR):
# % inst.code)
self.detach(sr_uuid)
@FileSR.locking("SRUnavailable")
def delete(self, sr_uuid):
# try to remove/delete non VDI contents first
super(NFSSR, self).delete(sr_uuid)
@ -215,7 +211,7 @@ class NFSSR(FileSR.FileSR):
def vdi(self, uuid, loadLocked = False):
if not loadLocked:
return NFSFileVDINolock(self, uuid)
return NFSFileVDI(self, uuid)
return NFSFileVDI(self, uuid)
def _checkmount(self):
@ -253,11 +249,6 @@ class NFSFileVDI(FileSR.FileVDI):
os.utime(self.sr.path, (timestamp_after, timestamp_after))
return ret
class NFSFileVDINolock(NFSFileVDI):
def load(self, vdi_uuid):
self.lock = self.sr.lock
self._load(vdi_uuid)
if __name__ == '__main__':
SRCommand.run(NFSSR, DRIVER_INFO)

File diff suppressed because it is too large Load Diff

View File

@ -4,36 +4,44 @@
# [Name of file]=[source path],[file permission],[destination path]
# [destination path] is required.
# If [file permission] is missing, 755 is assumed.
# If [source path] is missing, it looks in the same directory as the patch file.
# If [source path] is missing, it looks in the same
# directory as the patch file.
# If [source path] starts with '/', then it is absolute path.
# If [source path] starts with '~', then it is path relative to management server home directory.
# If [source path] does not start with '/' or '~', then it is relative path to the location of the patch file.
scsiutil.py=/opt/xensource/sm
cleanup.py=/opt/xensource/sm
NFSSR.py=/opt/xensource/sm
ISCSISR.py=/opt/xensource/sm
LUNperVDI.py=/opt/xensource/sm
nfs.py=/opt/xensource/sm
patch.tgz=..,0775,/opt/xensource/bin
vmops=..,0755,/etc/xapi.d/plugins
ovsgre=..,0755,/etc/xapi.d/plugins
ovstunnel=..,0755,/etc/xapi.d/plugins
vmopsSnapshot=..,0755,/etc/xapi.d/plugins
systemvm-premium.zip=../../../../../vms,0755,/opt/xensource/bin
hostvmstats.py=..,0755,/opt/xensource/sm
systemvm.iso=../../../../../vms,0644,/opt/xensource/packages/iso
id_rsa.cloud=../../../systemvm,0600,/root/.ssh
network_info.sh=..,0755,/opt/xensource/bin
prepsystemvm.sh=..,0755,/opt/xensource/bin
setupxenserver.sh=..,0755,/opt/xensource/bin
make_migratable.sh=..,0755,/opt/xensource/bin
networkUsage.sh=..,0755,/opt/xensource/bin
find_bond.sh=..,0755,/opt/xensource/bin
setup_iscsi.sh=..,0755,/opt/xensource/bin
setup_heartbeat_sr.sh=..,0755,/opt/xensource/bin
check_heartbeat.sh=..,0755,/opt/xensource/bin
xenheartbeat.sh=..,0755,/opt/xensource/bin
launch_hb.sh=..,0755,/opt/xensource/bin
pingtest.sh=../../..,0755,/opt/xensource/bin
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
ipassoc.sh=../../../../network/domr/,0755,/opt/xensource/bin
vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
networkUsage.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_firewall.sh=../../../../network/domr/,0755,/opt/xensource/bin
call_loadbalancer.sh=../../../../network/domr/,0755,/opt/xensource/bin
l2tp_vpn.sh=../../../../network/domr/,0755,/opt/xensource/bin
cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
copy_vhd_to_secondarystorage.sh=..,0755,/opt/xensource/bin
copy_vhd_from_secondarystorage.sh=..,0755,/opt/xensource/bin
setup_heartbeat_sr.sh=..,0755,/opt/xensource/bin
setup_heartbeat_file.sh=..,0755,/opt/xensource/bin
check_heartbeat.sh=..,0755,/opt/xensource/bin
xenheartbeat.sh=..,0755,/opt/xensource/bin
launch_hb.sh=..,0755,/opt/xensource/bin
vhd-util=..,0755,/opt/xensource/bin
vmopspremium=..,0755,/etc/xapi.d/plugins
create_privatetemplate_from_snapshot.sh=..,0755,/opt/xensource/bin
upgrade_snapshot.sh=..,0755,/opt/xensource/bin
cloud-clean-vlan.sh=..,0755,/opt/xensource/bin
cloud-prepare-upgrade.sh=..,0755,/opt/xensource/bin

View File

@ -1,468 +0,0 @@
#!/usr/bin/python
# Copyright (C) 2006-2007 XenSource Ltd.
# Copyright (C) 2008-2009 Citrix Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; version 2.1 only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# Miscellaneous scsi utility functions
#
import util, SR
import os
import re
import xs_errors
import base64
import time
import errno
import glob
PREFIX_LEN = 4
SUFFIX_LEN = 12
SECTOR_SHIFT = 9
def gen_hash(st, len):
hs = 0
for i in st:
hs = ord(i) + (hs << 6) + (hs << 16) - hs
return str(hs)[0:len]
def gen_uuid_from_serial(iqn, serial):
if len(serial) < SUFFIX_LEN:
raise util.CommandException(1)
prefix = gen_hash(iqn, PREFIX_LEN)
suffix = gen_hash(serial, SUFFIX_LEN)
str = prefix.encode("hex") + suffix.encode("hex")
return str[0:8]+'-'+str[8:12]+'-'+str[12:16]+'-'+str[16:20]+'-'+str[20:32]
def gen_serial_from_uuid(iqn, uuid):
str = uuid.replace('-','')
prefix = gen_hash(iqn, PREFIX_LEN)
if str[0:(PREFIX_LEN * 2)].decode("hex") != prefix:
raise util.CommandException(1)
return str[(PREFIX_LEN * 2):].decode("hex")
def getsize(path):
dev = getdev(path)
sysfs = os.path.join('/sys/block',dev,'size')
size = 0
if os.path.exists(sysfs):
try:
f=open(sysfs, 'r')
size = (long(f.readline()) << SECTOR_SHIFT)
f.close()
except:
pass
return size
def getuniqueserial(path):
dev = getdev(path)
output = gen_rdmfile()
try:
cmd = ["md5sum"]
txt = util.pread3(cmd, getSCSIid(path))
return txt.split(' ')[0]
except:
return ''
def gen_uuid_from_string(str):
if len(str) < (PREFIX_LEN + SUFFIX_LEN):
raise util.CommandException(1)
return str[0:8]+'-'+str[8:12]+'-'+str[12:16]+'-'+str[16:20]+'-'+str[20:32]
def SCSIid_sanitise(str):
text = re.sub("^\s+","",str)
return re.sub("\s+","_",text)
def getSCSIid(path):
dev = rawdev(path)
cmd = ["scsi_id", "-g", "-s", "/block/%s" % dev]
return SCSIid_sanitise(util.pread2(cmd)[:-1])
def compareSCSIid_2_6_18(SCSIid, path):
serial = getserial(path)
len_serial = len(serial)
if (len_serial == 0 ) or (len_serial > (len(SCSIid) - 1)):
return False
list_SCSIid = list(SCSIid)
list_serial = list_SCSIid[1:(len_serial + 1)]
serial_2_6_18 = ''.join(list_serial)
if (serial == serial_2_6_18):
return True
else:
return False
def getserial(path):
dev = os.path.join('/dev',getdev(path))
try:
cmd = ["sginfo", "-s", dev]
text = re.sub("\s+","",util.pread2(cmd))
except:
raise xs_errors.XenError('EIO', \
opterr='An error occured querying device serial number [%s]' \
% dev)
try:
return text.split("'")[1]
except:
return ''
def getmanufacturer(path):
cmd = ["sginfo", "-M", path]
try:
for line in filter(match_vendor, util.pread2(cmd).split('\n')):
return line.replace(' ','').split(':')[-1]
except:
return ''
def cacheSCSIidentifiers():
SCSI = {}
SYS_PATH = "/dev/disk/by-scsibus/*"
for node in glob.glob(SYS_PATH):
dev = os.path.realpath(node)
HBTL = os.path.basename(node).split("-")[-1].split(":")
line = "NONE %s %s %s %s 0 %s" % \
(HBTL[0],HBTL[1],HBTL[2],HBTL[3],dev)
ids = line.split()
SCSI[ids[6]] = ids
return SCSI
def scsi_dev_ctrl(ids, cmd):
f = -1
for i in range(0,10):
try:
str = "scsi %s-single-device %s %s %s %s" % \
(cmd, ids[1],ids[2],ids[3],ids[4])
util.SMlog(str)
f=open('/proc/scsi/scsi', 'w')
print >>f, str
f.close()
return
except IOError, e:
util.SMlog("SCSI_DEV_CTRL: Failure, %s [%d]" % (e.strerror,e.errno))
if f >= 0:
f.close()
if e.errno == errno.ENXIO:
util.SMlog("Device has disappeared already")
return
f = -1
time.sleep(6)
continue
raise xs_errors.XenError('EIO', \
opterr='An error occured during the scsi operation')
def getdev(path):
realpath = os.path.realpath(path)
if match_dm(realpath):
newpath = realpath.replace("/dev/mapper/","/dev/disk/by-id/scsi-")
else:
newpath = path
return os.path.realpath(newpath).split('/')[-1]
def rawdev(dev):
return re.sub("[0-9]*$","",getdev(dev))
def getSessionID(path):
for line in filter(match_session, util.listdir(path)):
return line.split('-')[-1]
def match_session(s):
regex = re.compile("^SESSIONID-")
return regex.search(s, 0)
def match_vendor(s):
regex = re.compile("^Vendor:")
return regex.search(s, 0)
def match_dm(s):
regex = re.compile("mapper/")
return regex.search(s, 0)
def match_sd(s):
regex = re.compile("/dev/sd")
return regex.search(s, 0)
def _isSCSIdev(dev):
if match_dm(dev):
path = dev.replace("/dev/mapper/","/dev/disk/by-id/scsi-")
else:
path = dev
return match_sd(os.path.realpath(path))
def gen_rdmfile():
return "/tmp/%s" % util.gen_uuid()
def add_serial_record(session, sr_ref, devstring):
try:
conf = session.xenapi.SR.get_sm_config(sr_ref)
conf['devserial'] = devstring
session.xenapi.SR.set_sm_config(sr_ref, conf)
except:
pass
def get_serial_record(session, sr_ref):
try:
conf = session.xenapi.SR.get_sm_config(sr_ref)
return conf['devserial']
except:
return ""
def devlist_to_serialstring(devlist):
serial = ''
for dev in devlist:
try:
devserial = "scsi-%s" % getSCSIid(dev)
if not len(devserial) > 0:
continue
if len(serial):
serial += ','
serial += devserial
except:
pass
return serial
def gen_synthetic_page_data(uuid):
# For generating synthetic page data for non-raw LUNs
# we set the vendor ID to XENSRC
# Note that the Page 80 serial number must be limited
# to 16 characters
page80 = ""
page80 += "\x00\x80"
page80 += "\x00\x12"
page80 += uuid[0:16]
page80 += " "
page83 = ""
page83 += "\x00\x83"
page83 += "\x00\x31"
page83 += "\x02\x01\x00\x2d"
page83 += "XENSRC "
page83 += uuid
page83 += " "
return ["",base64.b64encode(page80),base64.b64encode(page83)]
def gen_raw_page_data(path):
default = ""
page80 = ""
page83 = ""
try:
cmd = ["sg_inq", "-r", path]
text = util.pread2(cmd)
default = base64.b64encode(text)
cmd = ["sg_inq", "--page=0x80", "-r", path]
text = util.pread2(cmd)
page80 = base64.b64encode(text)
cmd = ["sg_inq", "--page=0x83", "-r", path]
text = util.pread2(cmd)
page83 = base64.b64encode(text)
except:
pass
return [default,page80,page83]
def update_XS_SCSIdata(session, vdi_ref, vdi_uuid, data):
try:
session.xenapi.VDI.remove_from_xenstore_data(vdi_ref, "vdi-uuid")
except:
pass
try:
session.xenapi.VDI.remove_from_xenstore_data(vdi_ref, "scsi/0x12/default")
except:
pass
try:
session.xenapi.VDI.remove_from_xenstore_data(vdi_ref, "scsi/0x12/0x80")
except:
pass
try:
session.xenapi.VDI.remove_from_xenstore_data(vdi_ref, "scsi/0x12/0x83")
except:
pass
try:
session.xenapi.VDI.add_to_xenstore_data(vdi_ref, "vdi-uuid", vdi_uuid)
if len(data[0]):
session.xenapi.VDI.add_to_xenstore_data(vdi_ref, "scsi/0x12/default", data[0])
if len(data[1]):
session.xenapi.VDI.add_to_xenstore_data(vdi_ref, "scsi/0x12/0x80", data[1])
if len(data[2]):
session.xenapi.VDI.add_to_xenstore_data(vdi_ref, "scsi/0x12/0x83", data[2])
except:
pass
def rescan(ids, scanstring='- - -'):
for id in ids:
refresh_HostID(id, scanstring)
def _genArrayIdentifier(dev):
try:
cmd = ["sg_inq", "--page=0xc8", "-r", dev]
id = util.pread2(cmd)
return id.encode("hex")[180:212]
except:
return ""
def _genHostList(procname):
# loop through and check all adapters
ids = []
try:
for dir in util.listdir('/sys/class/scsi_host'):
filename = os.path.join('/sys/class/scsi_host',dir,'proc_name')
if os.path.exists(filename):
f = open(filename, 'r')
if f.readline().find(procname) != -1:
ids.append(dir.replace("host",""))
f.close()
except:
pass
return ids
def _genReverseSCSIidmap(SCSIid, pathname="scsibus"):
util.SMlog("map_by_scsibus: sid=%s" % SCSIid)
devices = []
for link in glob.glob('/dev/disk/by-id/scsi-%s' % SCSIid):
devices.append(os.path.realpath(link))
return devices
def _genReverseSCSidtoLUNidmap(SCSIid):
devices = []
for link in glob.glob('/dev/disk/by-scsibus/%s-*' % SCSIid):
devices.append(link.split('-')[-1])
return devices
def _dosgscan():
regex=re.compile("([^:]*):\s+scsi([0-9]+)\s+channel=([0-9]+)\s+id=([0-9]+)\s+lun=([0-9]+)")
scan=util.pread2(["/usr/bin/sg_scan"]).split('\n')
sgs=[]
for line in scan:
m=regex.match(line)
if m:
device=m.group(1)
host=m.group(2)
channel=m.group(3)
sid=m.group(4)
lun=m.group(5)
sgs.append([device,host,channel,sid,lun])
return sgs
def refresh_HostID(HostID, scanstring):
LUNs = glob.glob('/sys/class/scsi_disk/%s*' % HostID)
li = []
for l in LUNs:
chan = re.sub(":[0-9]*$",'',os.path.basename(l))
if chan not in li:
li.append(chan)
fullrescan = True
if len(li) and scanstring == "- - -":
fullrescan = False
for c in li:
if not refresh_scsi_channel(c):
fullrescan = True
if fullrescan:
util.SMlog("Rescanning HostID %s with %s" % (HostID, scanstring))
path = '/sys/class/scsi_host/host%s/scan' % HostID
if os.path.exists(path):
try:
f=open(path, 'w')
f.write('%s\n' % scanstring)
f.close()
except:
pass
# Host Bus scan issued, now try to detect channels
if util.wait_for_path("/sys/class/scsi_disk/%s*" % HostID, 5):
# At least one LUN is mapped
LUNs = glob.glob('/sys/class/scsi_disk/%s*' % HostID)
li = []
for l in LUNs:
chan = re.sub(":[0-9]*$",'',os.path.basename(l))
if chan not in li:
li.append(chan)
for c in li:
refresh_scsi_channel(c)
def refresh_scsi_channel(channel):
DEV_WAIT = 5
util.SMlog("Refreshing channel %s" % channel)
util.wait_for_path('/dev/disk/by-scsibus/*-%s*' % channel, DEV_WAIT)
LUNs = glob.glob('/dev/disk/by-scsibus/*-%s*' % channel)
try:
rootdevs = util.dom0_disks()
except:
util.SMlog("Failed to query root disk, failing operation")
return False
# a) Find a LUN to issue a Query LUNs command
li = []
Query = False
for lun in LUNs:
try:
hbtl = lun.split('-')[-1]
h = hbtl.split(':')
l=util.pread2(["/usr/bin/sg_luns","-q",lun]).split('\n')
li = []
for i in l:
if len(i):
li.append(int(i[0:4], 16))
util.SMlog("sg_luns query returned %s" % li)
Query = True
break
except:
pass
if not Query:
util.SMlog("Failed to detect or query LUN on Channel %s" % channel)
return False
# b) Remove stale LUNs
current = glob.glob('/dev/disk/by-scsibus/*-%s:%s:%s*' % (h[0],h[1],h[2]))
for cur in current:
lunID = int(cur.split(':')[-1])
newhbtl = ['',h[0],h[1],h[2],str(lunID)]
if os.path.realpath(cur) in rootdevs:
# Don't touch the rootdev
if lunID in li: li.remove(lunID)
continue
# Check if LUN is stale, and remove it
if not lunID in li:
util.SMlog("Stale LUN detected. Removing HBTL: %s" % newhbtl)
scsi_dev_ctrl(newhbtl,"remove")
util.wait_for_nopath(cur, DEV_WAIT)
continue
else:
li.remove(lunID)
# Query SCSIid, check it matches, if not, re-probe
cur_SCSIid = os.path.basename(cur).split("-%s:%s:%s" % (h[0],h[1],h[2]))[0]
real_SCSIid = getSCSIid(cur)
if cur_SCSIid != real_SCSIid:
util.SMlog("HBTL %s does not match, re-probing" % newhbtl)
scsi_dev_ctrl(newhbtl,"remove")
util.wait_for_nopath(cur, DEV_WAIT)
scsi_dev_ctrl(newhbtl,"add")
util.wait_for_path('/dev/disk/by-scsibus/%s-%s' % (real_SCSIid,hbtl), DEV_WAIT)
pass
# c) Probe for any LUNs that are not present in the system
for l in li:
newhbtl = ['',h[0],h[1],h[2],str(l)]
util.SMlog("Probing new HBTL: %s" % newhbtl)
scsi_dev_ctrl(newhbtl,"add")
util.wait_for_path('/dev/disk/by-scsibus/*-%s' % hbtl, DEV_WAIT)
return True

View File

@ -1573,8 +1573,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
Long memory = cmd.getMemory();
if ((memory == null) || (memory.intValue() <= 0) || (memory.intValue() > 2147483647)) {
throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 1 and 2147483647");
if ((memory == null) || (memory.intValue() < 32) || (memory.intValue() > 2147483647)) {
throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and 2147483647 MB");
}
// check if valid domain

View File

@ -380,7 +380,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
String prodBrand = record.softwareVersion.get("product_brand").trim();
String prodVersion = record.softwareVersion.get("product_version").trim();
if(prodBrand.equals("XenCloudPlatform") && prodVersion.equals("0.1.1"))
if(prodBrand.equals("XCP") && prodVersion.equals("1.0.0"))
return new XcpServerResource();
if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
@ -398,7 +398,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
}
}
String msg = "Only support XCP 0.1.1, XenServer 5.6, XenServer 5.6 FP1 and XenServer 5.6 SP2, but this one is " + prodBrand + " " + prodVersion;
String msg = "Only support XCP 1.0.0, XenServer 5.6, XenServer 5.6 FP1 and XenServer 5.6 SP2, but this one is " + prodBrand + " " + prodVersion;
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
s_logger.debug(msg);
throw new RuntimeException(msg);
@ -525,7 +525,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
String prodBrand = details.get("product_brand").trim();
String prodVersion = details.get("product_version").trim();
if(prodBrand.equals("XenCloudPlatform") && prodVersion.equals("0.1.1")) {
if(prodBrand.equals("XCP") && prodVersion.equals("1.0.0")) {
resource = XcpServerResource.class.getName();
} else if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0")) {
resource = XenServer56Resource.class.getName();
@ -540,7 +540,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
}
}
if( resource == null ){
String msg = "Only support XCP 0.1.1, XenServer 5.6, XenServer 5.6 FP1 and XenServer 5.6 SP2, but this one is " + prodBrand + " " + prodVersion;
String msg = "Only support XCP 1.0.0, XenServer 5.6, XenServer 5.6 FP1 and XenServer 5.6 SP2, but this one is " + prodBrand + " " + prodVersion;
s_logger.debug(msg);
throw new RuntimeException(msg);
}

View File

@ -275,7 +275,7 @@ public class StatsCollector {
GetStorageStatsCommand command = new GetStorageStatsCommand(host.getStorageUrl());
HostVO ssAhost = _agentMgr.getSSAgent(host);
if (ssAhost == null) {
s_logger.warn("There is no secondary storage VM for secondary storage host " + host.getName());
s_logger.debug("There is no secondary storage VM for secondary storage host " + host.getName());
continue;
}
long hostId = host.getId();