From 94e016b0c3abd44fed1cfd74ba2dd55edea6f691 Mon Sep 17 00:00:00 2001 From: Naredula Janardhana Reddy Date: Tue, 14 Feb 2012 11:58:27 +0530 Subject: [PATCH 01/24] Bug 12808: ignoring errors on delete. --- patches/systemvm/debian/config/root/firewall.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/patches/systemvm/debian/config/root/firewall.sh b/patches/systemvm/debian/config/root/firewall.sh index eb728592fcd..7cc9ab5a30a 100755 --- a/patches/systemvm/debian/config/root/firewall.sh +++ b/patches/systemvm/debian/config/root/firewall.sh @@ -75,9 +75,9 @@ tcp_or_udp_entry() { --destination-port $port -j DNAT \ --to-destination $instIp:$dport &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables -t mangle $op PREROUTING --proto $proto -i $dev -d $publicIp \ - --destination-port $port -j MARK --set-mark $tableNo) && + --destination-port $port -j MARK --set-mark $tableNo &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables -t mangle $op PREROUTING --proto $proto -i $dev -d $publicIp \ - --destination-port $port -m state --state NEW -j CONNMARK --save-mark) && + --destination-port $port -m state --state NEW -j CONNMARK --save-mark &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables -t nat $op OUTPUT --proto $proto -d $publicIp \ --destination-port $port -j DNAT \ --to-destination $instIp:$dport &>> $OUTFILE || [ "$op" == "-D" ]) && @@ -190,13 +190,13 @@ static_nat() { # shortcircuit the process if error and it is an append operation # continue if it is delete (sudo iptables -t mangle $op PREROUTING -i $dev -d $publicIp \ - -j MARK -m state --state NEW --set-mark $tableNo) && + -j MARK -m state --state NEW --set-mark $tableNo &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables -t mangle $op PREROUTING -i $dev -d $publicIp \ - -m state --state NEW -j CONNMARK --save-mark) && + -m state --state NEW -j CONNMARK --save-mark &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables -t mangle $op PREROUTING -s $instIp -i eth0 \ - -j MARK -m state --state NEW --set-mark $tableNo) && + -j MARK -m state --state NEW --set-mark $tableNo &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables -t mangle $op PREROUTING -s $instIp -i eth0 \ - -m state --state NEW -j CONNMARK --save-mark) && + -m state --state NEW -j CONNMARK --save-mark &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables -t nat $op PREROUTING -i $dev -d $publicIp -j DNAT \ --to-destination $instIp &>> $OUTFILE || [ "$op" == "-D" ]) && (sudo iptables $op FORWARD -i $dev -o eth0 -d $instIp -m state \ From 8246271635eaa84edd6e115ff0fc839eb52711f0 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 14 Feb 2012 10:34:13 -0800 Subject: [PATCH 02/24] bug 13583: Add Zone Wizard - Guest Traffic - change description of Guest Traffic. --- ui/index.jsp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/index.jsp b/ui/index.jsp index eefd5b9f630..25ec11f2d7f 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -627,8 +627,8 @@
- Enter the first and last IP addresses that define a range that CloudStack can assign to guest VMs. We strongly recommend the use of multiple NICs. If multiple NICs are used, the guest IPs may be in a separate subnet. If one NIC is used, the guest IPs should be in the same CIDR as the pod's CIDR, but not within the reserved system IP range. -
+ Guest network traffic is communication between end-user virtual machines. +
From 4ae31e4fcacc27137877fbf8db643e31e25a4d63 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 14 Feb 2012 11:20:25 -0800 Subject: [PATCH 03/24] Translate new message properties --- .../classes/resources/messages_ja.properties | 142 +++++++++++++++++- 1 file changed, 139 insertions(+), 3 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages_ja.properties b/client/WEB-INF/classes/resources/messages_ja.properties index 9bc629af93e..a8a46d0e2a9 100644 --- a/client/WEB-INF/classes/resources/messages_ja.properties +++ b/client/WEB-INF/classes/resources/messages_ja.properties @@ -1,8 +1,144 @@ #cloudstack 3.0 (begin) ******************************************************************************************** -create.template.confirm=は、テンプレートを作成することを確認してください -create.template.success=新しいテンプレートが作成されている +label.full.path=フルパス +message.add.domain=このドメインの下に作成するサブドメインを指定してください +message.delete.user=このユーザーを削除したいことを確認してください。 +message.enable.user=このユーザーを有効にしたいことを確認してください。 +message.disable.user=このユーザーを無効にしたいことを確認してください。 +message.generate.keys=このユーザーの新しい鍵を生成したいことを確認してください。 +message.update.resource.count=このアカウントのリソースカウントを更新することを確認してください。 +message.edit.account=編集( "-1"リソース作成の量に制限がないことを示します) +label.total.of.vm=VMの合計 +label.total.of.ip=IPアドレスの合計 +state.enabled=使用可能 +message.action.download.iso=このISOイメージをダウンロードすることを確認してください。 +message.action.download.template=このテンプレートをダウンロードすることを確認してください。 +label.destination.zone=宛先ゾーン +label.keyboard.type=キーボードの種類 +label.nic.adapter.type=NICアダプタの種類 +label.root.disk.controller=ルート·ディスク·コントローラ +label.community=コミュニティ +label.remove.egress.rule=出力ルールを削除する +label.add.egress.rule=出力ルールを追加 +label.egress.rule=出力ルール +label.remove.ingress.rule=入力規則を削除する +label.delete.vpn.user=VPNユーザを削除します。 +label.add.vpn.user=VPNユーザを追加します。 +label.remove.pf=ポートフォワーディングルールを削除する +label.remove.vm.from.lb=ロード·バランサのルールからVMを削除します。 +label.add.vms.to.lb=バランサのルールをロードするためにVM(s)を追加する +label.add.vm=VMを追加します。 +label.remove.static.nat.rule=スタティックNATルールを削除します。 +label.remove.rule=ルールを削除する +label.add.static.nat.rule=スタティックNATルールを追加します。 +label.add.rule=ルールを追加します。 +label.configuration=設定 +message.disable.vpn=あなたは、VPNを無効にしてもよろしいですか? +label.disable.vpn=VPNを無効にします。 +message.enable.vpn=あなたがこのIPアドレスに対して有効になってVPNアクセスが必要であることを確認してください。 +label.enable.vpn=VPNを有効にする +message.acquire.new.ip=あなたはこのネットワークのネットのIPアドレスを取得したいことを確認してください。 +label.elastic=エラスティック +label.my.network=私のネットワーク +label.add.vms=VMを追加する +label.configure=設定する +label.stickiness=粘り +label.source=ソース +label.least.connections=最小接続 +label.round.robin=ラウンドロビン +label.network.domain.text=ネットワーク·ドメインのテキスト +label.restart.required=必要な再起動 +label.clean.up=クリーンアップ +message.restart.network=あなたは、ネットワークを再起動することを確認してください +label.restart.network=ネットワークを再起動します +label.edit.network.details=ネットワークの詳細を編集 +message.add.guest.network=このネットワークの名前とゾーンを指定してください。ネットワークが分離され、送信元NATを有効にされることに注意してください。 +label.add.guest.network=ゲストネットワークを追加します。 +label.guest.networks=ゲストネットワーク +message.ip.address.changed=あなたのIPアドレスが変更されている場合があります。あなたは、リストをリフレッシュしたいですか?このケースでは、詳細ペインを閉じることに注意してください。 +state.BackingUp=バックアップ +state.BackedUp=バックアップ +label.done=行われ +label.vm.name=VMの名前 +message.migrate.volume=別のプライマリ·ストレージにボリュームを移行することを確認してください。 +label.migrate.volume=別のプライマリ·ストレージへのボリュームの移行 +message.create.template=あなたがテンプレートを作成してもよろしいですか? +label.create.template=テンプレートを作成する +message.download.volume.confirm=あなたはこのボリュームをダウンロードすることを確認してください。 +message.detach.disk=あなたは、このディスクをデタッチしてもよろしいですか? +state.Ready=レディ +label.vm.display.name=VMの表示名 +label.select-view=ビューを選択します。 +label.local.storage=ローカルストレージ +label.direct.ips=直接IPアドレス +label.view.all=すべてを見る +label.zone.details=ゾーンの詳細 +message.alert.state.detected=アラート状態が検出されました +state.Starting=出発 +state.Expunging=抹消 +state.Creating=作成 +message.decline.invitation=このプロジェクトに招待を辞退してもよろしいですか? +label.decline.invitation=衰退への招待 +message.confirm.join.project=あなたはこのプロジェクトに参加したい確認してください。 +message.join.project=これで、プロジェクトに参加しています。プロジェクトを参照するビューをプロジェクトに切り替えてください。 +label.accept.project.invitation=プロジェクトへの招待を受け入れる +label.token=トークン +label.project.id=プロジェクトID +message.enter.token=あなたがあなたの招待状を電​​子メールで与えられているトークンを入力してください。 +label.enter.token=トークンを入力します。 +state.Accepted=受け入れ +state.Pending=ペンディング +state.Completed=完了する +state.Declined=減少しました +label.project=プロジェクト +label.invitations=招待状 +label.delete.project=プロジェクトを削除します。 +message.delete.project=このプロジェクトを削除してもよろしいですか? +message.activate.project=あなたはこのプロジェクトをアクティブにしてもよろしいですか? +label.activate.project=プロジェクトをアクティブにする +label.suspend.project=プロジェクトを一時停止 +message.suspend.project=あなたはこのプロジェクトを中断してもよろしいですか? +state.Suspended=サスペンド +label.edit.project.details=プロジェクトの詳細を編集します。 +label.new.project=新規プロジェクト +state.Active=アクティブ +state.Disabled=無効にする +label.projects=プロジェクト +label.make.project.owner=アカウントのプロジェクトの所有者を作る +label.remove.project.account=プロジェクトからアカウントを削除する +message.project.invite.sent=ユーザーに送信される招待し、彼らが招待を受け入れた後、彼らがプロジェクトに追加されます +label.add.account.to.project=プロジェクトにアカウントを追加する +label.revoke.project.invite=招待を取り消す +label.project.invite=プロジェクトへの招待 +label.select.project=プロジェクトを選択します。 +message.no.projects=任意のプロジェクトを持っていません。
プロジェクトセクションから新しいものを作成してください。 +message.no.projects.adminOnly=任意のプロジェクトを持っていません。
新しいプロジェクトを作成するには、管理者にお問い合わせください。 +message.pending.projects.1=あなたは、プロジェクトへの招待を保留されている。 +message.pending.projects.2=表示するには、プロジェクトの項を参照してくださいし、ドロップダウンからの招待を選択します。 +message.instanceWizard.noTemplates=使用可能な任意のテンプレートを持っていません。インスタンスウィザードを互換性のあるテンプレートを追加してください、再起動します。 +label.view=ビュー +create.template.complete=テンプレートが正常に作成された +create.template.confirm=テンプレートを作成することを確認してください。 create.template.notification=新しいテンプレートを作成する -create.template.complete=テンプレートは正常に作成された +create.template.success=新しいテンプレートが作成されています +instances.actions.reboot.label=再起動のインスタンス +label.filterBy=によるフィルタ +label.ok=[OK] +notification.reboot.instance=再起動のインスタンス +notification.start.instance=インスタンスを起動します。 +notification.stop.instance=インスタンスを停止します。 +label.display.name=表示名 +label.zone.name=ゾーン名 +ui.listView.filters.all=すべて +ui.listView.filters.mine=鉱山 +state.Running=ランニング +state.Stopped=停止 +state.Destroyed=破壊された +state.Error=エラー +message.reset.password.warning.notPasswordEnabled=このインスタンスが作成されたテンプレートには、パスワードは有効ではありません +message.reset.password.warning.notStopped=インスタンスは、その現在のパスワードを変更しようとする前に停止する必要があります。 +label.notifications=通知 +label.default.view=デフォルトのビュー +label.project.view=プロジェクトビュー #cloudstack 3.0 (end) ********************************************************************************************** From 4d089c270c61fbc70558f39a927c89be8b6803c3 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 14 Feb 2012 11:21:23 -0800 Subject: [PATCH 04/24] 3.0 UI - system page - localize KVM/XenServer/VMWare network label default display value. --- .../WEB-INF/classes/resources/messages.properties | 1 + .../classes/resources/messages_ja.properties | 2 +- ui/index.jsp | 3 ++- ui/scripts/system.js | 13 ++++++------- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 903ba929a29..8ab0922ca6a 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -1019,4 +1019,5 @@ supported.source.NAT.type=Supported Source NAT type elastic.LB=Elastic LB LB.isolation=LB isolation elastic.IP=Elastic IP +network.label.display.for.blank.value=Use default gateway diff --git a/client/WEB-INF/classes/resources/messages_ja.properties b/client/WEB-INF/classes/resources/messages_ja.properties index a8a46d0e2a9..b567a13d752 100644 --- a/client/WEB-INF/classes/resources/messages_ja.properties +++ b/client/WEB-INF/classes/resources/messages_ja.properties @@ -1023,4 +1023,4 @@ supported.source.NAT.type=Supported Source NAT type elastic.LB=Elastic LB LB.isolation=LB isolation elastic.IP=Elastic IP - +network.label.display.for.blank.value=使用默認網關 diff --git a/ui/index.jsp b/ui/index.jsp index 25ec11f2d7f..c361f55d3a8 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -2578,6 +2578,7 @@ dictionary = { 'supported.source.NAT.type': '', 'elastic.LB': '', 'LB.isolation': '', -'elastic.IP': '' +'elastic.IP': '', +'network.label.display.for.blank.value': '' }; diff --git a/ui/scripts/system.js b/ui/scripts/system.js index db96119f71b..c45c249db60 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -4,7 +4,6 @@ var selectedClusterObj, selectedZoneObj, selectedPublicNetworkObj, selectedManagementNetworkObj, selectedPhysicalNetworkObj, selectedGuestNetworkObj; var naasStatusMap = {}; var nspMap = {}; - var networklabelDisplayForBlankValue = "Use default gateway"; var getTrafficType = function(physicalNetwork, typeID) { var trafficType = {}; @@ -26,22 +25,22 @@ }); if(trafficType.xennetworklabel == null || trafficType.xennetworklabel == 0) - trafficType.xennetworklabel = networklabelDisplayForBlankValue; + trafficType.xennetworklabel = dictionary['network.label.display.for.blank.value']; if(trafficType.kvmnetworklabel == null || trafficType.kvmnetworklabel == 0) - trafficType.kvmnetworklabel = networklabelDisplayForBlankValue; + trafficType.kvmnetworklabel = dictionary['network.label.display.for.blank.value']; if(trafficType.vmwarenetworklabel == null || trafficType.vmwarenetworklabel == 0) - trafficType.vmwarenetworklabel = networklabelDisplayForBlankValue; + trafficType.vmwarenetworklabel = dictionary['network.label.display.for.blank.value']; return trafficType; }; var updateTrafficLabels = function(trafficType, labels, complete) { var array1 = []; - if(labels.xennetworklabel != networklabelDisplayForBlankValue) + if(labels.xennetworklabel != dictionary['network.label.display.for.blank.value']) array1.push("&xennetworklabel=" + labels.xennetworklabel); - if(labels.kvmnetworklabel != networklabelDisplayForBlankValue) + if(labels.kvmnetworklabel != dictionary['network.label.display.for.blank.value']) array1.push("&kvmnetworklabel=" + labels.kvmnetworklabel); - if(labels.vmwarenetworklabel != networklabelDisplayForBlankValue) + if(labels.vmwarenetworklabel != dictionary['network.label.display.for.blank.value']) array1.push("&vmwarenetworklabel=" + labels.vmwarenetworklabel); $.ajax({ From 5e630c0699d7dea3f1a83835e1c7ecae6f367d7b Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Tue, 14 Feb 2012 11:49:16 -0800 Subject: [PATCH 05/24] bug 13537: use --no-same-owner when we untar OVA file to work with NFSv4. Reviewed-By: Anthony --- .../vmware/manager/VmwareStorageManagerImpl.java | 13 +++++++++---- .../com/cloud/storage/template/VmdkProcessor.java | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java b/core/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java index 02f444ec78e..b699cbc31e7 100644 --- a/core/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java +++ b/core/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java @@ -560,12 +560,15 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } // untar OVA file at template directory - command = new Script("tar", 0, s_logger); + command = new Script("tar", 0, s_logger); + command.add("--no-same-owner"); command.add("-xf", installFullName); command.setWorkDir(installFullPath); - result = command.execute(); + s_logger.info("Executing command: " + command.toString()); + result = command.execute(); if(result != null) { - String msg = "unable to copy snapshot " + snapshotFullName + " to " + installFullPath; + String msg = "unable to untar snapshot " + snapshotFullName + " to " + + installFullPath; s_logger.error(msg); throw new Exception(msg); } @@ -643,8 +646,10 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { String srcFileName = getOVFFilePath(srcOVAFileName); if(srcFileName == null) { Script command = new Script("tar", 0, s_logger); + command.add("--no-same-owner"); command.add("-xf", srcOVAFileName); - command.setWorkDir(secondaryMountPoint + "/" + secStorageDir); + command.setWorkDir(secondaryMountPoint + "/" + secStorageDir); + s_logger.info("Executing command: " + command.toString()); String result = command.execute(); if(result != null) { String msg = "Unable to unpack snapshot OVA file at: " + srcOVAFileName; diff --git a/core/src/com/cloud/storage/template/VmdkProcessor.java b/core/src/com/cloud/storage/template/VmdkProcessor.java index bd354642fdd..f3dbbda3fea 100644 --- a/core/src/com/cloud/storage/template/VmdkProcessor.java +++ b/core/src/com/cloud/storage/template/VmdkProcessor.java @@ -63,7 +63,8 @@ public class VmdkProcessor implements Processor { String templateFileFullPath = templatePath + templateName + "." + ImageFormat.OVA.getFileExtension(); File templateFile = new File(templateFileFullPath); - Script command = new Script("tar", 0, s_logger); + Script command = new Script("tar", 0, s_logger); + command.add("--no-same-owner", templateFileFullPath); command.add("-xf", templateFileFullPath); command.setWorkDir(templateFile.getParent()); String result = command.execute(); From d031313b70d0911e1c2f9956c68f5cd1fdbeaf95 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 14 Feb 2012 11:32:21 -0800 Subject: [PATCH 06/24] Localize dashboard capacity labels --- ui/scripts/dashboard.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/scripts/dashboard.js b/ui/scripts/dashboard.js index 4ca44f2738e..6a712e0e0ab 100644 --- a/ui/scripts/dashboard.js +++ b/ui/scripts/dashboard.js @@ -236,13 +236,15 @@ complete($.extend(data, { zoneCapacities: $.map(capacities, function(capacity) { if (capacity.podname) { - capacity.zonename = capacity.zonename.concat('
Pod: ' + capacity.podname); + capacity.zonename = capacity.zonename.concat('
' + _l('label.pod') + ': ' + capacity.podname); } if (capacity.clustername) { - capacity.zonename = capacity.zonename.concat('
Cluster: ' + capacity.clustername); + capacity.zonename = capacity.zonename.concat('
' + _l('label.cluster') + ': ' + capacity.clustername); } + capacity.zonename.replace('Zone:', _l('label.zone') + ':'); + return { zoneID: capacity.zoneid, // Temporary fix for dashboard zoneName: capacity.zonename, From 8246aff8124c2980d3e466d60a93db79311a1819 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 14 Feb 2012 11:40:13 -0800 Subject: [PATCH 07/24] Add missing localization for notifications labels --- client/WEB-INF/classes/resources/messages.properties | 1 + client/WEB-INF/classes/resources/messages_ja.properties | 1 + ui/index.jsp | 1 + ui/scripts/ui/widgets/notifications.js | 6 +++--- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 8ab0922ca6a..07c8c3e4f2f 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -1,3 +1,4 @@ +label.clear.list=Clear list label.full.path=Full path message.add.domain=Please specify the subdomain you want to create under this domain message.delete.user=Please confirm that you would like to delete this user. diff --git a/client/WEB-INF/classes/resources/messages_ja.properties b/client/WEB-INF/classes/resources/messages_ja.properties index b567a13d752..26506900b76 100644 --- a/client/WEB-INF/classes/resources/messages_ja.properties +++ b/client/WEB-INF/classes/resources/messages_ja.properties @@ -1,4 +1,5 @@ #cloudstack 3.0 (begin) ******************************************************************************************** +label.clear.list=一覧をクリアする label.full.path=フルパス message.add.domain=このドメインの下に作成するサブドメインを指定してください message.delete.user=このユーザーを削除したいことを確認してください。 diff --git a/ui/index.jsp b/ui/index.jsp index c361f55d3a8..1f7ce1b31ba 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1599,6 +1599,7 @@ diff --git a/ui/scripts/system.js b/ui/scripts/system.js index c45c249db60..20d1ee259e4 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -79,7 +79,7 @@ }; cloudStack.sections.system = { - title: 'System', + title: 'label.menu.system', id: 'system', // System dashboard @@ -298,12 +298,12 @@ fields: [ { traffictype: { label: 'label.traffic.type' }, - broadcastdomaintype: { label: 'Broadcast domain type' } + broadcastdomaintype: { label: 'label.broadcast.domain.type' } }, { - xennetworklabel: { label: 'Xen traffic label', isEditable: true }, - kvmnetworklabel: { label: 'KVM traffic label', isEditable: true }, - vmwarenetworklabel: { label: 'VMware traffic label', isEditable: true } + xennetworklabel: { label: 'Xen.traffic.label', isEditable: true }, + kvmnetworklabel: { label: 'KVM.traffic.label', isEditable: true }, + vmwarenetworklabel: { label: 'VMware.traffic.label', isEditable: true } } ], @@ -336,15 +336,15 @@ context: args.context, noSelect: true, fields: { - 'gateway': { edit: true, label: 'Gateway' }, - 'netmask': { edit: true, label: 'Netmask' }, - 'vlan': { edit: true, label: 'VLAN', isOptional: true }, - 'startip': { edit: true, label: 'Start IP' }, - 'endip': { edit: true, label: 'End IP' }, - 'add-rule': { label: 'Add', addButton: true } + 'gateway': { edit: true, label: 'label.gateway' }, + 'netmask': { edit: true, label: 'label.netmask' }, + 'vlan': { edit: true, label: 'label.vlan', isOptional: true }, + 'startip': { edit: true, label: 'start.IP' }, + 'endip': { edit: true, label: 'end.IP' }, + 'add-rule': { label: 'label.add', addButton: true } }, add: { - label: 'Add', + label: 'label.add', action: function(args) { var array1 = []; array1.push("&zoneId=" + args.context.zones[0].id); @@ -370,7 +370,7 @@ args.response.success({ data: item, notification: { - label: 'IP range is added', + label: 'IP.range.is.added', poll: function(args) { args.complete(); } @@ -386,7 +386,7 @@ }, actions: { destroy: { - label: 'Delete', + label: 'remove.IP.range', action: function(args) { $.ajax({ url: createURL('deleteVlanIpRange&id=' + args.context.multiRule[0].id), @@ -395,7 +395,7 @@ success: function(json) { args.response.success({ notification: { - label: 'Remove IP range ' + args.context.multiRule[0].id, + label: 'remove.IP.range', poll: function(args) { args.complete(); } @@ -436,7 +436,7 @@ }); }, messages: { - notification: 'Updated storage traffic type' + notification: 'storage.traffic.type.is.updated' } } }, @@ -446,12 +446,12 @@ fields: [ { traffictype: { label: 'label.traffic.type' }, - broadcastdomaintype: { label: 'Broadcast domain type' } + broadcastdomaintype: { label: 'label.broadcast.domain.type' } }, { - xennetworklabel: { label: 'Xen traffic label', isEditable: true }, - kvmnetworklabel: { label: 'KVM traffic label', isEditable: true }, - vmwarenetworklabel: { label: 'VMware traffic label', isEditable: true } + xennetworklabel: { label: 'Xen.traffic.label', isEditable: true }, + kvmnetworklabel: { label: 'KVM.traffic.label', isEditable: true }, + vmwarenetworklabel: { label: 'VMware.traffic.label', isEditable: true } } ], @@ -499,14 +499,14 @@ }); } }, - 'netmask': { edit: true, label: 'Netmask' }, - 'vlan': { edit: true, label: 'VLAN', isOptional: true }, - 'startip': { edit: true, label: 'Start IP' }, - 'endip': { edit: true, label: 'End IP' }, - 'add-rule': { label: 'Add', addButton: true } + 'netmask': { edit: true, label: 'label.netmask' }, + 'vlan': { edit: true, label: 'label.vlan', isOptional: true }, + 'startip': { edit: true, label: 'start.IP' }, + 'endip': { edit: true, label: 'end.IP' }, + 'add-rule': { label: 'label.add', addButton: true } }, add: { - label: 'Add', + label: 'label.add', action: function(args) { var array1 = []; array1.push("&zoneId=" + args.context.zones[0].id); @@ -529,7 +529,7 @@ jobId: json.createstoragenetworkiprangeresponse.jobid }, notification: { - label: 'Added IP range', + label: 'IP.range.is.added', poll: pollAsyncJobResult } }); @@ -543,7 +543,7 @@ }, actions: { destroy: { - label: 'Delete', + label: 'label.delete', action: function(args) { $.ajax({ url: createURL('deleteStorageNetworkIpRange&id=' + args.context.multiRule[0].id), @@ -552,7 +552,7 @@ success: function(json) { args.response.success({ notification: { - label: 'Remove IP range ' + args.context.multiRule[0].id, + label: 'remove.IP.range', poll: function(args) { args.complete(); } @@ -603,12 +603,12 @@ fields: [ { traffictype: { label: 'label.traffic.type' }, - broadcastdomaintype: { label: 'Broadcast domain type' } + broadcastdomaintype: { label: 'label.broadcast.domain.type' } }, { - xennetworklabel: { label: 'Xen traffic label', isEditable: true }, - kvmnetworklabel: { label: 'KVM traffic label', isEditable: true }, - vmwarenetworklabel: { label: 'VMware traffic label', isEditable: true } + xennetworklabel: { label: 'Xen.traffic.label', isEditable: true }, + kvmnetworklabel: { label: 'KVM.traffic.label', isEditable: true }, + vmwarenetworklabel: { label: 'VMware.traffic.label', isEditable: true } } ], dataProvider: function(args) { @@ -634,10 +634,10 @@ listView: { fields: { name: { label: 'Pod name' }, - gateway: { label: 'Gateway' }, //'Reserved system gateway' is too long and causes a visual format bug (2 lines overlay) - netmask: { label: 'Netmask' }, //'Reserved system netmask' is too long and causes a visual format bug (2 lines overlay) - startip: { label: 'Start IP' }, //'Reserved system start IP' is too long and causes a visual format bug (2 lines overlay) - endip: { label: 'End IP' } //'Reserved system end IP' is too long and causes a visual format bug (2 lines overlay) + gateway: { label: 'label.gateway' }, //'Reserved system gateway' is too long and causes a visual format bug (2 lines overlay) + netmask: { label: 'label.netmask' }, //'Reserved system netmask' is too long and causes a visual format bug (2 lines overlay) + startip: { label: 'start.IP' }, //'Reserved system start IP' is too long and causes a visual format bug (2 lines overlay) + endip: { label: 'end.IP' } //'Reserved system end IP' is too long and causes a visual format bug (2 lines overlay) }, dataProvider: function(args) { var array1 = []; @@ -734,9 +734,9 @@ broadcastdomainrange: { label: 'Broadcast domain range' } }, { - xennetworklabel: { label: 'Xen traffic label', isEditable: true }, - kvmnetworklabel: { label: 'KVM traffic label', isEditable: true }, - vmwarenetworklabel: { label: 'VMware traffic label', isEditable: true } + xennetworklabel: { label: 'Xen.traffic.label', isEditable: true }, + kvmnetworklabel: { label: 'KVM.traffic.label', isEditable: true }, + vmwarenetworklabel: { label: 'VMware.traffic.label', isEditable: true } } ], dataProvider: function(args) { @@ -799,14 +799,14 @@ }); } }, - 'gateway': { edit: true, label: 'Gateway' }, - 'netmask': { edit: true, label: 'Netmask' }, - 'startip': { edit: true, label: 'Start IP' }, - 'endip': { edit: true, label: 'End IP' }, - 'add-rule': { label: 'Add', addButton: true } + 'gateway': { edit: true, label: 'label.gateway' }, + 'netmask': { edit: true, label: 'label.netmask' }, + 'startip': { edit: true, label: 'start.IP' }, + 'endip': { edit: true, label: 'end.IP' }, + 'add-rule': { label: 'label.add', addButton: true } }, add: { - label: 'Add', + label: 'label.add', action: function(args) { var array1 = []; array1.push("&podid=" + args.data.podid); @@ -826,7 +826,7 @@ args.response.success({ data: item, notification: { - label: 'IP range is added', + label: 'IP.range.is.added', poll: function(args) { args.complete(); } @@ -842,7 +842,7 @@ }, actions: { destroy: { - label: 'Delete', + label: 'remove.IP.range', action: function(args) { $.ajax({ url: createURL('deleteVlanIpRange&id=' + args.context.multiRule[0].id), @@ -851,7 +851,7 @@ success: function(json) { args.response.success({ notification: { - label: 'Remove IP range ' + args.context.multiRule[0].id, + label: 'remove.IP.range', poll: function(args) { args.complete(); } @@ -1658,8 +1658,8 @@ label: 'Network offering ID' }, - gateway: { label: 'Gateway' }, - //netmask: { label: 'Netmask' }, + gateway: { label: 'label.gateway' }, + //netmask: { label: 'label.netmask' }, cidr: { label: 'CIDR' }, networkdomaintext: { label: 'Network domain' @@ -1908,7 +1908,7 @@ Vpn: { label: 'VPN' }, Dhcp: { label: 'DHCP' }, Dns: { label: 'DNS' }, - Gateway: { label: 'Gateway' }, + Gateway: { label: 'label.gateway' }, Firewall: { label: 'Firewall' }, Lb: { label: 'Load Balancer' }, UserData: { label: 'UserData' }, @@ -3296,7 +3296,7 @@ }, 'delete': { - label: 'Delete' , + label: 'label.delete' , messages: { confirm: function(args) { return 'Please confirm that you want to delete this zone.'; @@ -3771,7 +3771,7 @@ privateip: { label: 'Private IP' }, linklocalip: { label: 'Link local IP' }, hostname: { label: 'Host' }, - gateway: { label: 'Gateway' }, + gateway: { label: 'label.gateway' }, created: { label: 'label.created', converter: cloudStack.converters.toLocalDate }, activeviewersessions: { label: 'Active sessions' } } @@ -4426,8 +4426,8 @@ section: 'pods', fields: { name: { label: 'label.name' }, - gateway: { label: 'Gateway' }, - netmask: { label: 'Netmask' }, + gateway: { label: 'label.gateway' }, + netmask: { label: 'label.netmask' }, allocationstate: { converter: function(str) { // For localization @@ -4654,7 +4654,7 @@ }, 'delete': { - label: 'Delete' , + label: 'label.delete' , messages: { confirm: function(args) { return 'Please confirm that you want to delete this pod.'; @@ -4693,10 +4693,10 @@ }, { id: { label: 'label.id' }, - netmask: { label: 'Netmask', isEditable: true }, + netmask: { label: 'label.netmask', isEditable: true }, startip: { label: 'Start IP Range', isEditable: true }, endip: { label: 'End IP Range', isEditable: true }, - gateway: { label: 'Gateway', isEditable: true }, + gateway: { label: 'label.gateway', isEditable: true }, allocationstate: { converter: function(str) { // For localization @@ -4721,8 +4721,8 @@ fields: [ { id: { label: 'label.id' }, - gateway: { label: 'Gateway' }, - netmask: { label: 'Netmask' }, + gateway: { label: 'label.gateway' }, + netmask: { label: 'label.netmask' }, startip: { label: 'Start IP range' }, endip: { label: 'End IP range' } } @@ -5127,7 +5127,7 @@ }, 'delete': { - label: 'Delete' , + label: 'label.delete' , messages: { confirm: function(args) { return 'Please confirm that you want to delete this cluster.'; @@ -6400,7 +6400,7 @@ }, 'delete': { - label: 'Delete' , + label: 'label.delete' , messages: { confirm: function(args) { return 'Please confirm that you want to delete this primary storage.'; @@ -6584,7 +6584,7 @@ name: 'Secondary storage details', actions: { 'delete': { - label: 'Delete' , + label: 'label.delete' , messages: { confirm: function(args) { return 'Please confirm that you want to delete this secondary storage.'; @@ -6648,9 +6648,9 @@ fields: { //id: { label: 'label.id' }, //podname: { label: 'Pod' }, - //vlan: { label: 'VLAN' }, - startip: { label: 'Start IP' }, - endip: { label: 'End IP' } + //vlan: { label: 'label.vlan' }, + startip: { label: 'start.IP' }, + endip: { label: 'end.IP' } }, dataProvider: function(args) { @@ -6791,19 +6791,19 @@ }, 'delete': { - label: 'Delete' , + label: 'remove.IP.range' , messages: { confirm: function(args) { return 'Please confirm that you want to delete this IP range.'; }, success: function(args) { - return 'IP range is being deleted.'; + return 'remove.IP.range'; }, notification: function(args) { - return 'Deleting IP range'; + return 'remove.IP.range'; }, complete: function(args) { - return 'IP range has been deleted.'; + return 'remove.IP.range'; } }, action: function(args) { From a72d419f8c8ccd4bfbcccad7977bb8fee5458409 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Tue, 14 Feb 2012 12:08:04 -0800 Subject: [PATCH 13/24] bug 13679: cosmetic fix to remove NPE warning message from log. Reviewed-By: anthony --- .../src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index 0455e60bccb..66eadd837a8 100755 --- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -1633,6 +1633,11 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx try { long proxyVmId = startupCmd.getProxyVmId(); ConsoleProxyVO consoleProxy = _consoleProxyDao.findById(proxyVmId); + if(consoleProxy == null) { + s_logger.info("Proxy " + proxyVmId + " is no longer in DB, skip sending startup command"); + return; + } + assert (consoleProxy != null); HostVO consoleProxyHost = findConsoleProxyHostByName(consoleProxy.getHostName()); From 63fd5d1f641aa0c6f8430ae421934d835df17944 Mon Sep 17 00:00:00 2001 From: prachi Date: Tue, 14 Feb 2012 11:57:11 -0800 Subject: [PATCH 14/24] Bug 13703 - [External Service Providers] Unable to find a Discoverer to load the resource: 1 for hypervisor type : null Changes: - in case of external service providers, there is no discoverer that could load the resource. - So we have to rely on agentMgr to load the resource as earlier. --- .../cloud/agent/manager/AgentManagerImpl.java | 81 +++++++++++++++++-- 1 file changed, 76 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index 07ea138d76c..563a42cdbe7 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -17,9 +17,12 @@ */ package com.cloud.agent.manager; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.nio.channels.ClosedChannelException; import java.util.ArrayList; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; @@ -676,6 +679,74 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager { } } + private ServerResource loadResourcesWithoutHypervisor(HostVO host){ + String resourceName = host.getResource(); + ServerResource resource = null; + try { + Class clazz = Class.forName(resourceName); + Constructor constructor = clazz.getConstructor(); + resource = (ServerResource) constructor.newInstance(); + } catch (ClassNotFoundException e) { + s_logger.warn("Unable to find class " + host.getResource(), e); + } catch (InstantiationException e) { + s_logger.warn("Unablet to instantiate class " + host.getResource(), e); + } catch (IllegalAccessException e) { + s_logger.warn("Illegal access " + host.getResource(), e); + } catch (SecurityException e) { + s_logger.warn("Security error on " + host.getResource(), e); + } catch (NoSuchMethodException e) { + s_logger.warn("NoSuchMethodException error on " + host.getResource(), e); + } catch (IllegalArgumentException e) { + s_logger.warn("IllegalArgumentException error on " + host.getResource(), e); + } catch (InvocationTargetException e) { + s_logger.warn("InvocationTargetException error on " + host.getResource(), e); + } + + if(resource != null){ + _hostDao.loadDetails(host); + + HashMap params = new HashMap(host.getDetails().size() + 5); + params.putAll(host.getDetails()); + + params.put("guid", host.getGuid()); + params.put("zone", Long.toString(host.getDataCenterId())); + if (host.getPodId() != null) { + params.put("pod", Long.toString(host.getPodId())); + } + if (host.getClusterId() != null) { + params.put("cluster", Long.toString(host.getClusterId())); + String guid = null; + ClusterVO cluster = _clusterDao.findById(host.getClusterId()); + if (cluster.getGuid() == null) { + guid = host.getDetail("pool"); + } else { + guid = cluster.getGuid(); + } + if (guid != null && !guid.isEmpty()) { + params.put("pool", guid); + } + } + + params.put("ipaddress", host.getPrivateIpAddress()); + params.put("secondary.storage.vm", "false"); + params.put("max.template.iso.size", _configDao.getValue(Config.MaxTemplateAndIsoSize.toString())); + params.put("migratewait", _configDao.getValue(Config.MigrateWait.toString())); + + try { + resource.configure(host.getName(), params); + } catch (ConfigurationException e) { + s_logger.warn("Unable to configure resource due to " + e.getMessage()); + return null; + } + + if (!resource.start()) { + s_logger.warn("Unable to start the resource"); + return null; + } + } + return resource; + } + @SuppressWarnings("rawtypes") protected boolean loadDirectlyConnectedHost(HostVO host, boolean forRebalance) { @@ -685,14 +756,14 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager { //load the respective discoverer Discoverer discoverer = _resourceMgr.getMatchingDiscover(host.getHypervisorType()); if(discoverer == null){ - s_logger.warn("Unable to find a Discoverer to load the resource: "+ host.getId() +" for hypervisor type: "+host.getHypervisorType()); - return false; + s_logger.info("Could not to find a Discoverer to load the resource: "+ host.getId() +" for hypervisor type: "+host.getHypervisorType()); + resource = loadResourcesWithoutHypervisor(host); + }else{ + resource = discoverer.reloadResource(host); } - resource = discoverer.reloadResource(host); - if(resource == null){ - s_logger.warn("Discoverer is unable to load the resource: "+ host.getId()); + s_logger.warn("Unable to load the resource: "+ host.getId()); return false; } From 5446826a2f4fda1bb863f2160d88701170dc81df Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Tue, 14 Feb 2012 10:40:31 -0800 Subject: [PATCH 15/24] Added instanceType to some physical network async commands Reviewed-by: Kelven Yang --- .../com/cloud/api/commands/CreatePhysicalNetworkCmd.java | 6 +++++- .../com/cloud/api/commands/DeletePhysicalNetworkCmd.java | 6 ++++++ .../com/cloud/api/commands/UpdatePhysicalNetworkCmd.java | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/api/src/com/cloud/api/commands/CreatePhysicalNetworkCmd.java b/api/src/com/cloud/api/commands/CreatePhysicalNetworkCmd.java index 6e6270a7e12..0581edf0a72 100644 --- a/api/src/com/cloud/api/commands/CreatePhysicalNetworkCmd.java +++ b/api/src/com/cloud/api/commands/CreatePhysicalNetworkCmd.java @@ -169,5 +169,9 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd { throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity"); } } - + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.PhysicalNetwork; + } } diff --git a/api/src/com/cloud/api/commands/DeletePhysicalNetworkCmd.java b/api/src/com/cloud/api/commands/DeletePhysicalNetworkCmd.java index 7a3bc068625..50aec093581 100644 --- a/api/src/com/cloud/api/commands/DeletePhysicalNetworkCmd.java +++ b/api/src/com/cloud/api/commands/DeletePhysicalNetworkCmd.java @@ -28,6 +28,7 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.SuccessResponse; +import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -91,4 +92,9 @@ public class DeletePhysicalNetworkCmd extends BaseAsyncCmd { public String getEventType() { return EventTypes.EVENT_PHYSICAL_NETWORK_DELETE; } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.PhysicalNetwork; + } } diff --git a/api/src/com/cloud/api/commands/UpdatePhysicalNetworkCmd.java b/api/src/com/cloud/api/commands/UpdatePhysicalNetworkCmd.java index d314114f566..b19d3c17da5 100644 --- a/api/src/com/cloud/api/commands/UpdatePhysicalNetworkCmd.java +++ b/api/src/com/cloud/api/commands/UpdatePhysicalNetworkCmd.java @@ -30,6 +30,7 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.PhysicalNetworkResponse; +import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.PhysicalNetwork; import com.cloud.user.Account; @@ -118,4 +119,9 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd { public String getEventType() { return EventTypes.EVENT_PHYSICAL_NETWORK_UPDATE; } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.PhysicalNetwork; + } } From 5e9a15c07d63c76dbd0f4a4148d205bfa988e8dc Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Tue, 14 Feb 2012 12:42:26 -0800 Subject: [PATCH 16/24] bug 13708: make a search by traffic type when locate physical network in the zone status 13708: resolved fixed reviewed-by: Prachi Damle --- .../cloud/api/commands/CreateNetworkCmd.java | 2 +- api/src/com/cloud/network/NetworkService.java | 2 +- .../com/cloud/network/NetworkManagerImpl.java | 18 ++++++++++++------ .../network/dao/PhysicalNetworkDaoImpl.java | 13 +++++-------- .../cloud/network/guru/GuestNetworkGuru.java | 2 +- .../cloud/network/MockNetworkManagerImpl.java | 2 +- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/api/src/com/cloud/api/commands/CreateNetworkCmd.java b/api/src/com/cloud/api/commands/CreateNetworkCmd.java index 87e5a2d3aad..d3fa4b4dc5f 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkCmd.java @@ -185,7 +185,7 @@ public class CreateNetworkCmd extends BaseCmd { if (zoneId == null) { throw new InvalidParameterValueException("ZoneId is required as physicalNetworkId is null"); } - return _networkService.findPhysicalNetworkId(zoneId, offering.getTags()); + return _networkService.findPhysicalNetworkId(zoneId, offering.getTags(), offering.getTrafficType()); } } diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java index 07a15d5f677..bbb102c6f46 100755 --- a/api/src/com/cloud/network/NetworkService.java +++ b/api/src/com/cloud/network/NetworkService.java @@ -115,7 +115,7 @@ public interface NetworkService { PhysicalNetworkServiceProvider getCreatedPhysicalNetworkServiceProvider(Long providerId); - long findPhysicalNetworkId(long zoneId, String tag); + long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType); PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan); diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index b0d74be91d2..2af5519cda5 100644 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -5068,8 +5068,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag } @Override - public long findPhysicalNetworkId(long zoneId, String tag) { - List pNtwks = _physicalNetworkDao.listByZone(zoneId); + public long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType) { + List pNtwks = new ArrayList(); + if (trafficType != null) { + pNtwks = _physicalNetworkDao.listByZoneAndTrafficType(zoneId, trafficType); + } else { + pNtwks = _physicalNetworkDao.listByZone(zoneId); + } + if (pNtwks.isEmpty()) { throw new InvalidParameterValueException("Unable to find physical network in zone id=" + zoneId); } @@ -5330,7 +5336,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag // physical network id can be null in Guest Network in Basic zone, so locate the physical network if (physicalNetworkId == null) { - physicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), null); + physicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), null, null); } return isServiceEnabledInNetwork(physicalNetworkId, network.getId(), Service.SecurityGroup); @@ -5754,7 +5760,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag physicalNetworkId = getNonGuestNetworkPhysicalNetworkId(network); } else { NetworkOffering offering = _configMgr.getNetworkOffering(network.getNetworkOfferingId()); - physicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), offering.getTags()); + physicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), offering.getTags(), offering.getTrafficType()); } if (physicalNetworkId == null) { @@ -5896,7 +5902,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag Long physicalNetworkId = network.getPhysicalNetworkId(); NetworkOffering offering = _configMgr.getNetworkOffering(network.getNetworkOfferingId()); if (physicalNetworkId == null) { - physicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), offering.getTags()); + physicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), offering.getTags(), offering.getTrafficType()); } return physicalNetworkId; } @@ -6007,7 +6013,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag @Override public boolean areServicesEnabledInZone(long zoneId, long networkOfferingId, String tags, List services) { - long physicalNtwkId = findPhysicalNetworkId(zoneId, tags); + long physicalNtwkId = findPhysicalNetworkId(zoneId, tags, null); boolean result = true; List checkedProvider = new ArrayList(); for (Service service : services) { diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java b/server/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java index 51f0e146f2e..6334871d801 100644 --- a/server/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java +++ b/server/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java @@ -66,17 +66,14 @@ public class PhysicalNetworkDaoImpl extends GenericDaoBase dcSearch = createSearchBuilder(); - dcSearch.and("dataCenterId", dcSearch.entity().getDataCenterId(), Op.EQ); - dcSearch.join("trafficTypeSearch", trafficTypeSearch, dcSearch.entity().getId(), trafficTypeEntity.getPhysicalNetworkId(), JoinBuilder.JoinType.INNER); + SearchBuilder pnSearch = createSearchBuilder(); + pnSearch.and("dataCenterId", pnSearch.entity().getDataCenterId(), Op.EQ); + pnSearch.join("trafficTypeSearch", trafficTypeSearch, pnSearch.entity().getId(), trafficTypeEntity.getPhysicalNetworkId(), JoinBuilder.JoinType.INNER); - SearchCriteria sc = dcSearch.create(); + SearchCriteria sc = pnSearch.create(); sc.setJoinParameters("trafficTypeSearch", "trafficType", trafficType); sc.setParameters("dataCenterId", dataCenterId); - return listBy(sc); - + return listBy(sc); } - - } diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java index 50b89f3b1c1..6d08d3ceefe 100755 --- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java @@ -279,7 +279,7 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru { long dcId = dest.getDataCenter().getId(); //get physical network id - long physicalNetworkId = _networkMgr.findPhysicalNetworkId(dcId, offering.getTags()); + long physicalNetworkId = _networkMgr.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType()); NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated, network.getDataCenterId(), physicalNetworkId); diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java b/server/test/com/cloud/network/MockNetworkManagerImpl.java index 98c852d8273..a09a5a7af94 100755 --- a/server/test/com/cloud/network/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java @@ -514,7 +514,7 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS } @Override - public long findPhysicalNetworkId(long zoneId, String tag) { + public long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType) { // TODO Auto-generated method stub return 0; } From cd8dd8fe382a0e236f463e4a098c084c2794cd23 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 14 Feb 2012 12:47:31 -0800 Subject: [PATCH 17/24] Add missing instance detail tab localization --- .../WEB-INF/classes/resources/messages.properties | 1 + .../classes/resources/messages_ja.properties | 1 + ui/index.jsp | 1 + ui/scripts/instances.js | 14 +++++++------- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 64fdc1cc9fc..3398dc54019 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -1,3 +1,4 @@ +label.default=Default label.viewing=Viewing label.move.to.top=Move to top label.move.up.row=Move up one row diff --git a/client/WEB-INF/classes/resources/messages_ja.properties b/client/WEB-INF/classes/resources/messages_ja.properties index 9f1c044def5..6addd7f3ca4 100644 --- a/client/WEB-INF/classes/resources/messages_ja.properties +++ b/client/WEB-INF/classes/resources/messages_ja.properties @@ -1,4 +1,5 @@ #cloudstack 3.0 (begin) ******************************************************************************************** +label.default=デフォルト label.viewing=表示 label.move.to.top=トップに移動 label.move.up.row=1行上に移動 diff --git a/ui/index.jsp b/ui/index.jsp index 26c6d05c5d6..12713eb915f 100644 --- a/ui/index.jsp +++ b/ui/index.jsp @@ -1599,6 +1599,7 @@ diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 20d1ee259e4..1a290a89566 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -288,7 +288,7 @@ }); }, messages: { - notification: 'Updated public traffic type' + notification: 'public.traffic.type.is.updated' } } }, @@ -330,7 +330,7 @@ }, ipAddresses: { - title: 'IP Ranges', + title: 'IP.ranges', custom: function(args) { return $('
').multiEdit({ context: args.context, @@ -476,7 +476,7 @@ }, ipAddresses: { - title: 'IP Ranges', + title: 'IP.ranges', custom: function(args) { return $('
').multiEdit({ context: args.context, @@ -593,7 +593,7 @@ }); }, messages: { - notification: 'Updated management traffic type' + notification: 'management.traffic.type.is.updated' } } }, @@ -630,10 +630,10 @@ } }, ipAddresses: { //read-only listView (no actions) filled with pod info (not VlanIpRange info) - title: 'IP Ranges', + title: 'IP.ranges', listView: { fields: { - name: { label: 'Pod name' }, + name: { label: 'label.pod' }, //pod name gateway: { label: 'label.gateway' }, //'Reserved system gateway' is too long and causes a visual format bug (2 lines overlay) netmask: { label: 'label.netmask' }, //'Reserved system netmask' is too long and causes a visual format bug (2 lines overlay) startip: { label: 'start.IP' }, //'Reserved system start IP' is too long and causes a visual format bug (2 lines overlay) @@ -724,14 +724,14 @@ { state: { label: 'label.state' }, startVlan: { - label: 'Start Vlan', + label: 'start.Vlan', isEditable: true }, endVlan: { - label: 'End Vlan', + label: 'end.Vlan', isEditable: true }, - broadcastdomainrange: { label: 'Broadcast domain range' } + broadcastdomainrange: { label: 'broadcast.domain.range' } }, { xennetworklabel: { label: 'Xen.traffic.label', isEditable: true }, @@ -776,14 +776,14 @@ }, ipAddresses: { - title: 'IP Ranges', + title: 'IP.ranges', custom: function(args) { return $('
').multiEdit({ context: args.context, noSelect: true, fields: { 'podid': { - label: 'Pod', + label: 'label.pod', select: function(args) { $.ajax({ url: createURL("listPods&zoneid=" + selectedZoneObj.id), @@ -891,32 +891,32 @@ }, network: { - title: 'Network', + title: 'label.network', listView: { section: 'networks', id: 'networks', fields: { name: { label: 'label.name' }, - type: { label: 'Type' }, - vlan: { label: 'VLAN ID' }, - cidr: { label: 'CIDR' }, - scope: { label: 'Scope' } + type: { label: 'label.type' }, + vlan: { label: 'label.vlan.id' }, + cidr: { label: 'label.cidr' }, + scope: { label: 'label.scope' } }, actions: { add: { - label: 'Add guest network', + label: 'label.add.guest.network', messages: { confirm: function(args) { - return 'Please confirm that you want to add a guest network'; + return 'message.add.guest.network'; }, notification: function(args) { - return 'Adding guest network'; + return 'label.add.guest.network'; } }, createForm: { - title: 'Add guest network', //Add guest network in advanced zone + title: 'label.add.guest.network', //Add guest network in advanced zone fields: { name: { @@ -924,15 +924,15 @@ validation: { required: true } }, description: { - label: 'Description', + label: 'label.description', validation: { required: true } }, vlanId: { - label: "VLAN ID" + label: 'label.vlan.id' }, scope: { - label: 'Scope', + label: 'label.scope', select: function(args) { var array1 = []; array1.push({id: 'zone-wide', description: 'All'}); @@ -972,7 +972,7 @@ } }, domainId: { - label: 'Domain', + label: 'label.domain', validation: { required: true }, select: function(args) { var items = []; @@ -1016,11 +1016,11 @@ args.response.success({data: items}); } }, - subdomainaccess: { label: 'Subdomain Access', isBoolean: true, isHidden: true }, - account: { label: 'Account' }, + subdomainaccess: { label: 'subdomain.access', isBoolean: true, isHidden: true }, + account: { label: 'label.account' }, projectId: { - label: 'Project', + label: 'label.project', validation: { required: true }, select: function(args) { var items = []; @@ -1039,8 +1039,8 @@ } }, - networkOfferingId: { - label: 'Network offering', + networkOfferingId: { + label: 'label.network.offering', dependsOn: 'scope', select: function(args) { var array1 = []; @@ -1131,11 +1131,11 @@ } }, - guestGateway: { label: 'Guest gateway' }, - guestNetmask: { label: 'Guest netmask' }, - guestStartIp: { label: 'Guest start IP' }, - guestEndIp: { label: 'Guest end IP' }, - networkdomain: { label: 'Network domain' } + guestGateway: { label: 'label.guest.gateway' }, + guestNetmask: { label: 'label.guest.netmask' }, + guestStartIp: { label: 'guest.start.IP' }, + guestEndIp: { label: 'guest.end.IP' }, + networkdomain: { label: 'label.network.domain' } } }, @@ -1192,109 +1192,13 @@ success: function(json) { var item = json.createnetworkresponse.network; args.response.success({data:item}); - - if(selectedZoneObj.networktype == "Basic") { - var array2 = []; - - var podId; - if(args.data.podId != "0") { - podId = args.data.podId; - } - else { //args.data.podId==0, create pod first - var array1 = []; - array1.push("&zoneId=" + selectedZoneObj.id); - array1.push("&name=" + todb(args.data.podname)); - array1.push("&gateway=" + todb(args.data.reservedSystemGateway)); - array1.push("&netmask=" + todb(args.data.reservedSystemNetmask)); - array1.push("&startIp=" + todb(args.data.reservedSystemStartIp)); - - var endip = args.data.reservedSystemEndIp; //optional - if (endip != null && endip.length > 0) - array1.push("&endIp=" + todb(endip)); - - $.ajax({ - url: createURL("createPod" + array1.join("")), - dataType: "json", - async: false, - success: function(json) { - var item = json.createpodresponse.pod; - podId = item.id; - }, - error: function(XMLHttpResponse) { - //var errorMsg = parseXMLHttpResponse(XMLHttpResponse); - //args.response.error(errorMsg); - } - }); - } - if(podId == null) { - alert("podId is null, so unable to create IP range on pod level"); - return; - } - array2.push("&podId=" + podId); - array2.push("&vlan=untagged"); - array2.push("&zoneid=" + selectedZoneObj.id); - array2.push("&forVirtualNetwork=false"); //direct VLAN - array2.push("&gateway=" + todb(args.data.guestGateway)); - array2.push("&netmask=" + todb(args.data.guestNetmask)); - array2.push("&startip=" + todb(args.data.guestStartIp)); - var endip = args.data.guestEndIp; - if(endip != null && endip.length > 0) - array2.push("&endip=" + todb(endip)); - $.ajax({ - url: createURL("createVlanIpRange" + array2.join("")), - dataType: "json", - async: false, - success: function(json) { - //var item = json.createvlaniprangeresponse.vlan; - }, - error: function(XMLHttpResponse) { - //var errorMsg = parseXMLHttpResponse(XMLHttpResponse); - //args.response.error(errorMsg); - } - }); - - } }, error: function(XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } }); - }, - - preAction: function(args) { - //var zone = $('.detail-view:last').data('view-args').context.zones[0]; //this line causes a bug when going back and forth between listView and detailView: "$(".detail-view:last").data("view-args").context.zones is undefined" - var zone = selectedZoneObj; - - var networksPresent = false; - - // Only 1 guest network is allowed per basic zone, - // so don't show the dialog in this case - $.ajax({ - url: createURL('listNetworks&listAll=true'), - data: { - trafficType: 'guest', - zoneId: zone.id - }, - async: false, - success: function(json) { - if (json.listnetworksresponse.network) { - networksPresent = true; - } - } - }); - - if (zone.networktype == 'Basic' && networksPresent) { - cloudStack.dialog.notice({ - message: 'Sorry, you can only have one guest network for a basic zone.' - }); - - return false; - } - - return true; - }, - + }, notification: { poll: function(args) { args.complete(); @@ -1303,7 +1207,7 @@ } }, - dataProvider: function(args) { + dataProvider: function(args) { //Jes var array1 = []; if(args.filterBy != null) { if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { @@ -1373,7 +1277,7 @@ name: 'Guest network details', viewAll: { path: '_zone.guestIpRanges', - label: 'IP ranges', + label: 'IP.ranges', preFilter: function(args) { if(selectedGuestNetworkObj.type == "Isolated") { var services = selectedGuestNetworkObj.service; @@ -1606,7 +1510,7 @@ isEditable: true }, type: { - label: 'Type' + label: 'label.type' }, state: { label: 'label.state' @@ -1620,11 +1524,11 @@ return "No"; } }, - vlan: { label: 'VLAN ID' }, - scope: { label: 'Scope' }, - networkofferingdisplaytext: { label: 'Network offering' }, + vlan: { label: 'label.vlan.id' }, + scope: { label: 'label.scope' }, + networkofferingdisplaytext: { label: 'label.network.offering' }, networkofferingid: { - label: 'Network offering', + label: 'label.network.offering', isEditable: true, select: function(args){ var items = []; @@ -1660,12 +1564,12 @@ gateway: { label: 'label.gateway' }, //netmask: { label: 'label.netmask' }, - cidr: { label: 'CIDR' }, + cidr: { label: 'label.cidr' }, networkdomaintext: { - label: 'Network domain' + label: 'label.network.domain' }, networkdomain: { - label: 'Network domain', + label: 'label.network.domain', isEditable: true }, @@ -1673,8 +1577,8 @@ subdomainaccess: { label: 'Subdomain Access?', converter: function(data) { return data ? 'Yes' : 'No'; } }, - account: { label: 'Account' }, - project: { label: 'Project' } + account: { label: 'label.account' }, + project: { label: 'label.project' } } ], dataProvider: function(args) { @@ -1893,7 +1797,7 @@ }, tabs: { network: { - title: 'Network', + title: 'label.network', fields: [ { name: { label: 'label.name' } @@ -2279,9 +2183,9 @@ linklocalip: { label: 'Link local IP' }, hostname: { label: 'Host' }, serviceofferingname: { label: 'label.service.offering' }, - networkdomain: { label: 'Network domain' }, + networkdomain: { label: 'label.network.domain' }, domain: { label: 'Domain' }, - account: { label: 'Account' }, + account: { label: 'label.account' }, created: { label: 'label.created', converter: cloudStack.converters.toLocalDate }, isredundantrouter: { label: 'Redundant router', @@ -2403,7 +2307,7 @@ isPassword: true }, networkdevicetype: { - label: 'Type', + label: 'label.type', select: function(args) { var items = []; items.push({id: "NetscalerMPXLoadBalancer", description: "NetScaler MPX LoadBalancer"}); @@ -2612,7 +2516,7 @@ isPassword: true }, networkdevicetype: { - label: 'Type', + label: 'label.type', select: function(args) { var items = []; items.push({id: "F5BigIpLoadBalancer", description: "F5 Big Ip Load Balancer"}); @@ -2820,7 +2724,7 @@ isPassword: true }, networkdevicetype: { - label: 'Type', + label: 'label.type', select: function(args) { var items = []; items.push({id: "JuniperSRXFirewall", description: "Juniper SRX Firewall"}); @@ -3192,7 +3096,7 @@ desc: 'Please fill in the following information to enable support for Swift', fields: { url: { label: 'URL', validation: { required: true } }, - account: { label: 'Account' }, + account: { label: 'label.account' }, username: { label: 'Username' }, key: { label: 'Key' } } @@ -3409,7 +3313,7 @@ networktype: { label: 'Network Type' }, guestcidraddress : { label: 'Guest CIDR' }, domain: { - label: 'Network domain', + label: 'label.network.domain', isEditable: true } } @@ -3429,27 +3333,27 @@ }, compute: { - title: 'Compute', + title: 'label.compute', custom: cloudStack.uiCustom.systemChart('compute') }, network: { - title: 'Network', + title: 'label.network', custom: cloudStack.uiCustom.systemChart('network') }, resources: { - title: 'Resources', + title: 'label.resources', custom: cloudStack.uiCustom.systemChart('resources') }, systemVMs: { - title: 'System VMs', + title: 'label.system.vms', listView: { - label: 'System VMs', + label: 'label.system.vms', id: 'systemVMs', fields: { name: { label: 'label.name' }, systemvmtype: { - label: 'Type', + label: 'label.type', converter: function(args) { if(args == "consoleproxy") return "Console Proxy VM"; @@ -3756,7 +3660,7 @@ id: { label: 'label.id' }, state: { label: 'label.state' }, systemvmtype: { - label: 'Type', + label: 'label.type', converter: function(args) { if(args == "consoleproxy") return "Console Proxy VM"; @@ -3838,7 +3742,7 @@ isPassword: true }, networkdevicetype: { - label: 'Type', + label: 'label.type', select: function(args) { var items = []; items.push({id: "NetscalerMPXLoadBalancer", description: "NetScaler MPX LoadBalancer"}); @@ -3980,7 +3884,7 @@ lbdeviceid: { label: 'label.id' }, ipaddress: { label: 'IP Address' }, lbdevicestate: { label: 'Status' }, - lbdevicename: { label: 'Type' }, + lbdevicename: { label: 'label.type' }, lbdevicecapacity: { label: 'Capacity' }, lbdevicededicated: { label: 'Dedicated', @@ -4038,7 +3942,7 @@ isPassword: true }, networkdevicetype: { - label: 'Type', + label: 'label.type', select: function(args) { var items = []; items.push({id: "F5BigIpLoadBalancer", description: "F5 Big Ip Load Balancer"}); @@ -4185,7 +4089,7 @@ lbdeviceid: { label: 'label.id' }, ipaddress: { label: 'IP Address' }, lbdevicestate: { label: 'Status' }, - lbdevicename: { label: 'Type' }, + lbdevicename: { label: 'label.type' }, lbdevicecapacity: { label: 'Capacity' }, lbdevicededicated: { label: 'Dedicated', @@ -4243,7 +4147,7 @@ isPassword: true }, networkdevicetype: { - label: 'Type', + label: 'label.type', select: function(args) { var items = []; items.push({id: "JuniperSRXFirewall", description: "Juniper SRX Firewall"}); @@ -4405,7 +4309,7 @@ fwdeviceid: { label: 'label.id' }, ipaddress: { label: 'IP Address' }, fwdevicestate: { label: 'Status' }, - fwdevicename: { label: 'Type' }, + fwdevicename: { label: 'label.type' }, fwdevicecapacity: { label: 'Capacity' }, timeout: { label: 'Timeout' } } @@ -5761,7 +5665,7 @@ id: { label: 'label.id' }, resourcestate: { label: 'Resource state' }, state: { label: 'label.state' }, - type: { label: 'Type' }, + type: { label: 'label.type' }, zonename: { label: 'Zone' }, podname: { label: 'Pod' }, clustername: { label: 'Cluster' }, @@ -6448,7 +6352,7 @@ }, podname: { label: 'Pod' }, clustername: { label: 'Cluster' }, - type: { label: 'Type' }, + type: { label: 'label.type' }, ipaddress: { label: 'IP Address' }, path: { label: 'Path' }, disksizetotal: { @@ -6750,10 +6654,10 @@ }, //create new pod fields ends here - guestGateway: { label: 'Guest gateway' }, - guestNetmask: { label: 'Guest netmask' }, - guestStartIp: { label: 'Guest start IP' }, - guestEndIp: { label: 'Guest end IP' } + guestGateway: { label: 'label.guest.gateway' }, + guestNetmask: { label: 'label.guest.netmask' }, + guestStartIp: { label: 'guest.start.IP' }, + guestEndIp: { label: 'guest.end.IP' } } }, From 67f074e86761c4d233f83d0112b9695138b8fa32 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 14 Feb 2012 14:01:20 -0800 Subject: [PATCH 23/24] Fix missing labels for attach/detach iso action --- ui/scripts/instances.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 2743aa209f1..11b385453fa 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -1016,10 +1016,10 @@ }, attachISO: { - label: 'label.attach.iso', + label: 'label.action.attach.iso', createForm: { - title: 'label.attach.iso', - desc: 'label.attach.iso', + title: 'label.action.attach.iso', + desc: 'label.action.attach.iso', fields: { iso: { label: 'ISO', @@ -1077,13 +1077,13 @@ }, detachISO: { - label: 'label.detach.iso', + label: 'label.action.detach.iso', messages: { confirm: function(args) { return 'message.detach.iso.confirm'; }, notification: function(args) { - return 'label.detach.iso'; + return 'label.action.detach.iso'; } }, action: function(args) { From 17349dfe12e4e3feea0aa96eac5ee27361480e0e Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Tue, 14 Feb 2012 13:54:42 -0800 Subject: [PATCH 24/24] bug 13695: deleteAccount - remove account from projects as a part of account cleanup process status 13695: resolved fixed Reviewed-by: Frank --- .../cloud/projects/dao/ProjectAccountDao.java | 4 ++- .../projects/dao/ProjectAccountDaoImpl.java | 16 +++++++++- .../com/cloud/user/AccountManagerImpl.java | 29 ++++++++++++------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/server/src/com/cloud/projects/dao/ProjectAccountDao.java b/server/src/com/cloud/projects/dao/ProjectAccountDao.java index 3e72eee9974..f113d283c39 100644 --- a/server/src/com/cloud/projects/dao/ProjectAccountDao.java +++ b/server/src/com/cloud/projects/dao/ProjectAccountDao.java @@ -36,7 +36,9 @@ public interface ProjectAccountDao extends GenericDao { List listPermittedAccountIds(long accountId); - List listAdministratedProjects(long adminAccountId); + List listAdministratedProjectIds(long adminAccountId); Long countByAccountIdAndRole(long accountId, ProjectAccount.Role role); + + void removeAccountFromProjects(long accountId); } diff --git a/server/src/com/cloud/projects/dao/ProjectAccountDaoImpl.java b/server/src/com/cloud/projects/dao/ProjectAccountDaoImpl.java index 1eb28cae1f9..49e31114bb1 100644 --- a/server/src/com/cloud/projects/dao/ProjectAccountDaoImpl.java +++ b/server/src/com/cloud/projects/dao/ProjectAccountDaoImpl.java @@ -21,6 +21,8 @@ import java.util.List; import javax.ejb.Local; +import org.apache.log4j.Logger; + import com.cloud.projects.ProjectAccount; import com.cloud.projects.ProjectAccountVO; import com.cloud.utils.db.GenericDaoBase; @@ -36,6 +38,7 @@ public class ProjectAccountDaoImpl extends GenericDaoBase AdminSearch; final GenericSearchBuilder ProjectAccountSearch; final GenericSearchBuilder CountByRoleSearch; + public static final Logger s_logger = Logger.getLogger(ProjectAccountDaoImpl.class.getName()); protected ProjectAccountDaoImpl() { AllFieldsSearch = createSearchBuilder(); @@ -124,7 +127,7 @@ public class ProjectAccountDaoImpl extends GenericDaoBase listAdministratedProjects(long adminAccountId) { + public List listAdministratedProjectIds(long adminAccountId) { SearchCriteria sc = AdminSearch.create(); sc.setParameters("role", ProjectAccount.Role.Admin); sc.setParameters("accountId", adminAccountId); @@ -138,5 +141,16 @@ public class ProjectAccountDaoImpl extends GenericDaoBase sc = AllFieldsSearch.create(); + sc.setParameters("accountId", accountId); + + int rowsRemoved = remove(sc); + if (rowsRemoved > 0) { + s_logger.debug("Removed account id=" + accountId + " from " + rowsRemoved + " projects"); + } + } } diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index dd4e49b647d..e56e0e140b3 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -445,20 +445,15 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag @Override public boolean deleteAccount(AccountVO account, long callerUserId, Account caller) { long accountId = account.getId(); - + + //delete the account record if (!_accountDao.remove(accountId)) { s_logger.error("Unable to delete account " + accountId); return false; } - List users = _userDao.listByAccount(accountId); - - for (UserVO user : users) { - _userDao.remove(user.getId()); - } - if (s_logger.isDebugEnabled()) { - s_logger.debug("Remove account " + accountId); + s_logger.debug("Removed account " + accountId); } return cleanupAccount(account, callerUserId, caller); @@ -468,8 +463,20 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag public boolean cleanupAccount(AccountVO account, long callerUserId, Account caller) { long accountId = account.getId(); boolean accountCleanupNeeded = false; - + try { + //cleanup the users from the account + List users = _userDao.listByAccount(accountId); + for (UserVO user : users) { + if (!_userDao.remove(user.getId())) { + s_logger.error("Unable to delete user: " + user + " as a part of account " + account + " cleanup"); + accountCleanupNeeded = true; + } + } + + //delete the account from project accounts + _projectAccountDao.removeAccountFromProjects(accountId); + // delete all vm groups belonging to accont List groups = _vmGroupDao.listByAccountId(accountId); for (InstanceGroupVO group : groups) { @@ -582,7 +589,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag } // delete account specific Virtual vlans (belong to system Public Network) - only when networks are cleaned -// up + // up // successfully if (networksDeleted) { if (!_configMgr.deleteAccountSpecificVirtualRanges(accountId)) { @@ -1010,7 +1017,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag } // Account that manages project(s) can't be removed - List managedProjectIds = _projectAccountDao.listAdministratedProjects(accountId); + List managedProjectIds = _projectAccountDao.listAdministratedProjectIds(accountId); if (!managedProjectIds.isEmpty()) { StringBuilder projectIds = new StringBuilder(); for (Long projectId : managedProjectIds) {