PVLAN: Remove bridge parameter in PvlanSetupCommand

Bridge is hypervisor dependent, shouldn't appear in PvlanSetupCommand.
This commit is contained in:
Sheng Yang 2013-05-01 13:23:08 -07:00
parent 05885457ec
commit 142f3b30f4
4 changed files with 8 additions and 14 deletions

View File

@ -26,7 +26,6 @@ public class PvlanSetupCommand extends Command {
VM
}
private String op;
private String bridge;
private String primary;
private String isolated;
private String vmMac;
@ -37,27 +36,26 @@ public class PvlanSetupCommand extends Command {
protected PvlanSetupCommand() {}
protected PvlanSetupCommand(Type type, String op, String bridge, URI uri)
protected PvlanSetupCommand(Type type, String op, URI uri)
{
this.type = type;
this.op = op;
this.bridge = bridge;
this.primary = NetUtils.getPrimaryPvlanFromUri(uri);
this.isolated = NetUtils.getIsolatedPvlanFromUri(uri);
}
static public PvlanSetupCommand createDhcpSetup(String op, String bridge, URI uri, String dhcpName, String dhcpMac, String dhcpIp)
static public PvlanSetupCommand createDhcpSetup(String op, URI uri, String dhcpName, String dhcpMac, String dhcpIp)
{
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.DHCP, op, bridge, uri);
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.DHCP, op, uri);
cmd.setDhcpName(dhcpName);
cmd.setDhcpMac(dhcpMac);
cmd.setDhcpIp(dhcpIp);
return cmd;
}
static public PvlanSetupCommand createVmSetup(String op, String bridge, URI uri, String vmMac)
static public PvlanSetupCommand createVmSetup(String op, URI uri, String vmMac)
{
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.VM, op, bridge, uri);
PvlanSetupCommand cmd = new PvlanSetupCommand(Type.VM, op, uri);
cmd.setVmMac(vmMac);
return cmd;
}
@ -71,10 +69,6 @@ public class PvlanSetupCommand extends Command {
return op;
}
public String getBridge() {
return bridge;
}
public String getPrimary() {
return primary;
}

View File

@ -1474,12 +1474,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
String primaryPvlan = cmd.getPrimary();
String isolatedPvlan = cmd.getIsolated();
String op = cmd.getOp();
String bridge = cmd.getBridge();
String dhcpName = cmd.getDhcpName();
String dhcpMac = cmd.getDhcpMac();
String dhcpIp = cmd.getDhcpIp();
String vmMac = cmd.getVmMac();
String bridge = "xenbr0";
String result = null;
if (cmd.getType() == PvlanSetupCommand.Type.DHCP) {
result = callHostPlugin(conn, "ovs-pvlan", "setup-pvlan-dhcp", "op", op, "bridge", bridge,

View File

@ -2219,7 +2219,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
if (!add) {
op = "delete";
}
PvlanSetupCommand cmd = PvlanSetupCommand.createDhcpSetup(op, "xenbr0", nic.getBroadcastUri(), router.getInstanceName(), nic.getMacAddress(), nic.getIp4Address());
PvlanSetupCommand cmd = PvlanSetupCommand.createDhcpSetup(op, nic.getBroadcastUri(), router.getInstanceName(), nic.getMacAddress(), nic.getIp4Address());
Commands cmds = new Commands(cmd);
// In fact we send command to the host of router, we're not programming router but the host
try {

View File

@ -2761,7 +2761,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
// "delete" would remove all the rules(if using ovs) related to this vm
op = "delete";
}
PvlanSetupCommand cmd = PvlanSetupCommand.createVmSetup(op, "xenbr0", nic.getBroadcastUri(), nic.getMacAddress());
PvlanSetupCommand cmd = PvlanSetupCommand.createVmSetup(op, nic.getBroadcastUri(), nic.getMacAddress());
Answer answer = null;
try {
answer = _agentMgr.send(hostId, cmd);