From ff5ea1eabd2935301da920b4bdf78c8848e8dcac Mon Sep 17 00:00:00 2001 From: anthony Date: Wed, 3 Nov 2010 19:36:25 -0700 Subject: [PATCH] merge from 2.1.x 74b798240c77d5037a6ab4fb68cf474bec288bae 1. remove plugin check Sr, heartbeat does that 2. if pbd.plug fails, moves on, and report warnning --- .../xen/resource/CitrixResourceBase.java | 25 +-------- scripts/vm/hypervisor/xenserver/vmops | 52 +------------------ 2 files changed, 2 insertions(+), 75 deletions(-) diff --git a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 96c42cc24a8..cf2c6cd4f4c 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/core/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -407,29 +407,6 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR return null; } - protected boolean currentlyAttached(SR sr, SR.Record rec, PBD pbd, PBD.Record pbdr) { - String status = null; - if (SRType.NFS.equals(rec.type)) { - status = callHostPlugin("vmops", "checkMount", "mount", rec.uuid); - } else if (SRType.LVMOISCSI.equals(rec.type) ) { - String scsiid = pbdr.deviceConfig.get("SCSIid"); - if (scsiid.isEmpty()) { - return false; - } - status = callHostPlugin("vmops", "checkIscsi", "scsiid", scsiid); - } else { - return true; - } - - if (status != null && status.equalsIgnoreCase("1")) { - s_logger.debug("currently attached " + pbdr.uuid); - return true; - } else { - s_logger.debug("currently not attached " + pbdr.uuid); - return false; - } - } - protected boolean pingdomr(String host, String port) { String status; status = callHostPlugin("vmops", "pingdomr", "host", host, "port", port); @@ -4404,7 +4381,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR } catch (Exception e) { String msg = "checkSR failed host:" + _host.uuid + " due to " + e.toString(); - s_logger.warn(msg); + s_logger.warn(msg, e); return false; } return true; diff --git a/scripts/vm/hypervisor/xenserver/vmops b/scripts/vm/hypervisor/xenserver/vmops index a5cbcafce31..6586e7a5ce0 100755 --- a/scripts/vm/hypervisor/xenserver/vmops +++ b/scripts/vm/hypervisor/xenserver/vmops @@ -368,56 +368,6 @@ def deleteFile(session, args): return txt -@echo -def checkMount(session, args): - mountPath = args['mount'] - mountPath = os.path.join(SR.MOUNT_BASE, mountPath) - status = "0" - try: - p = subprocess.Popen(["/bin/bash", "-c", "if [ -d " + mountPath + " ]; then echo 1; else echo 0;fi"], stdout=subprocess.PIPE) - cnt = 10 - while cnt > 0: - if p.poll() == None: - time.sleep(1) - cnt = cnt -1 - else: - cnt = -1 - if cnt < 0: - status = p.communicate()[0].strip("\n") - else: - subprocess.Popen(["/bin/bash", "-c", "kill -9 " + str(p.pid)]) - status = "0" - - if status == "0": - try: - cmd = ["umount", "-f", "-l", mountPath] - txt = util.pread2(cmd) - except: - util.SMlog(" umount failed ") - except: - util.SMlog("failed to check") - return status - -@echo -def checkIscsi(session, args): - scsiid = args['scsiid'] - devpath = "/dev/disk/by-id/scsi-" + scsiid - status = "0" - try: - if util.pathexists(devpath) : - rdevpath = os.readlink(devpath) - rdevpath = rdevpath.replace(".", "") - rdevpath = rdevpath.replace("/", "") - rdevpath = "/block/" + rdevpath - cmd = ["scsi_id", "-g", "-u", "-s", rdevpath ] - txt = util.pread2(cmd) - txt = txt.replace("\n", "") - if scsiid == txt: - status = "1" - except: - util.SMlog("failed to check Iscsi") - - return status @echo def networkUsage(session, args): @@ -1127,5 +1077,5 @@ def network_rules(session, args): if __name__ == "__main__": - XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats": gethostvmstats, "getvncport": getvncport, "getgateway": getgateway, "getnetwork": getnetwork, "preparemigration": preparemigration, "setIptables": setIptables, "patchdomr": patchdomr, "pingdomr": pingdomr, "pingxenserver": pingxenserver, "ipassoc": ipassoc, "vm_data": vm_data, "savePassword": savePassword, "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "setLoadBalancerRule": setLoadBalancerRule, "createFile": createFile, "deleteFile": deleteFile, "checkMount": checkMount, "checkIscsi": checkIscsi, "networkUsage": networkUsage, "network_rules":network_rules, "can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules, "destroy_network_rules_for_vm":destroy_network_rules_for_vm, "default_network_rules_systemvm":default_network_rules_systemvm, "get_rule_logs_for_vms":get_rule_logs_for_vms, "setLinkLocalIP":setLinkLocalIP, "lt2p_vpn":lt2p_vpn}) + XenAPIPlugin.dispatch({"pingtest": pingtest, "setup_iscsi":setup_iscsi, "gethostvmstats": gethostvmstats, "getvncport": getvncport, "getgateway": getgateway, "getnetwork": getnetwork, "preparemigration": preparemigration, "setIptables": setIptables, "patchdomr": patchdomr, "pingdomr": pingdomr, "pingxenserver": pingxenserver, "ipassoc": ipassoc, "vm_data": vm_data, "savePassword": savePassword, "saveDhcpEntry": saveDhcpEntry, "setFirewallRule": setFirewallRule, "setLoadBalancerRule": setLoadBalancerRule, "createFile": createFile, "deleteFile": deleteFile, "networkUsage": networkUsage, "network_rules":network_rules, "can_bridge_firewall":can_bridge_firewall, "default_network_rules":default_network_rules, "destroy_network_rules_for_vm":destroy_network_rules_for_vm, "default_network_rules_systemvm":default_network_rules_systemvm, "get_rule_logs_for_vms":get_rule_logs_for_vms, "setLinkLocalIP":setLinkLocalIP, "lt2p_vpn":lt2p_vpn})